Currently, emcc compiles conftest.c to native code, so it can be executed. 
In addition, emconfigure sets EMMAKEN_JUST_CONFIGURE=1 to compile anything 
to native code. This causes ./configure to detect some things about the 
build system (where emcc is running) and assume they are true for the host 
system (JavaScript).

If compiling on a 64 bit system, AC_CHECK_SIZEOF() will return wrong sizes. 
Autoconf has an alternate method for finding sizes when cross-compiling, 
without running compiled code.

Compiling host system binaries also allows host system libraries to be 
used, giving wrong answers to AC_CHECK_LIB(). In this case, compiling to 
JavaScript would make things even worse. Both missing libraries and 
undefined functions are only warnings, so the compile would always succeed 
and AC_CHECK_LIB() will act as if it found the function in the library. I 
wonder why at least missing libraries aren't errors?

In general, Autoconf is designed to allow cross-compiling. Tests can work 
even if built binaries cannot be executed. Inability to execute binaries is 
only an error if ./configure concludes that it is not cross compiling. For 
cross-compiling, ./configure needs a --host argument specifying the system 
to build for. Normally, the host argument is used as a prefix for tools, so 
there is no need to specify tools individually like in emconfigure.

I'm not aware of any GNU host triplet for Emscripten, and the programs 
don't have any specific prefix. It's still possible to start a 
cross-compile configure by setting host to none and specifying tools 
manually, like: "CC=emcc CXX=em++ ./configure --host=none".

The only obstacle is _AC_COMPILER_EXEEXT(), which doesn't check for 
a.out.js and concludes that "C compiler cannot create executables". Adding 
a.out.js to ac_files gets around this obstacle. I don't see any way to do 
that besides editing ./configure though. A better solution may be to output 
to conftest.js. That would be found by _AC_COMPILER_EXEEXT(), and it would 
cause EXEEXT to be set to .js, which seems appropriate.

Regards,

Boris

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to