This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Fix quoting of program-transform-name in toplevel configure


I wanted to do

.../configure --program-transform-name=/^[cg][^.-]*$/s/$/-3.4/

so that 'gcc' would be renamed 'gcc-3.4' but
'powerpc-apple-darwin-gcc-3.4' wouldn't be renamed.  I quickly
developed a severe case of Leaning Toothpick Syndrome.  This is a
regression from 3.3, which Just Worked.

Tested with a bootstrap on powerpc-darwin, and lots of manual
inspection of Makefiles.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-transformnamequote.patch==============
2003-08-20  Geoffrey Keating  <geoffk@apple.com>

	* configure.in (TOPLEVEL_CONFIGURE_ARGUMENTS): Quote properly for
	make, shell, etc.
	(baseargs): Likewise.
	* configure: Regenerate.

Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/configure.in,v
retrieving revision 1.250
diff -u -p -u -p -r1.250 configure.in
--- configure.in	20 Aug 2003 00:50:19 -0000	1.250
+++ configure.in	21 Aug 2003 02:09:35 -0000
@@ -66,8 +66,19 @@ progname=$0
 # if PWD already has a value, it is probably wrong.
 if test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
 
-# Export original configure arguments for use by sub-configures.
-TOPLEVEL_CONFIGURE_ARGUMENTS="$progname $@"
+# Export original configure arguments for use by sub-configures.  These
+# will be expanded once by make, and once by the shell, so they need to
+# have '$' quoted for make, and then each argument quoted for the shell.
+# What's more, the 'echo' below might expand backslashes.
+cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+tmp="'$progname'"
+for ac_arg ; do
+  tmp="$tmp '"`echo "$ac_arg" | sed -fconftestsed`
+done
+rm -f conftestsed
+TOPLEVEL_CONFIGURE_ARGUMENTS="$tmp"
 AC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)
 
 moveifchange=${srcdir}/move-if-change
@@ -1754,20 +1766,24 @@ AC_SUBST_FILE(serialization_dependencies
 # Base args.  Strip norecursion, cache-file, srcdir, host, build,
 # target and nonopt.  These are the ones we might not want to pass
 # down to subconfigures.
-baseargs=`echo " ${ac_configure_args} " | \
-	sed -e 's/ --no[[^ ]]* / /' \
-	    -e 's/ --c[[a-z-]]*[[= ]][[^ ]]* / /' \
-	    -e 's/ --sr[[a-z-]]*[[= ]][[^ ]]* / /' \
-	    -e 's/ --ho[[a-z-]]*[[= ]][[^ ]]* / /' \
-	    -e 's/ --bu[[a-z-]]*[[= ]][[^ ]]* / /' \
-	    -e 's/ --t[[a-z-]]*[[= ]][[^ ]]* / /' \
-	    -e 's/ -cache-file[[= ]][[^ ]]* / /' \
-	    -e 's/ -srcdir[[= ]][[^ ]]* / /' \
-	    -e 's/ -host[[= ]][[^ ]]* / /' \
-	    -e 's/ -build[[= ]][[^ ]]* / /' \
-	    -e 's/ -target[[= ]][[^ ]]* / /' \
-	    -e "s/ [[^' -][^ ]*] / /" \
-	    -e 's/^ *//;s/ *$//'`
+cat <<\EOF_SED > conftestsed
+s/ --no[[^ ]]* / /
+s/ --c[[a-z-]]*[[= ]][[^ ]]* / /
+s/ --sr[[a-z-]]*[[= ]][[^ ]]* / /
+s/ --ho[[a-z-]]*[[= ]][[^ ]]* / /
+s/ --bu[[a-z-]]*[[= ]][[^ ]]* / /
+s/ --t[[a-z-]]*[[= ]][[^ ]]* / /
+s/ -cache-file[[= ]][[^ ]]* / /
+s/ -srcdir[[= ]][[^ ]]* / /
+s/ -host[[= ]][[^ ]]* / /
+s/ -build[[= ]][[^ ]]* / /
+s/ -target[[= ]][[^ ]]* / /
+s/ [[^' -][^ ]*] / /
+s/^ *//;s/ *$//
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+baseargs=`echo " ${ac_configure_args} " | sed -fconftestsed`
+rm -f conftestsed
 
 # For the build-side libraries, we just need to pretend we're native,
 # and not use the same cache file.  Multilibs are neither needed nor
============================================================


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