This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

top-level configure: preserve quotes in arguments (Was: Re: [libstdc++] libstdc++/7691, pass -Wabi, sanity checks)

On Thu, Aug 29, 2002 at 04:08:12PM -0400, Phil Edwards wrote:
>> Maybe somebody should ask Alexandre Oliva why white space quoted string
>> literals get munged...
> ...they're not getting munged exactly; it's just that there's been a lot of
> changes in the toplevel configury, and quoted stirngs can only be evaluated
> and assigned and passed around so many times before all the quoting levels
> have been removed.

Or you can take care to requote them when you're assigning them.  There
only seems to be one place that's causing this particular trouble.  The
patch below is enough to get --enable-cxx-flags="-Wabi -Wasabi" and
similar working again.  (I think it's trivial enough that I can post my
non-copyright assigned thoughts without polluting anyone's mind :-).)
Or maybe Alexandre has a better way to do something similar :-).

Tested by bootstraping on x86 Linux (with --enable-cxx-flags="-Wabi -Wabi"
rather than the green fire :-)).

The nasty regexp is copied from some autoconf output.

This fixes the regression with --enable-cxx-flags, but there are some
other related space-quoting problems here.  TOPLEVEL_CONFIGURE_ARGUMENTS
doesn't get anything clever done to it, so the listing of configure
arguments in "gcc -v" will be a bit confusing because --enable-cxx-flags
won't be displayed with quotes.  Also notice in the case/esac immediately
below my patch that $enableoptions has "\'$option\'" added to it, but
$disableoptions, $withoptions, and $withoutoptions don't get the quotes.
Thus configuring with some random --enable-banana="ripe yellow" works
but a similarly random --with-banana="ripe yellow" doesn't.  So there's
a little more to do in this scary script.

2002-08-30  John Marshall  <>

	* configure: Quotes spaces etc in configure arguments to be
	passed to via $arguments.

Index: configure
RCS file: /cvsroot/gcc/gcc/configure,v
retrieving revision 1.46
diff -u -p -r1.46 configure
--- configure	19 Jun 2002 18:10:07 -0000	1.46
+++ configure	30 Aug 2002 18:38:54 -0000
@@ -192,22 +192,32 @@ do
 # Split out the argument for options that take them
 	case $option in
+		addoption=`echo $option | sed -e 's/=.*//'`
 		optarg=`echo $option | sed -e 's/^[^=]*=//'`
-		arguments="$arguments $option"
 # These options have mandatory values.  Since we didn't find an = sign,
 # the value must be in the next argument
 	--bu* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-* | --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
+		addoption=$option
-		arguments="$arguments $option=$optarg"
-		arguments="$arguments -v"
+		addoption=-v
+		optarg=
-		arguments="$arguments $option"
+		addoption=$option
+		optarg=
+	esac
+# Record the option, quoting as necessary
+	case "$optarg" in
+	"")	arguments="$arguments $addoption" ;;
+	*" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+		arguments="$arguments $addoption=\"$optarg\"" ;;
+	*)	arguments="$arguments $addoption=$optarg" ;;
 # Now, process the options

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]