]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix `configure --help=recursive' in unconfigured/read-only trees.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 16 Oct 2007 21:50:03 +0000 (23:50 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 16 Oct 2007 21:50:03 +0000 (23:50 +0200)
* lib/m4sugar/m4sh.m4 (_AS_LN_S_PREPARE): Avoid errors when `.'
is not writable, use 'cp -p' in this case, in the hope that it
will not actually be needed.  Still try removing files, in case
of other write errors.
* lib/autoconf/general.m4 (_AC_INIT_SRCDIR): For ac_confdir,
use $as_myself, not $0.
(_AC_INIT_HELP): For --help=recursive, if the subdir does not
exist, try again in the the source tree.  This change assumes
that the subpackage configure script is capable of running
--help=recursive in the source tree.
* tests/torture.at (Configuring subdirectories, Deep Package):
Adjust tests to expose both issues, also try invocation as
`sh configure ...' and plain `configure ...' with PATH adjusted.
* NEWS, THANKS: Update.
Report by Hans Ulrich Niedermann.

ChangeLog
NEWS
THANKS
configure
lib/autoconf/general.m4
lib/m4sugar/m4sh.m4
tests/torture.at

index 101ba00d8df38b1a08614cb106d184cecd3bea68..60a1558ac5d8c4d3dca3419534d9ea0867583d93 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2007-10-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix `configure --help=recursive' in unconfigured/read-only trees.
+       * lib/m4sugar/m4sh.m4 (_AS_LN_S_PREPARE): Avoid errors when `.'
+       is not writable, use 'cp -p' in this case, in the hope that it
+       will not actually be needed.  Still try removing files, in case
+       of other write errors.
+       * lib/autoconf/general.m4 (_AC_INIT_SRCDIR): For ac_confdir,
+       use $as_myself, not $0.
+       (_AC_INIT_HELP): For --help=recursive, if the subdir does not
+       exist, try again in the the source tree.  This change assumes
+       that the subpackage configure script is capable of running
+       --help=recursive in the source tree.
+       * tests/torture.at (Configuring subdirectories, Deep Package):
+       Adjust tests to expose both issues, also try invocation as
+       `sh configure ...' and plain `configure ...' with PATH adjusted.
+       * NEWS, THANKS: Update.
+       Report by Hans Ulrich Niedermann.
+
 2007-10-16  Paul Eggert  <eggert@cs.ucla.edu>
 
        Check for 64-bit int errors in HP-UX 10.20 preprocessor.
diff --git a/NEWS b/NEWS
index 25095f20861c9cb3af6e04306b13683e4b1c083e..9d31144a9e25e2760ef503da14e63a2fa555752f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -66,6 +66,9 @@ GNU Autoconf NEWS - User visible changes.
    command './configure --prefix=/usr/' will still result in an
    expanded libdir value of /usr/lib, not /usr//lib.
 
+** `configure --help=recursive' now works in read-only trees and from
+   unconfigured build trees.
+
 ** AT_SETUP now handles macro expansions properly when calculating line
    length.
 
diff --git a/THANKS b/THANKS
index c30e341775c5b22aad5a030fb0372cbd3b3aad67..4faae01541504952e30391f71c60a6db11a68a25 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -131,6 +131,7 @@ H. Peter Anvin              ?
 H.J. Lu                     hjl@gnu.org
 Hans Aberg                  haberg@math.su.se
 Hans Olsson                 Hans.Olsson@dna.lth.se
+Hans Ulrich Niedermann      hun@n-dimensional.de
 Harlan Stenn                stenn@whimsy.udel.edu
 Henk Krus                   h.krus@cyclone.nl
 Howard Chu                  hyc@highlandsun.com
index bccfc0a4cb27f9a678dab738c010b037bc6d020f..ceddf50e170510048221469dfb6ee19df4d1c410 100755 (executable)
--- a/configure
+++ b/configure
@@ -513,19 +513,22 @@ if test -d conf$$.dir; then
   rm -f conf$$.dir/conf$$.file
 else
   rm -f conf$$.dir
-  mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... but there are two gotchas:
-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-  # In both cases, we have to default to `cp -p'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
     as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
+  fi
 else
   as_ln_s='cp -p'
 fi
@@ -1172,12 +1175,12 @@ test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
   # Try the directory containing this script, then the parent directory.
-  ac_confdir=`$as_dirname -- "$0" ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$0" : 'X\(//\)[^/]' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$0" |
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_myself" : 'X\(//\)[^/]' \| \
+        X"$as_myself" : 'X\(//\)$' \| \
+        X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -1329,7 +1332,9 @@ fi
 if test "$ac_init_help" = "recursive"; then
   # If there are subdirs, report their specific --help.
   for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d "$ac_dir" || continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && srcdir=. && test -d "$ac_dir"; } ||
+      continue
     ac_builddir=.
 
 case "$ac_dir" in
@@ -3261,19 +3266,22 @@ if test -d conf$$.dir; then
   rm -f conf$$.dir/conf$$.file
 else
   rm -f conf$$.dir
-  mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... but there are two gotchas:
-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-  # In both cases, we have to default to `cp -p'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
     as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
