Clean up temporary files generated by Erlang macros.

* lib/autoconf/erlang.m4 (AC_ERLANG_CHECK_LIB)
(AC_ERLANG_SUBST_ROOT_DIR, AC_ERLANG_SUBST_LIB_DIR)
(AC_ERLANG_SUBST_ERTS_VER): Delete conftest.out; renamed
erlang_cv_* cache variables into ac_cv_erlang_*.
* lib/autoconf/general.m4 (AC_RUN_IFELSE): Delete conftest.beam
files generated by Erlang compiler.
* tests/local.at (AT_CHECK_ENV): Ignore variables defined by
Erlang macros.
* tests/erlang.at (AT_SETUP_ERLANG): Delete; replace all uses by
AT_CHECK_MACRO.
* tests/Makefile.am (AUTOCONF_FILES): Revert previous addition of
generated Erlang tests; they are all hand-tested.

Signed-off-by: Eric Blake <ebb9@byu.net>
This commit is contained in:
Romain Lenglet 2009-07-23 20:37:58 -06:00 committed by Eric Blake
parent 0f4806215f
commit 8f3729e1a5
6 changed files with 121 additions and 174 deletions

View File

@ -1,10 +1,27 @@
2009-07-23 Romain Lenglet <romain.lenglet@laposte.net>
Clean up temporary files generated by Erlang macros.
* lib/autoconf/erlang.m4 (AC_ERLANG_CHECK_LIB)
(AC_ERLANG_SUBST_ROOT_DIR, AC_ERLANG_SUBST_LIB_DIR)
(AC_ERLANG_SUBST_ERTS_VER): Delete conftest.out; renamed
erlang_cv_* cache variables into ac_cv_erlang_*.
* lib/autoconf/general.m4 (AC_RUN_IFELSE): Delete conftest.beam
files generated by Erlang compiler.
* tests/local.at (AT_CHECK_ENV): Ignore variables defined by
Erlang macros.
* tests/erlang.at (AT_SETUP_ERLANG): Delete; replace all uses by
AT_CHECK_MACRO.
* tests/Makefile.am (AUTOCONF_FILES): Revert previous addition of
generated Erlang tests; they are all hand-tested.
Add autotests for Erlang macros.
* tests/erlang.at: Added tests for all macros in erlang.m4.
* tests/Makefile.am: Added erlang.at.
* tests/Makefile.am (TESTSUITE_HAND_AT, AUTOCONF_FILES): Added
erlang.at.
* tests/suite.at: Likewise.
* tests/compile.at: Added test for extension of Erlang files.
* tests/compile.at (AC_LANG, AC_LANG_PUSH & AC_LANG_POP): Added
test for extension of Erlang files.
(Multiple languages): Use correct m4 quoting.
* NEWS: Mention this.
2009-07-22 Eric Blake <ebb9@byu.net>

View File

