]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
While preserved in configure, srcdir is trashed in config.status.
authorAkim Demaille <akim@epita.fr>
Wed, 24 Jan 2001 13:19:10 +0000 (13:19 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 24 Jan 2001 13:19:10 +0000 (13:19 +0000)
Reported by Ralf Corsepius.
* tests/aclocal.m4 (AC_STATE_SAVE): It is ok to modify
CONFIG_STATUS, DEFS, prefix and exec_prefix.
It is OK to produce config.* files.
* tests/atspecific.m4 (AT_CONFIGURE_AC): Save the env *after*
AC_OUTPUT to check that it doesn't break anything by itself.
* tests/torture.m4 (srcdir): New test, from Ralf Corsepius.
* acgeneral.m4 (_AC_OUTPUT_FILES): Use ac_top_srcdir and ac_srcdir
to preserve srcdir and top_srcdir.
Remove any use of `ac_given_srcdir' as `$srcdir' being preserved
is usable.

ChangeLog
acgeneral.m4
lib/autoconf/general.m4
tests/aclocal.m4
tests/atspecific.m4
tests/torture.at

index 1c69ece7bb3077bc6c2cf7f2fec013562f0181a9..89b124a75a1cc7aaaee387e64097316f630f9907 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2001-01-24  Akim Demaille  <akim@epita.fr>
+
+       While preserved in configure, srcdir is trashed in config.status.
+       Reported by Ralf Corsepius.
+
+       * tests/aclocal.m4 (AC_STATE_SAVE): It is ok to modify
+       CONFIG_STATUS, DEFS, prefix and exec_prefix.
+       It is OK to produce config.* files.
+       * tests/atspecific.m4 (AT_CONFIGURE_AC): Save the env *after*
+       AC_OUTPUT to check that it doesn't break anything by itself.
+       * tests/torture.m4 (srcdir): New test, from Ralf Corsepius.
+       * acgeneral.m4 (_AC_OUTPUT_FILES): Use ac_top_srcdir and ac_srcdir
+       to preserve srcdir and top_srcdir.
+       Remove any use of `ac_given_srcdir' as `$srcdir' being preserved
+       is usable.
+
 2001-01-24  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
        configure -q did not work since 2000-11-03.
index d30c2050661c65e93761df3c27f683d090f0d699..a306eb5b416e1989517389d16d636521508d5956 100644 (file)
@@ -3630,11 +3630,10 @@ ac_cs_version="\\
 $CONFIG_STATUS generated by $as_me (Autoconf AC_ACVERSION).
 Configured on host $ac_hostname by
   `echo "[$]0 $ac_configure_args" | sed 's/[[\\""\`\$]]/\\\\&/g'`"
-
-ac_given_srcdir=$srcdir
+srcdir=$srcdir
 AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
 [dnl Leave those double quotes here: this $INSTALL is evaluated in a
-dnl here document, wbich might result in `ac_given_srcdir=/bin/install -c'.
+dnl here document, wbich might result in `srcdir=/bin/install -c'.
 ac_given_INSTALL="$INSTALL"
 ])dnl
 EOF
@@ -3894,7 +3893,8 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
   * )   ac_file_in=$ac_file.in ;;
   esac
 
-  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+  # Adjust a relative ac_srcdir, ac_top_srcdir, and INSTALL for
+  # subdirectories.
   ac_dir=`AS_DIRNAME(["$ac_file"])`
   if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
     AS_MKDIR_P(["$ac_dir"])
@@ -3905,16 +3905,19 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
     ac_dir_suffix= ac_dots=
   fi
 
-  case $ac_given_srcdir in
-  .)  srcdir=.
-      if test -z "$ac_dots"; then top_srcdir=.
-      else top_srcdir=`echo $ac_dots | sed 's,/$,,'`; fi ;;
+  case $srcdir in
+  .)  ac_srcdir=.
+      if test -z "$ac_dots"; then
+         ac_top_srcdir=.
+      else
+         ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'`
+      fi ;;
   [[\\/]]* | ?:[[\\/]]* )
-      srcdir=$ac_given_srcdir$ac_dir_suffix;
-      top_srcdir=$ac_given_srcdir ;;
+      ac_srcdir=$srcdir$ac_dir_suffix;
+      ac_top_srcdir=$srcdir ;;
   *) # Relative path.
-    srcdir=$ac_dots$ac_given_srcdir$ac_dir_suffix
-    top_srcdir=$ac_dots$ac_given_srcdir ;;
+    ac_srcdir=$ac_dots$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_dots$srcdir ;;
   esac
 
 AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
