]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/status.m4 (_AC_OUTPUT_SUBDIRS): Take care not to
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 6 May 2006 05:53:50 +0000 (05:53 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 6 May 2006 05:53:50 +0000 (05:53 +0000)
munge (multiple) white space and other oddities.
* tests/torture.at (AT_CHECK_AC_ARG_VAR): Make sure to M4-escape
single quotes in variable assignment.
(AC_ARG_VAR, configure invocation): Adjust tests to expose this
and similar failures by adding multiple spaces, tabs, and other
special characters.
Report and different test suggested by Francesco Romani
<fromani@gmail.com> and Andrew Church <achurch@achurch.org>.

ChangeLog
lib/autoconf/status.m4
tests/torture.at

index 6d20ed646df5b67f13dfbb1b6989662d8d22f07d..c727112c445c5c44cb382d4eba621a1685f078b2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2006-05-06  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       * lib/autoconf/status.m4 (_AC_OUTPUT_SUBDIRS): Take care not to
+       munge (multiple) white space and other oddities.
+       * tests/torture.at (AT_CHECK_AC_ARG_VAR): Make sure to M4-escape
+       single quotes in variable assignment.
+       (AC_ARG_VAR, configure invocation): Adjust tests to expose this
+       and similar failures by adding multiple spaces, tabs, and other
+       special characters.
+       Report and different test suggested by Francesco Romani
+       <fromani@gmail.com> and Andrew Church <achurch@achurch.org>.
+
        * lib/autoconf/general.m4 (_AC_INIT_PREPARE): When we escape
        single quotes, we only need to search for single quotes; this
        both simplifies the search pattern, and makes us less
index a0239a518fc70e61562694ff5690f89dfdc753d8..ef1545a3e04d7a93273a0e6c98d11d90c820bff9 100644 (file)
@@ -915,7 +915,10 @@ if test "$no_recursion" != yes; then
   # Remove --cache-file and --srcdir arguments so they do not pile up.
   ac_sub_configure_args=
   ac_prev=
-  for ac_arg in $ac_configure_args; do
+  eval set x "$ac_configure_args"
+  shift
+  for ac_arg
+  do
     if test -n "$ac_prev"; then
       ac_prev=
       continue
@@ -938,7 +941,11 @@ if test "$no_recursion" != yes; then
       ac_prev=prefix ;;
     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
       ;;
-    *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+    *)
+      case $ac_arg in
+      *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+      esac
+      ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
     esac
   done
 
@@ -984,8 +991,8 @@ if test "$no_recursion" != yes; then
 
       AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
       # The eval makes quoting arguments work.
-      eval $ac_sub_configure $ac_sub_configure_args \
-          --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir ||
+      eval "$ac_sub_configure $ac_sub_configure_args \
+          --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" ||
        AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
     fi
 
index 0b834bd1d987f93112dd5c229f671e15382cdd9c..9ea29fbb372a503087ac5e5dd118352522e2aff8 100644 (file)
@@ -57,7 +57,7 @@ m4_define([AT_CHECK_AC_ARG_VAR],
 
 # Initial value.
 m4_ifval([$1],
-        [precious='$1'; export precious],
+        [precious='m4_bpatsubst($1, [[']], ['\\''])'; export precious],
         [unset precious])
 AT_CHECK_CONFIGURE([--config-cache -q])
 AT_CHECK([cat file], [], [`$1'
@@ -119,6 +119,9 @@ AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye])
 # Change a precious variable that contains braces
 AT_CHECK_AC_ARG_VAR([apple of my {eye}], [orange of my eye])
 
+# Change a precious variable that contains all kinds of fun
+AT_CHECK_AC_ARG_VAR(['p  r     ec"iou$], [orange of my eye])
+
 AT_CLEANUP
 
 
@@ -258,34 +261,51 @@ AT_CLEANUP
 # Check that `configure' and `config.status' honor their interface.
 #
 # We run `./configure one=val1 --enable-two=val2 --with-three=val3'
-# and verify that (i) `configure' correctly receives the arguments and
+# and verify that (i) `configure' correctly receives the arguments,
 # (ii) correctly passes them to `config.status', which we check by
-# running `config.status --recheck'.
+# running `config.status --recheck', and (iii) correctly passes them
+# to sub-configure scripts.
 
 AT_SETUP([configure invocation])
 
+mkdir sub
+
 AT_DATA([configure.ac],
 [[AC_INIT
+AC_CONFIG_SUBDIRS([sub])
+echo "result=$one$enable_two$with_three"
+AC_OUTPUT
+]])
+
+AT_DATA([sub/configure.ac],
+[[AC_INIT
 echo "result=$one$enable_two$with_three"
 AC_OUTPUT
 ]])
 
+echo fake install-sh script >install-sh
+
+AT_CHECK_AUTOCONF
+cd sub
 AT_CHECK_AUTOCONF
+cd ..
 
 AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
                     sed -n -e 's/^result=//p'], 0,
-                  [onetwothree
-])
+                  [m4_do([onetwothree
+],                       [onetwothree
+])])
 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
         [onetwothree
 ])
 
-AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
+AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" '  $" --with-three="  \"'$"|
                      sed -n -e 's/^result=//p'], 0,
-                  ["'$ " ' $ "'$
-])
+                  [m4_do(["'$ " '  $   "'$
+],                       ["'$ " '  $   "'$
+])])
 AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
-        ["'$ " ' $ "'$
+        ["'$ " '  $    "'$
 ])
 
 AT_CLEANUP