@ -191,7 +191,7 @@ AC_DEFUN([AC_ERLANG_CHECK_LIB],
[AC_REQUIRE([AC_ERLANG_PATH_ERLC])[]dnl
AC_REQUIRE([AC_ERLANG_PATH_ERL])[]dnl
AC_CACHE_CHECK([for Erlang/OTP '$1' library subdirectory],
[erlang_cv_lib_dir_$1],
[ac_cv_erlang_lib_dir_$1],
[AC_LANG_PUSH(Erlang)[]dnl
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([], [dnl
@ -204,23 +204,25 @@ AC_CACHE_CHECK([for Erlang/OTP '$1' library subdirectory],
0
end,
halt(ReturnValue)])],
[erlang_cv_lib_dir_$1=`cat conftest.out`],
[ac_cv_erlang_lib_dir_$1=`cat conftest.out`
rm -f conftest.out],
[if test ! -f conftest.out; then
AC_MSG_FAILURE([test Erlang program execution failed])
else
erlang_cv_lib_dir_$1="not found"
ac_cv_erlang_lib_dir_$1="not found"
rm -f conftest.out
fi])
AC_LANG_POP(Erlang)[]dnl
])
AC_CACHE_CHECK([for Erlang/OTP '$1' library version],
[erlang_cv_lib_ver_$1],
[AS_IF([test "$erlang_cv_lib_dir_$1" = "not found"],
[erlang_cv_lib_ver_$1="not found"],
[erlang_cv_lib_ver_$1=`AS_ECHO(["$erlang_cv_lib_dir_$1"]) | sed -n -e 's,^.*-\([[^/-]]*\)$,\1,p'`])[]dnl
[ac_cv_erlang_lib_ver_$1],
[AS_IF([test "$ac_cv_erlang_lib_dir_$1" = "not found"],
[ac_cv_erlang_lib_ver_$1="not found"],
[ac_cv_erlang_lib_ver_$1=`AS_ECHO(["$ac_cv_erlang_lib_dir_$1"]) | sed -n -e 's,^.*-\([[^/-]]*\)$,\1,p'`])[]dnl
])
AC_SUBST([ERLANG_LIB_DIR_$1], [$erlang_cv_lib_dir_$1])
AC_SUBST([ERLANG_LIB_VER_$1], [$erlang_cv_lib_ver_$1])
AS_IF([test "$erlang_cv_lib_dir_$1" = "not found"], [$3], [$2])
AC_SUBST([ERLANG_LIB_DIR_$1], [$ac_cv_erlang_lib_dir_$1])
AC_SUBST([ERLANG_LIB_VER_$1], [$ac_cv_erlang_lib_ver_$1])
AS_IF([test "$ac_cv_erlang_lib_dir_$1" = "not found"], [$3], [$2])
])# AC_ERLANG_CHECK_LIB
@ -231,7 +233,7 @@ AC_DEFUN([AC_ERLANG_SUBST_ROOT_DIR],
[AC_REQUIRE([AC_ERLANG_NEED_ERLC])[]dnl
AC_REQUIRE([AC_ERLANG_NEED_ERL])[]dnl
AC_CACHE_CHECK([for Erlang/OTP root directory],
[erlang_cv_root_dir],
[ac_cv_erlang_root_dir],
[AC_LANG_PUSH(Erlang)[]dnl
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([], [dnl
@ -239,11 +241,13 @@ AC_CACHE_CHECK([for Erlang/OTP root directory],
file:write_file("conftest.out", RootDir),
ReturnValue = 0,
halt(ReturnValue)])],
[erlang_cv_root_dir=`cat conftest.out`],
[AC_MSG_FAILURE([test Erlang program execution failed])])
[ac_cv_erlang_root_dir=`cat conftest.out`
rm -f conftest.out],
[rm -f conftest.out
AC_MSG_FAILURE([test Erlang program execution failed])])
AC_LANG_POP(Erlang)[]dnl
])
AC_SUBST([ERLANG_ROOT_DIR], [$erlang_cv_root_dir])
AC_SUBST([ERLANG_ROOT_DIR], [$ac_cv_erlang_root_dir])
])# AC_ERLANG_SUBST_ROOT_DIR
@ -253,7 +257,7 @@ AC_DEFUN([AC_ERLANG_SUBST_LIB_DIR],
[AC_REQUIRE([AC_ERLANG_NEED_ERLC])[]dnl
AC_REQUIRE([AC_ERLANG_NEED_ERL])[]dnl
AC_CACHE_CHECK([for Erlang/OTP library base directory],
[erlang_cv_lib_dir],
[ac_cv_erlang_lib_dir],
[AC_LANG_PUSH(Erlang)[]dnl
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([], [dnl
@ -261,11 +265,13 @@ AC_CACHE_CHECK([for Erlang/OTP library base directory],
file:write_file("conftest.out", LibDir),
ReturnValue = 0,
halt(ReturnValue)])],
[erlang_cv_lib_dir=`cat conftest.out`],
[AC_MSG_FAILURE([test Erlang program execution failed])])
[ac_cv_erlang_lib_dir=`cat conftest.out`
rm -f conftest.out],
[rm -f conftest.out
AC_MSG_FAILURE([test Erlang program execution failed])])
AC_LANG_POP(Erlang)[]dnl
])
AC_SUBST([ERLANG_LIB_DIR], [$erlang_cv_lib_dir])
AC_SUBST([ERLANG_LIB_DIR], [$ac_cv_erlang_lib_dir])
])# AC_ERLANG_SUBST_LIB_DIR
@ -311,7 +317,7 @@ AC_DEFUN([AC_ERLANG_SUBST_ERTS_VER],
[AC_REQUIRE([AC_ERLANG_NEED_ERLC])[]dnl
AC_REQUIRE([AC_ERLANG_NEED_ERL])[]dnl
AC_CACHE_CHECK([for Erlang/OTP ERTS version],
[erlang_cv_erts_ver],
[ac_cv_erlang_erts_ver],
[AC_LANG_PUSH([Erlang])[]dnl
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([], [dnl
@ -319,9 +325,11 @@ AC_CACHE_CHECK([for Erlang/OTP ERTS version],
file:write_file("conftest.out", Version),
ReturnValue = 0,
halt(ReturnValue)])],
[erlang_cv_erts_ver=`cat conftest.out`],
[AC_MSG_FAILURE([test Erlang program execution failed])])
[ac_cv_erlang_erts_ver=`cat conftest.out`
rm -f conftest.out],
[rm -f conftest.out
AC_MSG_FAILURE([test Erlang program execution failed])])
AC_LANG_POP([Erlang])[]dnl
])
AC_SUBST([ERLANG_ERTS_VER], [$erlang_cv_erts_ver])
AC_SUBST([ERLANG_ERTS_VER], [$ac_cv_erlang_erts_ver])
])# AC_ERLANG_SUBST_ERTS_VER

