C_ENDINGS=C_ENDINGS+SPECIAL_ENDINGLESS_FILENAMES# consider the special endingless filenames like /dev/null to be C
BITCODE_ENDINGS= ('.bc', '.o', '.obj', '.lo')
DYNAMICLIB_ENDINGS= ('.dylib', '.so') # Windows .dll suffix is not included in this list, since those are never linked to directly on the command line.
ifdebug_configure: open(tempout, 'a').write('(compiling .s assembly, must use clang\n')
ifuse_js==1: use_js=0
elifarg=='-E'orarg=='-M'orarg=='-MM':
ifuse_js==1: use_js=0
ifsrc:
if'fopen'insrcand'"w"'insrc:
ifuse_js==1: use_js=0# we cannot write to files from js!
ifdebug_configure: open(tempout, 'a').write('Forcing clang since uses fopen to write\n')
compiler=os.environ.get('CONFIGURE_CC') or (shared.CLANGifnotuse_jselseshared.EMCC) # if CONFIGURE_CC is defined, use that. let's you use local gcc etc. if you need that
exit_with_error('%s: No such file or directory ("%s" was expected to be an input file, based on the commandline arguments provided)'% (arg, arg))
arg_ending=filename_type_ending(arg)
ifarg_ending.endswith(SOURCE_ENDINGS+BITCODE_ENDINGS+DYNAMICLIB_ENDINGS+ASSEMBLY_ENDINGS+HEADER_ENDINGS) orshared.Building.is_ar(arg): # we already removed -o <target>, so all these should be inputs
newargs[i] =''
ifarg_ending.endswith(SOURCE_ENDINGS):
input_files.append((i, arg))
has_source_inputs=True
elifarg_ending.endswith(HEADER_ENDINGS):
input_files.append((i, arg))
has_header_inputs=True
elifarg_ending.endswith(ASSEMBLY_ENDINGS) orshared.Building.is_bitcode(arg): # this should be bitcode, make sure it is valid
# if it's not, and it's a library, just add it to libs to find later
l=unsuffixed_basename(arg)
forprefixinLIB_PREFIXES:
ifnotprefix: continue
ifl.startswith(prefix):
l=l[len(prefix):]
break
libs.append((i, l))
newargs[i] =''
else:
logging.warning(arg+' is not valid LLVM bitcode')
elifarg_ending.endswith(STATICLIB_ENDINGS):
ifnotshared.Building.is_ar(arg):
ifshared.Building.is_bitcode(arg):
message=arg+': File has a suffix of a static library '+str(STATICLIB_ENDINGS) +', but instead is an LLVM bitcode file! When linking LLVM bitcode files, use one of the suffixes '+str(BITCODE_ENDINGS)
else:
message=arg+': Unknown format, not a static library!'
exit_with_error(message)
else:
ifhas_fixed_language_mode:
newargs[i] =''
input_files.append((i, arg))
has_source_inputs=True
else:
exit_with_error(arg+": Input file has an unknown suffix, don't know what to do with it!")
elifarg.startswith('-L'):
lib_dirs.append(arg[2:])
newargs[i] =''
elifarg.startswith('-l'):
libs.append((i, arg[2:]))
newargs[i] =''
elifarg.startswith('-Wl,'):
# Multiple comma separated link flags can be specified. Create fake
# fractional indices for these: -Wl,a,b,c,d at index 4 becomes:
ifnotoptions.ignore_dynamic_linking: logging.warning('ignoring dynamic library %s because not compiling to JS or HTML, remember to link it when compiling to JS or HTML at the end', os.path.basename(input_file))
returnFalse
else:
returnTrue
input_files= [(i, input_file) for (i, input_file) ininput_filesifcheck(input_file)]
iflen(input_files) ==0:
exit_with_error('no input files\nnote that input files without a known suffix are ignored, make sure your input files end with one of: '+str(SOURCE_ENDINGS+BITCODE_ENDINGS+DYNAMICLIB_ENDINGS+STATICLIB_ENDINGS+ASSEMBLY_ENDINGS+HEADER_ENDINGS))
logging.error('a problem occurred in evaluating content after a "-s", specifically %s . one possible cause of this is missing quotation marks (this depends on the shell you are running in; you may need quotation marks around the entire %s , or on an individual element)'% (change, change))
# -s ASSERTIONS=1 implies the heaviest stack overflow check mode. Set the implication here explicitly to avoid having to
# do preprocessor "#if defined(ASSERTIONS) || defined(STACK_OVERFLOW_CHECK)" in .js files, which is not supported.
ifshared.Settings.ASSERTIONS:
shared.Settings.STACK_OVERFLOW_CHECK=2
ifnotshared.Settings.STRICT:
# The preprocessor define EMSCRIPTEN is deprecated. Don't pass it to code in strict mode. Code should use the define __EMSCRIPTEN__ instead.
shared.COMPILER_OPTS+= ['-DEMSCRIPTEN']
# The system include path system/include/emscripten/ is deprecated, i.e. instead of #include <emscripten.h>, one should pass in #include <emscripten/emscripten.h>.
# This path is not available in Emscripten strict mode.
assertshared.Settings.ASM_JS>0, 'ASM_JS must be enabled in fastcomp'
assertshared.Settings.SAFE_HEAPin [0, 1], 'safe heap must be 0 or 1 in fastcomp'
assertshared.Settings.UNALIGNED_MEMORY==0, 'forced unaligned memory not supported in fastcomp'
assertshared.Settings.FORCE_ALIGNED_MEMORY==0, 'forced aligned memory is not supported in fastcomp'
assertshared.Settings.PGO==0, 'pgo not supported in fastcomp'
assertshared.Settings.QUANTUM_SIZE==4, 'altering the QUANTUM_SIZE is not supported'
exceptExceptionase:
exit_with_error('Compiler settings are incompatible with fastcomp. You can fall back to the older compiler core, although that is not recommended, see http://kripken.github.io/emscripten-site/docs/building_from_source/LLVM-Backend.html')
assertnotshared.Settings.PGO, 'cannot run PGO in ASM_JS mode'
logging.warning('disabling closure because debug info was requested')
options.use_closure_compiler=False
assertnot (shared.Settings.EMTERPRETIFY_FILEandshared.Settings.SINGLE_FILE), 'cannot have both EMTERPRETIFY_FILE and SINGLE_FILE enabled at the same time'
assertnot (shared.Settings.NO_DYNAMIC_EXECUTIONandoptions.use_closure_compiler), 'cannot have both NO_DYNAMIC_EXECUTION and closure compiler enabled at the same time'
shared.WarningManager.warn('ALMOST_ASM', 'not all asm.js optimizations are possible with --closure 2, disabling those - your code will be run more slowly')
shared.Settings.ASM_JS=2
ifshared.Settings.MAIN_MODULE:
assertnotshared.Settings.SIDE_MODULE
ifshared.Settings.MAIN_MODULE!=2:
shared.Settings.INCLUDE_FULL_LIBRARY=1
elifshared.Settings.SIDE_MODULE:
assertnotshared.Settings.MAIN_MODULE
options.memory_init_file=False# memory init file is not supported with asm.js side modules, must be executable synchronously (for dlopen)