]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
AC_REQUIRE and AC_DEFUN_ONCE don't work properly together. This
authorAkim Demaille <akim@epita.fr>
Fri, 3 Nov 2000 10:39:27 +0000 (10:39 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 3 Nov 2000 10:39:27 +0000 (10:39 +0000)
caused strange messages about AC_ARG_PROGRAM.
Reported by Jim Meyering.
* acgeneral.m4 (AC_DEFUN_ONCE): Fix the indirection to
m4_defun_once.
* m4sugar.m4 (m4_defun_once): Also define
`m4_location(MACRO-NAME)'.  s/ac_warn/m4_warn/.
Use `m4_defn' to read `m4_location'.
* tests/base.at (AC_REQUIRE & AC_DEFUN_ONCE): Two new tests.

ChangeLog
acgeneral.m4
configure
lib/autoconf/general.m4
lib/m4sugar/m4sugar.m4
m4sugar.m4
tests/base.at

index 9276466f10bb0d4dfb42cd730dfa86af4b46ba0d..906b74201c9bec6db19d845cbebb1f313c49be6d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2000-11-03  Akim Demaille  <akim@epita.fr>
+
+       AC_REQUIRE and AC_DEFUN_ONCE don't work properly together. This
+       caused strange messages about AC_ARG_PROGRAM.
+       Reported by Jim Meyering.
+
+       * acgeneral.m4 (AC_DEFUN_ONCE): Fix the indirection to
+       m4_defun_once.
+       * m4sugar.m4 (m4_defun_once): Also define
+       `m4_location(MACRO-NAME)'.  s/ac_warn/m4_warn/.
+       Use `m4_defn' to read `m4_location'.
+       * tests/base.at (AC_REQUIRE & AC_DEFUN_ONCE): Two new tests.
+
 2000-11-03  Akim Demaille  <akim@epita.fr>
 
        Set up config.log earlier so that AC_MSG_ERROR and AC_MSG_WARN can
index c0aeafca9affa8f982341d16f5386d3b7428399a..298ff290e54805042b415bdc3b46c9c9664dfede 100644 (file)
@@ -190,8 +190,7 @@ define([AC_DEFUN],
 # As AC_DEFUN, but issues the EXPANSION only once, and warns if used
 # several times.
 define([AC_DEFUN_ONCE],
-[define([$1],
-[m4_defun_once([$1], [$2[]AC_PROVIDE([$1])])])])
+[m4_defun_once([$1], [$2[]AC_PROVIDE([$1])])])
 
 
 # AC_OBSOLETE(THIS-MACRO-NAME, [SUGGESTION])
index de92c8a45645f6acbf8ccfa69dc68f96776016e5..9b7e0cd80ef311be623bc6f5d69b9bb8a977f39e 100755 (executable)
--- a/configure
+++ b/configure
@@ -630,6 +630,11 @@ Fine tuning of the installation directories:
 EOF
 
   cat <<\EOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
 EOF
 fi
 
@@ -672,7 +677,7 @@ if test "$ac_init_help" = "recursive"; then
       echo
       $ac_configure --help
     else
-      { echo "configure:675: WARNING: no configuration information is in $ac_subdir" >&5
+      { echo "configure:680: WARNING: no configuration information is in $ac_subdir" >&5
 echo "configure: WARNING: no configuration information is in $ac_subdir" >&2; }
     fi
     cd $ac_popdir
@@ -775,30 +780,30 @@ for ac_var in `(set) 2>&1 |
   eval ac_new_val="\$ac_env_${ac_var}_value"
   case $ac_old_set,$ac_new_set in
     set,)
-      { echo "configure:778: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+      { echo "configure:783: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
 echo "configure: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2; }
       ac_suggest_removing_cache=: ;;
     ,set)
-      { echo "configure:782: WARNING: \`$ac_var' was not set in the previous run" >&5
+      { echo "configure:787: WARNING: \`$ac_var' was not set in the previous run" >&5
 echo "configure: WARNING: \`$ac_var' was not set in the previous run" >&2; }
       ac_suggest_removing_cache=: ;;
     ,);;
     *)
       if test "x$ac_old_val" != "x$ac_new_val"; then
-        { echo "configure:788: WARNING: \`$ac_var' has changed since the previous run:" >&5
+        { echo "configure:793: WARNING: \`$ac_var' has changed since the previous run:" >&5
 echo "configure: WARNING: \`$ac_var' has changed since the previous run:" >&2; }
-        { echo "configure:790: WARNING:   former value:  $ac_old_val" >&5
+        { echo "configure:795: WARNING:   former value:  $ac_old_val" >&5
 echo "configure: WARNING:   former value:  $ac_old_val" >&2; }
-        { echo "configure:792: WARNING:   current value: $ac_new_val" >&5
+        { echo "configure:797: WARNING:   current value: $ac_new_val" >&5
 echo "configure: WARNING:   current value: $ac_new_val" >&2; }
         ac_suggest_removing_cache=:
       fi;;
   esac
 done
 if $ac_suggest_removing_cache; then
-  { echo "configure:799: WARNING: changes in the environment can compromise the build" >&5
+  { echo "configure:804: WARNING: changes in the environment can compromise the build" >&5
 echo "configure: WARNING: changes in the environment can compromise the build" >&2; }
-  { echo "configure:801: WARNING: consider removing $cache_file and starting over" >&5
+  { echo "configure:806: WARNING: consider removing $cache_file and starting over" >&5
 echo "configure: WARNING: consider removing $cache_file and starting over" >&2; }
 fi
 
@@ -832,7 +837,7 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { echo "configure:835: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+  { echo "configure:840: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
   echo "configure: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2
   { false; exit; }; }
 fi
@@ -852,7 +857,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
-echo "configure:855: checking for a BSD compatible install" >&5
+echo "configure:860: checking for a BSD compatible install" >&5
 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6
 if test -z "$INSTALL"; then
 if test "${ac_cv_path_install+set}" = set; then
@@ -901,7 +906,7 @@ fi
     INSTALL=$ac_install_sh
   fi
 fi
-echo "configure:904: result: $INSTALL" >&5
+echo "configure:909: result: $INSTALL" >&5
 echo "${ECHO_T}$INSTALL" >&6
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -912,7 +917,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-echo "configure:915: checking whether build environment is sane" >&5
+echo "configure:920: checking whether build environment is sane" >&5
 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
 # Just in case
 sleep 1
@@ -935,7 +940,7 @@ if (
       # if, for instance, CONFIG_SHELL is bash and it inherits a
       # broken ls alias from the environment.  This has actually
       # happened.  Such a system could not be considered "sane".
-      { echo "configure:938: error: ls -t appears to fail.  Make sure there is not a broken
+      { echo "configure:943: error: ls -t appears to fail.  Make sure there is not a broken
 alias in your environment" >&5
   echo "configure: error: ls -t appears to fail.  Make sure there is not a broken
 alias in your environment" >&2
@@ -948,17 +953,35 @@ then
    # Ok.
    :
 else
-   { echo "configure:951: error: newly created file is older than distributed files!
+   { echo "configure:956: error: newly created file is older than distributed files!
 Check your system clock" >&5
   echo "configure: error: newly created file is older than distributed files!
 Check your system clock" >&2
   { false; exit; }; }
 fi
 rm -f conftest*
-echo "configure:958: result: yes" >&5
+echo "configure:963: result: yes" >&5
 echo "${ECHO_T}yes" >&6
+if test "$program_transform_name" = s,x,x,; then
+  program_transform_name=
+else
+  # Double any \ or $.  echo might interpret backslashes.
+  cat <<\EOF >conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF
+  program_transform_name=`echo $program_transform_name | sed -f conftestsed`
+  rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,${program_prefix},;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$\$,${program_suffix},;$program_transform_name"
+
+# sed with no file args requires a program.
+test -z "$program_transform_name" && program_transform_name="s,x,x,"
 
-echo "configure:961: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:984: checking whether ${MAKE-make} sets \${MAKE}" >&5
 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
 if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
@@ -978,11 +1001,11 @@ fi
 rm -f conftestmake
 fi
 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-  echo "configure:981: result: yes" >&5
+  echo "configure:1004: result: yes" >&5
 echo "${ECHO_T}yes" >&6
   SET_MAKE=
 else
-  echo "configure:985: result: no" >&5
+  echo "configure:1008: result: no" >&5
 echo "${ECHO_T}no" >&6
   SET_MAKE="MAKE=${MAKE-make}"
 fi
@@ -992,7 +1015,7 @@ PACKAGE=autoconf
 VERSION=2.49b
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
-  { echo "configure:995: error: source directory already configured; run \"make distclean\" there first" >&5
+  { echo "configure:1018: error: source directory already configured; run \"make distclean\" there first" >&5
   echo "configure: error: source directory already configured; run \"make distclean\" there first" >&2
   { false; exit; }; }
 fi
@@ -1006,78 +1029,78 @@ cat >>confdefs.h <<EOF
 EOF
 
 missing_dir=`cd $ac_aux_dir && pwd`
-echo "configure:1009: checking for working aclocal" >&5
+echo "configure:1032: checking for working aclocal" >&5
 echo $ECHO_N "checking for working aclocal... $ECHO_C" >&6
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
 if (aclocal --version) < /dev/null > /dev/null 2>&1; then
    ACLOCAL=aclocal
-   echo "configure:1016: result: found" >&5
+   echo "configure:1039: result: found" >&5
 echo "${ECHO_T}found" >&6
 else
    ACLOCAL="$SHELL $missing_dir/missing aclocal"
-   echo "configure:1020: result: missing" >&5
+   echo "configure:1043: result: missing" >&5
 echo "${ECHO_T}missing" >&6
 fi
 
-echo "configure:1024: checking for working autoconf" >&5
+echo "configure:1047: checking for working autoconf" >&5
 echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
 if (autoconf --version) < /dev/null > /dev/null 2>&1; then
    AUTOCONF=autoconf
-   echo "configure:1031: result: found" >&5
+   echo "configure:1054: result: found" >&5
 echo "${ECHO_T}found" >&6
 else
    AUTOCONF="$SHELL $missing_dir/missing autoconf"
-   echo "configure:1035: result: missing" >&5
+   echo "configure:1058: result: missing" >&5
 echo "${ECHO_T}missing" >&6
 fi
 
-echo "configure:1039: checking for working automake" >&5
+echo "configure:1062: checking for working automake" >&5
 echo $ECHO_N "checking for working automake... $ECHO_C" >&6
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
 if (automake --version) < /dev/null > /dev/null 2>&1; then
    AUTOMAKE=automake
-   echo "configure:1046: result: found" >&5
+   echo "configure:1069: result: found" >&5
 echo "${ECHO_T}found" >&6
 else
    AUTOMAKE="$SHELL $missing_dir/missing automake"
-   echo "configure:1050: result: missing" >&5
+   echo "configure:1073: result: missing" >&5
 echo "${ECHO_T}missing" >&6
 fi
 
-echo "configure:1054: checking for working autoheader" >&5
+echo "configure:1077: checking for working autoheader" >&5
 echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
 if (autoheader --version) < /dev/null > /dev/null 2>&1; then
    AUTOHEADER=autoheader
-   echo "configure:1061: result: found" >&5
+   echo "configure:1084: result: found" >&5
 echo "${ECHO_T}found" >&6
 else
    AUTOHEADER="$SHELL $missing_dir/missing autoheader"
-   echo "configure:1065: result: missing" >&5
+   echo "configure:1088: result: missing" >&5
 echo "${ECHO_T}missing" >&6
 fi
 
-echo "configure:1069: checking for working makeinfo" >&5
+echo "configure:1092: checking for working makeinfo" >&5
 echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
 if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
    MAKEINFO=makeinfo
-   echo "configure:1076: result: found" >&5
+   echo "configure:1099: result: found" >&5
 echo "${ECHO_T}found" >&6
 else
    MAKEINFO="$SHELL $missing_dir/missing makeinfo"
-   echo "configure:1080: result: missing" >&5
+   echo "configure:1103: result: missing" >&5
 echo "${ECHO_T}missing" >&6
 fi
 
@@ -1092,7 +1115,7 @@ for ac_prog in gm4 gnum4 m4
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "configure:1095: checking for $ac_word" >&5
+echo "configure:1118: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_M4+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1119,10 +1142,10 @@ fi
 M4=$ac_cv_path_M4
 
 if test -n "$M4"; then
-  echo "configure:1122: result: $M4" >&5
+  echo "configure:1145: result: $M4" >&5
 echo "${ECHO_T}$M4" >&6
 else
-  echo "configure:1125: result: no" >&5
+  echo "configure:1148: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1130,7 +1153,7 @@ fi
 done
 test -n "$M4" || M4="m4"
 
-echo "configure:1133: checking whether m4 supports frozen files" >&5
+echo "configure:1156: checking whether m4 supports frozen files" >&5
 echo $ECHO_N "checking whether m4 supports frozen files... $ECHO_C" >&6
 if test "${ac_cv_prog_gnu_m4+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1142,10 +1165,10 @@ if test x"$M4" != x; then
   esac
 fi
 fi
-echo "configure:1145: result: $ac_cv_prog_gnu_m4" >&5
+echo "configure:1168: result: $ac_cv_prog_gnu_m4" >&5
 echo "${ECHO_T}$ac_cv_prog_gnu_m4" >&6
 if test x"$ac_cv_prog_gnu_m4" != xyes; then
-  { echo "configure:1148: error: GNU m4 1.4 is required" >&5
+  { echo "configure:1171: error: GNU m4 1.4 is required" >&5
   echo "configure: error: GNU m4 1.4 is required" >&2
   { false; exit; }; }
 fi
@@ -1157,7 +1180,7 @@ for ac_prog in mawk gawk nawk awk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "configure:1160: checking for $ac_word" >&5
+echo "configure:1183: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_prog_AWK+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1179,10 +1202,10 @@ fi
 fi
 AWK=$ac_cv_prog_AWK
 if test -n "$AWK"; then
-  echo "configure:1182: result: $AWK" >&5
+  echo "configure:1205: result: $AWK" >&5
 echo "${ECHO_T}$AWK" >&6
 else
-  echo "configure:1185: result: no" >&5
+  echo "configure:1208: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
@@ -1190,25 +1213,25 @@ fi
 done
 
 # Generating man pages.
-echo "configure:1193: checking for working help2man" >&5
+echo "configure:1216: checking for working help2man" >&5
 echo $ECHO_N "checking for working help2man... $ECHO_C" >&6
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
 if (help2man --version) < /dev/null > /dev/null 2>&1; then
    HELP2MAN=help2man
-   echo "configure:1200: result: found" >&5
+   echo "configure:1223: result: found" >&5
 echo "${ECHO_T}found" >&6
 else
    HELP2MAN="$SHELL $missing_dir/missing help2man"
-   echo "configure:1204: result: missing" >&5
+   echo "configure:1227: result: missing" >&5
 echo "${ECHO_T}missing" >&6
 fi
 
 # We use a path for perl so the #! line in autoscan will work.
 # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
-echo "configure:1211: checking for $ac_word" >&5
+echo "configure:1234: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
 if test "${ac_cv_path_PERL+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -1236,17 +1259,17 @@ fi
 PERL=$ac_cv_path_PERL
 
 if test -n "$PERL"; then
-  echo "configure:1239: result: $PERL" >&5
+  echo "configure:1262: result: $PERL" >&5
 echo "${ECHO_T}$PERL" >&6
 else
-  echo "configure:1242: result: no" >&5
+  echo "configure:1265: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
 if test "$PERL" != no; then
   PERLSCRIPTS=autoscan
 else
-  { echo "configure:1249: WARNING: autoscan will not be built since perl is not found" >&5
+  { echo "configure:1272: WARNING: autoscan will not be built since perl is not found" >&5
 echo "configure: WARNING: autoscan will not be built since perl is not found" >&2; }
 fi
 
@@ -1262,7 +1285,7 @@ fi
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
-echo "configure:1265: checking for a BSD compatible install" >&5
+echo "configure:1288: checking for a BSD compatible install" >&5
 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6
 if test -z "$INSTALL"; then
 if test "${ac_cv_path_install+set}" = set; then
@@ -1311,7 +1334,7 @@ fi
     INSTALL=$ac_install_sh
   fi
 fi
-echo "configure:1314: result: $INSTALL" >&5
+echo "configure:1337: result: $INSTALL" >&5
 echo "${ECHO_T}$INSTALL" >&6
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -1819,7 +1842,7 @@ done; }
       -) echo $tmp/stdin ;;
       [\\/$]* | ?:[\\/]*)
          # Absolute
-         test -f "$f" || { echo "configure:1822: error: cannot find input file \\\`$f'" >&5
+         test -f "$f" || { echo "configure:1845: error: cannot find input file \\\`$f'" >&5
   echo "configure: error: cannot find input file \\\`$f'" >&2
   { false; exit; }; }
          echo $f;;
@@ -1832,7 +1855,7 @@ done; }
            echo $ac_given_srcdir/$f
          else
            # /dev/null tree
-           { echo "configure:1835: error: cannot find input file \\\`$f'" >&5
+           { echo "configure:1858: error: cannot find input file \\\`$f'" >&5
   echo "configure: error: cannot find input file \\\`$f'" >&2
   { false; exit; }; }
          fi;;
index c0aeafca9affa8f982341d16f5386d3b7428399a..298ff290e54805042b415bdc3b46c9c9664dfede 100644 (file)
@@ -190,8 +190,7 @@ define([AC_DEFUN],
 # As AC_DEFUN, but issues the EXPANSION only once, and warns if used
 # several times.
 define([AC_DEFUN_ONCE],
-[define([$1],
-[m4_defun_once([$1], [$2[]AC_PROVIDE([$1])])])])
+[m4_defun_once([$1], [$2[]AC_PROVIDE([$1])])])
 
 
 # AC_OBSOLETE(THIS-MACRO-NAME, [SUGGESTION])
index 03aab40b0292978459a3431e717e16f06f727feb..b0a2c587668cb15395e0954d1c7549fb0ff780be 100644 (file)
@@ -1025,7 +1025,7 @@ m4_define([_m4_expansion_stack_dump],
        [m4_errprint(m4_defn([_m4_expansion_stack]))dnl
 m4_popdef([_m4_expansion_stack])dnl
 _m4_expansion_stack_dump()],
-       [m4_errprint(m4_location[: the top level])])])
+       [m4_errprint(m4_defn([m4_location])[: the top level])])])
 
 
 # _m4_defun_pro(MACRO-NAME)
@@ -1033,7 +1033,7 @@ _m4_expansion_stack_dump()],
 # The prologue for Autoconf macros.
 m4_define([_m4_defun_pro],
 [m4_pushdef([_m4_expansion_stack],
-         m4_defn([m4_location($1)])[: $1 is expanded from...])dnl
+            m4_defn([m4_location($1)])[: $1 is expanded from...])dnl
 m4_pushdef([_m4_expanding($1)])dnl
 ifdef([_m4_divert_dump],
       [m4_divert_push(m4_defn([_m4_divert_diversion]))],
@@ -1068,7 +1068,7 @@ m4_provide([$1])dnl
 # macros that are not involved in ordering constraints, to save m4
 # processing.
 m4_define([m4_defun],
-[m4_define([m4_location($1)], m4_location)dnl
+[m4_define([m4_location($1)], m4_defn([m4_location]))dnl
 m4_define([$1],
           [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])
 
@@ -1078,10 +1078,11 @@ m4_define([$1],
 # As m4_defun, but issues the EXPANSION only once, and warns if used
 # several times.
 m4_define([m4_defun_once],
-[m4_define([$1],
-[m4_provide_ifelse([$1],
-                   [ac_warn([syntax], [$1 invoked multiple times])],
-                   [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])])
+[m4_define([m4_location($1)], m4_defn([m4_location]))dnl
+m4_define([$1],
+          [m4_provide_ifelse([$1],
+                             [m4_warn([syntax], [$1 invoked multiple times])],
+                             [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])])
 
 
 ## ----------------------------- ##
@@ -1127,7 +1128,7 @@ m4_define([m4_before],
 #   it passes to `AC_LANG_COMPILER(C)'.
 m4_define([_m4_require],
 [m4_pushdef([_m4_expansion_stack],
-            m4_location[: $1 is required by...])dnl
+            m4_defn([m4_location])[: $1 is required by...])dnl
 ifdef([_m4_expanding($1)],
       [m4_fatal([m4_require: circular dependency of $1])])dnl
 ifndef([_m4_divert_dump],
index 03aab40b0292978459a3431e717e16f06f727feb..b0a2c587668cb15395e0954d1c7549fb0ff780be 100644 (file)
@@ -1025,7 +1025,7 @@ m4_define([_m4_expansion_stack_dump],
        [m4_errprint(m4_defn([_m4_expansion_stack]))dnl
 m4_popdef([_m4_expansion_stack])dnl
 _m4_expansion_stack_dump()],
-       [m4_errprint(m4_location[: the top level])])])
+       [m4_errprint(m4_defn([m4_location])[: the top level])])])
 
 
 # _m4_defun_pro(MACRO-NAME)