View File

@ -2722,7 +2722,7 @@ AC_DEFUN([_AC_RUN_IFELSE],
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
[AS_IF([ac_fn_[]_AC_LANG_ABBREV[]_try_run "$LINENO"], [$2], [$3])
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest$ac_exeext[]m4_ifval([$1], [ conftest.$ac_ext])[]dnl
conftest.$ac_objext conftest.beam[]m4_ifval([$1], [ conftest.$ac_ext])[]dnl
])# _AC_RUN_IFELSE
# AC_RUN_IFELSE(PROGRAM,

View File

@ -168,7 +168,6 @@ AUTOCONF_FILES = $(autoconfdir)/general.m4 \
$(autoconfdir)/functions.m4 \
$(autoconfdir)/lang.m4 \
$(autoconfdir)/c.m4 \
$(autoconfdir)/erlang.m4 \
$(autoconfdir)/fortran.m4 \
$(autoconfdir)/headers.m4 \
$(autoconfdir)/libs.m4 \

View File

@ -25,190 +25,112 @@ AT_BANNER([Erlang low level compiling and utility macros.])
# primitive, so check those first.
# AT_SETUP_ERLANG(title)
# ----------------------
# Setup a test group for Erlang, named TITLE.
m4_define([AT_SETUP_ERLANG],
[AT_SETUP([$1])
AT_KEYWORDS([Erlang])
found_erl=no
found_erlc=no
_AS_PATH_WALK([], [
if AS_EXECUTABLE_P(["$as_dir/erl"]); then found_erl=yes; fi
if AS_EXECUTABLE_P(["$as_dir/erlc"]); then found_erlc=yes; fi
if test "${found_erl}${found_erlc}" = "yesyes"; then break; fi
])
AT_SKIP_IF([test "$found_erl$found_erlc" != "yesyes"])])
## ----------------- ##
## Erlang Compiler. ##
## ----------------- ##
AT_SETUP_ERLANG([Erlang])
AT_DATA([configure.ac],
[[AC_INIT
AC_ERLANG_NEED_ERL
AC_ERLANG_NEED_ERLC
AT_CHECK_MACRO([Erlang],
[[AC_ERLANG_PATH_ERL([not found])
AC_ERLANG_PATH_ERLC([not found])
if test "$ERL" = "not found" || test "$ERLC" = "not found"; then exit 77; fi
AC_LANG([Erlang])
## Can't compile, but can run an Erlang module:
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [halt(0)])],
[AC_MSG_RESULT([ok])
AC_MSG_ERROR([compiling Erlang program should fail])],
[AC_MSG_RESULT([failed])])
[AC_MSG_RESULT([ok])
AC_MSG_ERROR([compiling Erlang program should fail])],
[AC_MSG_RESULT([failed])])
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [halt(0)])],
[AC_MSG_RESULT([ok])],
[AC_MSG_RESULT([failed])
AC_MSG_ERROR([could not run test program])])
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([-q])
AT_CLEANUP
[AC_MSG_RESULT([ok])],
[AC_MSG_RESULT([failed])
AC_MSG_ERROR([could not run test program])])
]],
[AT_KEYWORDS([Erlang])])
## ----------------------- ##
## Erlang path detection. ##
## ----------------------- ##
## ---------------------- ##
## Erlang lib detection. ##
## ---------------------- ##
AT_SETUP_ERLANG([AC_ERLANG_CHECK_LIB])
AT_DATA([configure.ac],
[[AC_INIT
AC_ERLANG_NEED_ERL
AC_ERLANG_NEED_ERLC
AT_CHECK_MACRO([AC_ERLANG_CHECK_LIB],
[[AC_ERLANG_PATH_ERL([not found])
AC_ERLANG_PATH_ERLC([not found])
if test "$ERL" = "not found" || test "$ERLC" = "not found"; then exit 77; fi
AC_ERLANG_CHECK_LIB([stdlib],
[AC_MSG_RESULT([ok])],
[AC_MSG_RESULT([failed])])
AC_CONFIG_FILES([dir])
AC_OUTPUT
]])
AT_DATA([dir.in],
[[@ERLANG_LIB_DIR_stdlib@
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([-q])
dir=`cat dir`
rm -f dir
AT_CHECK([test "$dir" = "not found" || test -d "$dir"])
AT_CLEANUP
[AC_MSG_RESULT([ok])],
[AC_MSG_RESULT([failed])])
## Test that the lib path detection really detected a directory:
if test "$ERLANG_LIB_DIR_stdlib" != "not found" \
&& test ! -d "$ERLANG_LIB_DIR_stdlib"; then
AC_MSG_ERROR([incorrect ERLANG_LIB_DIR_stdlib variable])
fi
]],
[AT_KEYWORDS([Erlang])])
## --------------------------- ##
## Erlang root dir detection. ##
## --------------------------- ##
AT_SETUP_ERLANG([AC_ERLANG_SUBST_ROOT_DIR])
AT_DATA([configure.ac],
[[AC_INIT
AC_ERLANG_NEED_ERL
AC_ERLANG_NEED_ERLC
AT_CHECK_MACRO([AC_ERLANG_SUBST_ROOT_DIR],
[[AC_ERLANG_PATH_ERL([not found])
AC_ERLANG_PATH_ERLC([not found])
if test "$ERL" = "not found" || test "$ERLC" = "not found"; then exit 77; fi
AC_ERLANG_SUBST_ROOT_DIR
AC_CONFIG_FILES([dir])
AC_OUTPUT
]])
AT_DATA([dir.in],
[[@ERLANG_ROOT_DIR@
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([-q])
dir=`cat dir`
rm -f dir
AT_CHECK([test -d "$dir"])
AT_CLEANUP
## Test that the root path detection really detected a directory:
if test ! -d "$ERLANG_ROOT_DIR"; then
AC_MSG_ERROR([incorrect ERLANG_ROOT_DIR variable])
fi
]],
[AT_KEYWORDS([Erlang])])
## -------------------------- ##
## Erlang lib dir detection. ##
## -------------------------- ##
AT_SETUP_ERLANG([AC_ERLANG_SUBST_LIB_DIR])
AT_DATA([configure.ac],
[[AC_INIT
AC_ERLANG_NEED_ERL
AC_ERLANG_NEED_ERLC
AT_CHECK_MACRO([AC_ERLANG_SUBST_LIB_DIR],
[[AC_ERLANG_PATH_ERL([not found])
AC_ERLANG_PATH_ERLC([not found])
if test "$ERL" = "not found" || test "$ERLC" = "not found"; then exit 77; fi
AC_ERLANG_SUBST_LIB_DIR
AC_CONFIG_FILES([dir])
AC_OUTPUT
]])
AT_DATA([dir.in],
[[@ERLANG_LIB_DIR@
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([-q])
dir=`cat dir`
rm -f dir
AT_CHECK([test -d "$dir"])
AT_CLEANUP
## ------------------------------- ##
## Erlang installation detection. ##
## ------------------------------- ##
AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_DIR], [],
## Test that the lib path detection really detected a directory:
if test ! -d "$ERLANG_LIB_DIR"; then
AC_MSG_ERROR([incorrect ERLANG_LIB_DIR variable])
fi
]],
[AT_KEYWORDS([Erlang])])
## ------------------------------- ##
## Erlang installation detection. ##
## ------------------------------- ##
## ----------------------------------- ##
## Erlang install base dir detection. ##
## ----------------------------------- ##
AT_SETUP([AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR])
AT_KEYWORDS([Erlang])
AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_DIR],
[AT_KEYWORDS([Erlang])])
AT_DATA([configure.ac],
[[AC_INIT
AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR([test_blah], [1.24-b])
AC_CONFIG_FILES([dir])
AC_OUTPUT
]])
AT_DATA([dir.in],
[[@ERLANG_INSTALL_LIB_DIR_test_blah@
]])
## ---------------------------------- ##
## Erlang install lib dir detection. ##
## ---------------------------------- ##
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([-q])
dir=`cat dir`
subdir=`AS_BASENAME([$dir])`
rm -f dir
AT_CHECK([test "$subdir" = "test_blah-1.24-b"])
AT_CLEANUP
AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR],
[[AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR([test_blah], [1.24-b])
## Test that the generated directory name is well-formed:
if test `echo "$ERLANG_INSTALL_LIB_DIR_test_blah" | sed -e 's/^.*\///'` != "test_blah-1.24-b"; then
AC_MSG_ERROR([incorrect ERLANG_INSTALL_LIB_DIR_test_blah variable])
fi
]],
[AT_KEYWORDS([Erlang])])
## -------------------------- ##
## Erlang version detection. ##
## -------------------------- ##
AT_SETUP_ERLANG([AC_ERLANG_SUBST_ERTS_VER])
AT_DATA([configure.ac],
[[AC_INIT
AC_ERLANG_NEED_ERL
AC_ERLANG_NEED_ERLC
AT_CHECK_MACRO([AC_ERLANG_SUBST_ERTS_VER],
[[AC_ERLANG_PATH_ERL([not found])
AC_ERLANG_PATH_ERLC([not found])
if test "$ERL" = "not found" || test "$ERLC" = "not found"; then exit 77; fi
AC_ERLANG_SUBST_ERTS_VER
]])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([-q])
AT_CLEANUP
]],
[AT_KEYWORDS([Erlang])])

View File

@ -296,7 +296,8 @@ if test -f state-env.before && test -f state-env.after; then
[(exec_)?prefix|DEFS|CONFIG_STATUS],
[CC|CFLAGS|CPP|GCC|CXX|CXXFLAGS|CXXCPP|GXX|F77|FFLAGS|FLIBS|G77],
[ERL|ERLC|ERLCFLAGS|ERLANG_PATH_ERL|ERLANG_ROOT_DIR|ERLANG_LIB_DIR],
[ERLANG_INSTALL_LIB_DIR|OBJC|OBJCPP|OBJCFLAGS],
[ERLANG_LIB_DIR_.*|ERLANG_LIB_VER_.*|ERLANG_INSTALL_LIB_DIR],
[ERLANG_INSTALL_LIB_DIR_.*|ERLANG_ERTS_VER|OBJC|OBJCPP|OBJCFLAGS],
[OPENMP_CFLAGS],
[LIBS|LIB@&t@OBJS|LTLIBOBJS|LDFLAGS],
[INSTALL(_(DATA|PROGRAM|SCRIPT))?],