]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Clean up temporary files generated by Erlang macros.
authorRomain Lenglet <romain.lenglet@laposte.net>
Fri, 24 Jul 2009 02:37:58 +0000 (20:37 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 24 Jul 2009 02:37:58 +0000 (20:37 -0600)
* 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>
ChangeLog
lib/autoconf/erlang.m4
lib/autoconf/general.m4
tests/Makefile.am
tests/erlang.at
tests/local.at

index dac5b0c019b33c1eff4fd20d18b2985d67cf9828..e309b19f04871ed0a43c243401101278d49535ae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
index 72268be09f385ce87a46b42d1aa9f658b79c0c44..0c4504deb41653bbfb5d5bf5efa502677f0db7ee 100644 (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
index 9eaae80bc18a50b4356faf00fc04db1fd2f3f0ba..e3b69d024af7a302265dfc9b221dafc67aa14e89 100644 (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,
index 085c9d191cde28811b71e3f1d62a136893415bff..4c29a6ea2a277519daa95548ebf89a72fb19258c 100644 (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 \
index f3ced2411416fe3a0cf4a98bccbc58c47d40a76d..e8a5de748d5461c513a7ff9a2c60a404598b521b 100644 (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.  ##
-## ----------------------- ##
 
-AT_SETUP_ERLANG([AC_ERLANG_CHECK_LIB])
+## ---------------------- ##
+## Erlang lib detection.  ##
+## ---------------------- ##
 
-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.  ##
-## ------------------------------- ##
-
-AT_SETUP([AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR])
-AT_KEYWORDS([Erlang])
+## ----------------------------------- ##
+## Erlang install base dir detection.  ##
+## ----------------------------------- ##
 
-AT_DATA([configure.ac],
-[[AC_INIT
-AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR([test_blah], [1.24-b])
-AC_CONFIG_FILES([dir])
-AC_OUTPUT
-]])
+AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_DIR],
+              [AT_KEYWORDS([Erlang])])
 
-AT_DATA([dir.in],
-[[@ERLANG_INSTALL_LIB_DIR_test_blah@
-]])
 
-AT_CHECK_AUTOCONF
-AT_CHECK_CONFIGURE([-q])
+## ---------------------------------- ##
+## Erlang install lib dir detection.  ##
+## ---------------------------------- ##
 
-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])])
index 8a81835b4b6e2e62ecbc35271d2927f46c3ac3bd..9280e2370c1961e4d44724914172d18553e2e44e 100644 (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))?],