+  fi
 else
   as_ln_s='cp -p'
 fi
index b57d8872c1a160c63b45dec4f300851dc91c698c..2834e25c2564e7f6563c705013828996a4387296 100644 (file)
@@ -498,7 +498,7 @@ m4_divert_push([PARSE_ARGS])dnl
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
   # Try the directory containing this script, then the parent directory.
-  ac_confdir=`AS_DIRNAME(["$[0]"])`
+  ac_confdir=`AS_DIRNAME(["$as_myself"])`
   srcdir=$ac_confdir
   if test ! -r "$srcdir/$ac_unique_file"; then
     srcdir=..
@@ -1102,7 +1102,9 @@ fi
 if test "$ac_init_help" = "recursive"; then
   # If there are subdirs, report their specific --help.
   for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d "$ac_dir" || continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && srcdir=. && test -d "$ac_dir"; } ||
+      continue
     _AC_SRCDIRS(["$ac_dir"])
     cd "$ac_dir" || { ac_status=$?; continue; }
     # Check for guested configure.
index debf20848a58525abbfabb11930ac883d5775977..7036c004c12a934c1dfde74a6df4b62c5da1c20f 100644 (file)
@@ -949,26 +949,30 @@ _AS_LINENO_WORKS || {
 # Don't use conftest.sym to avoid file name issues on DJGPP, where this
 # would yield conftest.sym.exe for DJGPP < 2.04.  And don't use `conftest'
 # as base name to avoid prohibiting concurrency (e.g., concurrent
-# config.statuses).
+# config.statuses).  On read-only media, assume 'cp -p' and hope we
+# are just running --help anyway.
 m4_defun([_AS_LN_S_PREPARE],
 [rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
   rm -f conf$$.dir/conf$$.file
 else
   rm -f conf$$.dir
-  mkdir conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
 fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... but there are two gotchas:
-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-  # In both cases, we have to default to `cp -p'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
     as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
+  fi
 else
   as_ln_s='cp -p'
 fi
index ea639fc57a8ba6b4efbbc28b652229c80406c114..0a835ba2a4085557379583b41163add46b15fe98 100644 (file)
@@ -1052,7 +1052,9 @@ AT_CHECK([test -f inner/configure])
 
 # Running the outer configure recursively should provide the innermost
 # help strings.
+chmod a-w inner/innermost inner .
 AT_CHECK([./configure --help=recursive | grep INNER], 0, [ignore])
+chmod u+w . inner inner/innermost
 
 # Running the outer configure should trigger the inner.
 AT_CHECK_CONFIGURE
@@ -1154,8 +1156,13 @@ AT_CHECK([test -f inner/innermost/config.hin])
 
 # Running the outer configure recursively should provide the innermost
 # help strings.
+chmod a-w inner/innermost inner
 AT_CHECK([./configure --help=recursive | grep " INNER "],     0, [ignore])
 AT_CHECK([./configure --help=recursive | grep " INNERMOST "], 0, [ignore])
+AT_CHECK([/bin/sh ./configure --help=recursive | grep " INNERMOST "], 0, [ignore])
+AT_CHECK([PATH=.$PATH_SEPARATOR$PATH /bin/sh configure --help=recursive | grep " INNERMOST "], 0, [ignore])
+AT_CHECK([PATH=.$PATH_SEPARATOR$PATH; export PATH; configure --help=recursive | grep " INNERMOST "], 0, [ignore])
+chmod u+w inner inner/innermost
 
 # Running the outer configure should trigger the inner.
 AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
@@ -1165,6 +1172,13 @@ AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
 
 # The same, but from a builddir.
 AS_MKDIR_P([builddir])
+chmod a-w builddir inner/innermost inner
+AT_CHECK([cd builddir && ../configure --help=recursive | grep " INNER "],     0, [ignore])
+AT_CHECK([cd builddir && ../configure --help=recursive | grep " INNERMOST "], 0, [ignore])
+AT_CHECK([cd builddir && /bin/sh ../configure --help=recursive | grep " INNERMOST "], 0, [ignore])
+AT_CHECK([cd builddir && PATH=`pwd`/..$PATH_SEPARATOR$PATH /bin/sh configure --help=recursive | grep " INNERMOST "], 0, [ignore])
+AT_CHECK([PATH=`pwd`$PATH_SEPARATOR$PATH; export PATH; cd builddir && configure --help=recursive | grep " INNERMOST "], 0, [ignore])
+chmod u+w builddir inner inner/innermost
 AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
 AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
 [[#define INNERMOST build/tsomrenni