bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Argument quoting problem when processing config_subdirs


From: Tim Van Holder
Subject: RE: Argument quoting problem when processing config_subdirs
Date: Sun, 7 Jan 2001 01:37:51 +0100

And yet again, my hack introduces failure. When there was more than
one subdir, it would keep appending --srcdir and --cache-file
options (and badly too). This diff fixes that.
As before, this is just the hack I'm using right now - it is not
guaranteed to be bullet-proof (as should be obvious by now).

--- ../autoconf-2.49b.gnu/acgeneral.m4  Wed Dec  6 14:44:12 2000
+++ ./acgeneral.m4      Sun Jan  7 01:32:34 2001
@@ -4597,8 +4681,10 @@
 if test "$no_recursion" != yes; then
 
   # Remove --cache-file and --srcdir arguments so they do not pile up.
+dnl Don't forget we might have quoted these!
   ac_sub_configure_args=
   ac_prev=
+  ac_sep=
   for ac_arg in $ac_configure_args; do
     if test -n "$ac_prev"; then
       ac_prev=
@@ -4612,13 +4698,21 @@
     | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
     | --c=*)
       ;;
+    \'-cache-file=*\' | \'--cache-file=*\' | \'--cache-fil=*\' \
+    | \'--cache-fi=*\' | \'--cache-f=*\' | \'--cache-=*\' | \'--cache=*\' \
+    | \'--cach=*\' | \'--cac=*\' | \'--ca=*\' | \'--c=*\')
+      ;;
     --config-cache | -C)
       ;;
     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
       ac_prev=srcdir ;;
     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
       ;;
-    *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+    \'-srcdir=*\' | \'--srcdir=*\' | \'--srcdi=*\' | \'--srcd=*\' \
+    | \'--src=*\' | \'--sr=*\')
+      ;;
+    *) ac_sub_configure_args="$ac_sub_configure_args$ac_sep$ac_arg"
+       ac_sep=" ";;
     esac
   done
 
@@ -4661,9 +4755,9 @@
 
     # Check for guested configure; otherwise get Cygnus style configure.
     if test -f $ac_sub_srcdir/configure.gnu; then
-      ac_sub_configure="$SHELL $ac_sub_srcdir/configure.gnu"
+      ac_sub_configure="$SHELL '$ac_sub_srcdir/configure.gnu'"
     elif test -f $ac_sub_srcdir/configure; then
-      ac_sub_configure="$SHELL $ac_sub_srcdir/configure"
+      ac_sub_configure="$SHELL '$ac_sub_srcdir/configure'"
     elif test -f $ac_sub_srcdir/configure.in; then
       ac_sub_configure=$ac_configure
     else
@@ -4686,9 +4780,26 @@
       esac
 ])dnl
 
-      AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args 
--cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir])
+      # Since we're fabricating the --srcdir option, quote it like
+      # like we normally would.
+      case $ac_sub_srcdir in
+[  *" "*|*"    "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)]
+           ac_sub_srcdir=`echo "$ac_sub_srcdir" | sed "s/'/'\\\\\\\\''/g"`
+           ac_sub_srcdir_opt="'--srcdir=$ac_sub_srcdir'" ;;
+        *) ac_sub_srcdir_opt="--srcdir=$ac_sub_srcdir"   ;;
+      esac
+
+      # Same goes for --cache-file
+      case $ac_sub_cache_file in
+[  *" "*|*"    "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)]
+        ac_sub_cache_file=`echo "$ac_sub_cache_file" | sed "s/'/'\\\\\\\\''/g"`
+        ac_sub_cache_opt="'--cache-file=$ac_sub_cache_file'" ;;
+        *) ac_sub_cache_opt="--cache-file=$ac_sub_cache_file"   ;;
+      esac
+
+      AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args 
$ac_sub_srcdir_opt $ac_sub_cache_opt])
       # The eval makes quoting arguments work.
-      if eval $ac_sub_configure $ac_sub_configure_args 
--cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
+      if eval $ac_sub_configure $ac_sub_configure_args $ac_sub_srcdir_opt 
$ac_sub_cache_opt
       then :
       else
         AC_MSG_ERROR([$ac_sub_configure failed for $ac_subdir])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]