@@ -1033,7 +1033,7 @@ _m4_expansion_stack_dump()],
 # The prologue for Autoconf macros.
 m4_define([_m4_defun_pro],
 [m4_pushdef([_m4_expansion_stack],
-         m4_defn([m4_location($1)])[: $1 is expanded from...])dnl
+            m4_defn([m4_location($1)])[: $1 is expanded from...])dnl
 m4_pushdef([_m4_expanding($1)])dnl
 ifdef([_m4_divert_dump],
       [m4_divert_push(m4_defn([_m4_divert_diversion]))],
@@ -1068,7 +1068,7 @@ m4_provide([$1])dnl
 # macros that are not involved in ordering constraints, to save m4
 # processing.
 m4_define([m4_defun],
-[m4_define([m4_location($1)], m4_location)dnl
+[m4_define([m4_location($1)], m4_defn([m4_location]))dnl
 m4_define([$1],
           [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])
 
@@ -1078,10 +1078,11 @@ m4_define([$1],
 # As m4_defun, but issues the EXPANSION only once, and warns if used
 # several times.
 m4_define([m4_defun_once],
-[m4_define([$1],
-[m4_provide_ifelse([$1],
-                   [ac_warn([syntax], [$1 invoked multiple times])],
-                   [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])])
+[m4_define([m4_location($1)], m4_defn([m4_location]))dnl
+m4_define([$1],
+          [m4_provide_ifelse([$1],
+                             [m4_warn([syntax], [$1 invoked multiple times])],
+                             [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])])
 
 
 ## ----------------------------- ##
@@ -1127,7 +1128,7 @@ m4_define([m4_before],
 #   it passes to `AC_LANG_COMPILER(C)'.
 m4_define([_m4_require],
 [m4_pushdef([_m4_expansion_stack],
-            m4_location[: $1 is required by...])dnl
+            m4_defn([m4_location])[: $1 is required by...])dnl
 ifdef([_m4_expanding($1)],
       [m4_fatal([m4_require: circular dependency of $1])])dnl
 ifndef([_m4_divert_dump],
index 8de52953acac3bca7b185e5b3e0fd3e56aff958e..b0211558e19a6e104a1afbe69b7dc338211e5c9b 100644 (file)
@@ -13,7 +13,7 @@ EOF
 
 # Check that dependencies are always properly honored.
 
-AT_SETUP(AC_REQUIRE)
+AT_SETUP(AC_REQUIRE: topological sort)
 
 AT_DATA(configure.in,
 [[define([REQUIRE_AND_CHECK],
@@ -43,7 +43,92 @@ test -z "$test1" &&
 AS_EXIT(0)
 ]])
 
-AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
+AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
 AT_CHECK([./configure], 0)
 
 AT_CLEANUP(configure)
+
+
+
+## ----------------------------------------------- ##
+## AC_REQUIRE and AC_DEFUN_ONCE: Require, expand.  ##
+## ----------------------------------------------- ##
+
+AT_SETUP(AC_REQUIRE & AC_DEFUN_ONCE: Require, expand)
+
+AT_DATA([configure.in],
+[[AC_DEFUN([TEST],
+[AC_REQUIRE([MULTI_TEST])
+AC_REQUIRE([SINGLE_TEST])])
+
+AC_DEFUN([MULTI_TEST],
+[multi_test=".$multi_test"])
+
+AC_DEFUN_ONCE([SINGLE_TEST],
+[single_test=".$single_test"])
+
+AC_PLAIN_SCRIPT
+TEST
+TEST
+MULTI_TEST
+MULTI_TEST
+SINGLE_TEST
+SINGLE_TEST
+
+case $multi_test:$single_test in
+  ...:. ) AS_EXIT(0);;
+  ...:* ) AC_MSG_ERROR([DEFUN_ONCE is broken]);;
+  *:.   ) AC_MSG_ERROR([DEFUN is broken (Wow, congrats!)]);;
+esac
+]])
+
+AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [],
+[configure.in:16: warning: SINGLE_TEST invoked multiple times
+configure.in:17: warning: SINGLE_TEST invoked multiple times
+])
+
+AT_CHECK([./configure], 0)
+
+AT_CLEANUP(configure)
+
+
+
+## ----------------------------------------------- ##
+## AC_REQUIRE and AC_DEFUN_ONCE: Expand, require.  ##
+## ----------------------------------------------- ##
+
+AT_SETUP(AC_REQUIRE & AC_DEFUN_ONCE: Expand, require)
+
+AT_DATA([configure.in],
+[[AC_DEFUN([TEST],
+[AC_REQUIRE([MULTI_TEST])
+AC_REQUIRE([SINGLE_TEST])])
+
+AC_DEFUN([MULTI_TEST],
+[multi_test=".$multi_test"])
+
+AC_DEFUN_ONCE([SINGLE_TEST],
+[single_test=".$single_test"])
+
+AC_PLAIN_SCRIPT
+MULTI_TEST
+MULTI_TEST
+SINGLE_TEST
+SINGLE_TEST
+TEST
+TEST
+
+case $multi_test:$single_test in
+  ..:. ) AS_EXIT(0);;
+  ..:* ) AC_MSG_ERROR([DEFUN_ONCE is broken]);;
+  *:.  ) AC_MSG_ERROR([DEFUN is broken (Wow, congrats!)]);;
+esac
+]])
+
+AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [],
+[configure.in:15: warning: SINGLE_TEST invoked multiple times
+])
+AT_CHECK([./configure], 0)
+
+
+AT_CLEANUP(configure)