@@ -3948,9 +3951,9 @@ AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
          if test -f "$f"; then
            # Build tree
            echo $f
-         elif test -f "$ac_given_srcdir/$f"; then
+         elif test -f "$srcdir/$f"; then
            # Source tree
-           echo $ac_given_srcdir/$f
+           echo $srcdir/$f
          else
            # /dev/null tree
            AC_MSG_ERROR([cannot find input file: $f])
@@ -3969,8 +3972,8 @@ cat >>$CONFIG_STATUS <<\EOF
 :t
 [/@[a-zA-Z_][a-zA-Z_0-9]*@/!b]
 s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$srcdir,;t t
-s,@top_srcdir@,$top_srcdir,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
 AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [s,@INSTALL@,$INSTALL,;t t
 ])dnl
 dnl The parens around the eval prevent an "illegal io" in Ultrix sh.
@@ -4095,9 +4098,9 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
          if test -f "$f"; then
            # Build tree
            echo $f
-         elif test -f "$ac_given_srcdir/$f"; then
+         elif test -f "$srcdir/$f"; then
            # Source tree
-           echo $ac_given_srcdir/$f
+           echo $srcdir/$f
          else
            # /dev/null tree
            AC_MSG_ERROR([cannot find input file: $f])
@@ -4253,7 +4256,6 @@ m4_define([_AC_OUTPUT_LINKS],
 #
 # CONFIG_LINKS section.
 #
-srcdir=$ac_given_srcdir
 
 dnl Here we use : instead of .. because if AC_LINK_FILES was used
 dnl with empty parameters (as in gettext.m4), then we obtain here
index d30c2050661c65e93761df3c27f683d090f0d699..a306eb5b416e1989517389d16d636521508d5956 100644 (file)
@@ -3630,11 +3630,10 @@ ac_cs_version="\\
 $CONFIG_STATUS generated by $as_me (Autoconf AC_ACVERSION).
 Configured on host $ac_hostname by
   `echo "[$]0 $ac_configure_args" | sed 's/[[\\""\`\$]]/\\\\&/g'`"
-
-ac_given_srcdir=$srcdir
+srcdir=$srcdir
 AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
 [dnl Leave those double quotes here: this $INSTALL is evaluated in a
-dnl here document, wbich might result in `ac_given_srcdir=/bin/install -c'.
+dnl here document, wbich might result in `srcdir=/bin/install -c'.
 ac_given_INSTALL="$INSTALL"
 ])dnl
 EOF
@@ -3894,7 +3893,8 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
   * )   ac_file_in=$ac_file.in ;;
   esac
 
-  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+  # Adjust a relative ac_srcdir, ac_top_srcdir, and INSTALL for
+  # subdirectories.
   ac_dir=`AS_DIRNAME(["$ac_file"])`
   if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
     AS_MKDIR_P(["$ac_dir"])
@@ -3905,16 +3905,19 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
     ac_dir_suffix= ac_dots=
   fi
 
-  case $ac_given_srcdir in
-  .)  srcdir=.
-      if test -z "$ac_dots"; then top_srcdir=.
-      else top_srcdir=`echo $ac_dots | sed 's,/$,,'`; fi ;;
+  case $srcdir in
+  .)  ac_srcdir=.
+      if test -z "$ac_dots"; then
+         ac_top_srcdir=.
+      else
+         ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'`
+      fi ;;
   [[\\/]]* | ?:[[\\/]]* )
-      srcdir=$ac_given_srcdir$ac_dir_suffix;
-      top_srcdir=$ac_given_srcdir ;;
+      ac_srcdir=$srcdir$ac_dir_suffix;
+      ac_top_srcdir=$srcdir ;;
   *) # Relative path.
-    srcdir=$ac_dots$ac_given_srcdir$ac_dir_suffix
-    top_srcdir=$ac_dots$ac_given_srcdir ;;
+    ac_srcdir=$ac_dots$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_dots$srcdir ;;
   esac
 
 AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
@@ -3948,9 +3951,9 @@ AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
          if test -f "$f"; then
            # Build tree
            echo $f
-         elif test -f "$ac_given_srcdir/$f"; then
+         elif test -f "$srcdir/$f"; then
            # Source tree
-           echo $ac_given_srcdir/$f
+           echo $srcdir/$f
          else
            # /dev/null tree
            AC_MSG_ERROR([cannot find input file: $f])
@@ -3969,8 +3972,8 @@ cat >>$CONFIG_STATUS <<\EOF
 :t
 [/@[a-zA-Z_][a-zA-Z_0-9]*@/!b]
 s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$srcdir,;t t
