Erlang is similar to Java in that it doesn’t compile to standalone
machine code; the output of ‘erlc’ is byte-code files that are then
interpreted by ‘erl’. We handle this poorly in a whole bunch of ways,
particularly when cross-compiling. This patch fixes up the more
serious problems:
- AC_COMPILE_IFELSE now actually works when AC_LANG([Erlang]) is in
effect.
- ‘conftest.beam’ is now deleted in several more places where it
could be created.
- The various AC_ERLANG_* macros that interrogate the runtime
environment do so by invoking ‘$ERL’ directly, rather than using
AC_RUN_IFELSE, and thus do not crash the configure script when
we think we’re cross-compiling. (It is not clear to me whether
they get the correct answer when cross-compiling, but this should
still be strictly an improvement.)
- The Erlang-related tests have been streamlined.
Further improvements are definitely possible, but we’d have to teach
the infrastructure to make $ac_objext language-specific first, which
seems like too big of a change for 2.70.
(This patch is all fallout from a logically unrelated testsuite change
which is coming up next. Gotta love the fundamental interconnectedness
of things.)
* lib/autoconf/general.m4 (_AC_COMPILE_IFELSE_BODY)
(_AC_LINK_IFELSE_BODY): Delete conftest.beam as well as conftest.$ac_objext.
* lib/autoconf/erlang.m4 (AC_ERLANG_PATH_ERLC, AC_ERLANG_PATH_ERL):
Don’t repeat work done by AC_PATH_TOOL.
(Erlang $ac_compile): Fake an .o file so AC_TRY_COMPILE will be happy.
(AC_LANG_COMPILER(Erlang)): AC_REQUIRE AC_ERLANG_NEED_ERLC, not
AC_ERLANG_PATH_ERLC. Also AC_REQUIRE AC_ERLANG_NEED_ERL so
AC_RUN_IFELSE works reliably.
(AC_ERLANG_CHECK_LIB, AC_ERLANG_SUBST_ROOT_DIR)
(AC_ERLANG_SUBST_LIB_DIR, AC_ERLANG_SUBST_ERTS_VER):
Use $ERL -eval, not AC_RUN_IFELSE.
No need to AC_REQUIRE AC_ERLANG_NEED_ERLC.
* tests/erlang.at: Don’t test anything here that’s tested adequately
by acerlang.at; document which macros those are expected to be.
Remove unnecessary AC_ERLANG_PATH_ERL/ERLC invocations throughout.
(AT_CHECK_MACRO([Erlang])): Rename test to ‘Erlang basic compilation’;
expect both AC_COMPILE_IFELSE and AC_RUN_IFELSE to work;
handle cross compilation mode properly.
* tests/mktests.sh: Exclude from acerlang.at all macros completely
covered by erlang.at.