-s,@top_srcdir@,$top_srcdir,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
 AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [s,@INSTALL@,$INSTALL,;t t
 ])dnl
 dnl The parens around the eval prevent an "illegal io" in Ultrix sh.
@@ -4095,9 +4098,9 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
          if test -f "$f"; then
            # Build tree
            echo $f
-         elif test -f "$ac_given_srcdir/$f"; then
+         elif test -f "$srcdir/$f"; then
            # Source tree
-           echo $ac_given_srcdir/$f
+           echo $srcdir/$f
          else
            # /dev/null tree
            AC_MSG_ERROR([cannot find input file: $f])
@@ -4253,7 +4256,6 @@ m4_define([_AC_OUTPUT_LINKS],
 #
 # CONFIG_LINKS section.
 #
-srcdir=$ac_given_srcdir
 
 dnl Here we use : instead of .. because if AC_LINK_FILES was used
 dnl with empty parameters (as in gettext.m4), then we obtain here
index 8a471cda7edd66b1bad5c99b2978123bc8b50c29..27f9478c08a62f0d06a94d705c41a23d540700bf 100644 (file)
 # is AC_SUBST.
 # - ^ac_
 #   Autoconf's shell name space.
+# - prefix and exec_prefix
+#   are kept undefined (NONE) until AC_OUTPUT with then sets them to
+#   `/usr/local' and `${prefix}' for make.
+# - CONFIG_STATUS and DEFS
+#   Set by AC_OUTPUT.
 # - ALLOCA|NEED_SETGID|KMEM_GROUP
 #   AC_FUNCs from acspecific.
 # - AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|RANLIB|SET_MAKE|YACC
@@ -30,6 +35,7 @@ m4_defun([AC_STATE_SAVE],
 [(set) 2>&1 |
   egrep -v -e 'm4_join([|],
       [^ac_],
+      [^((exec_)?prefix|DEFS|CONFIG_STATUS)=],
       [^(CC|CFLAGS|CPP|GCC|CXX|CXXFLAGS|CXXCPP|GXX|F77|FFLAGS|FLIBS|G77)=],
       [^(LIBS|LIBOBJS|LDFLAGS)=],
       [^INSTALL(_(DATA|PROGRAM|SCRIPT))?=],
@@ -47,5 +53,5 @@ m4_defun([AC_STATE_SAVE],
   grep '^m4_defn([m4_re_word])=' >state-env.$1
 test $? = 0 || rm -f state-env.$1
 
-ls -1 | grep -v '^state' | sort >state-ls.$1
+ls -1 | egrep -v '^(state.*|config\.)' | sort >state-ls.$1
 ])# AC_STATE_SAVE
index 3f07885651060c1c09ff8f1ce43ef749b6ba5e42..ed79ba66b9ca9d8436aabd19b58c5f8771879ee7 100644 (file)
@@ -34,8 +34,8 @@ AC_CONFIG_AUX_DIR($top_srcdir)
 AC_CONFIG_HEADER(config.h:config.hin)
 AC_STATE_SAVE(before)
 $1
-AC_STATE_SAVE(after)
 AC_OUTPUT
+AC_STATE_SAVE(after)
 ])])
 
 
index f0afe6370ef8a543c9da2eeb4bcb8dcf6e7bc2bb..07e49b786289745bffd0a481196c1198c792a83c 100644 (file)
@@ -294,3 +294,43 @@ AT_DATA(expout,
 ])])
 
 AT_CLEANUP(dummy)
+
+
+## -------- ##
+## srcdir.  ##
+## -------- ##
+
+AT_SETUP([srcdir])
+
+rm -rf at-dir
+mkdir at-dir
+: >at-dir/bar.in
+: >foo.in
+
+AT_DATA([configure.ac],
+[[AC_INIT
+
+AC_CONFIG_FILES([foo at-dir/bar])
+
+AC_CONFIG_COMMANDS([report],
+[test -f $srcdir/configure.ac ||
+   AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
+                   [srcdir=$srcdir])
+
+AC_OUTPUT
+rm -rf foo at-dir/bar
+]])
+
+AT_CHECK_AUTOCONF
+
+# In place.
+AT_CHECK([./configure], [], [ignore])
+
+# Relative path.
+AT_CHECK([cd at-dir && ../configure], [], [ignore])
+
+# Absolute path.
+at_here=`pwd`
+AT_CHECK([cd at-dir && $at_here/configure], [], [ignore])
+
+AT_CLEANUP(at-dir foo.in foo)