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]

Re: Updating top-level autoconf to 2.59


On Sat, Dec 09, 2006 at 01:19:42PM -0500, Daniel Jacobowitz wrote:
> On Fri, Dec 08, 2006 at 06:26:32PM -0500, Daniel Jacobowitz wrote:
> > On Fri, Dec 08, 2006 at 02:02:58PM -0800, Steve Ellcey wrote:
> > > All of the subtrees in the GCC and Src trees have been updated to use
> > > autoconf 2.59 and now that GCC 4.2 has branched I think it is time to
> > > update the toplevel configure script to use 2.59 too.  I came up with
> > > the attached patch but I found that when I set (and exported) CC and
> > > then ran the GCC configure & make my build of libstdc++ failed because
> > > the build of the libstdc++ library was using my original bootstrap CC
> > > (the one used to build the new compiler) instead of the newly built g++
> > > like it does now.  Does this problem sound familiar to anyone?  Does
> > > anyone know how to fix it?
> > 
> > Not to me, but let me see if I can reproduce it.
> 
> I see what's happened; CC=whatever ends up on the subconfigure command
> line.  There's a few other things needing fixes too.  I'll work on it.

This should fix it.  Care to give it a try?  Not just Steve, that
applies to anyone - I would really like to apply this patch during
GCC's stage 1, since we've been building up to it for so long, but
given the fragility of the build system it could use a lot of testing.

-- 
Daniel Jacobowitz
CodeSourcery

2006-12-09  Daniel Jacobowitz  <dan@codesourcery.com>

	* Makefile.tpl (build_alias, host_alias, target_alias): Use
	noncanonical equivalents.
	* configure.in: Update AC_PREREQ.  Prevent error for AS_FOR_TARGET.
	Set build_noncanonical, host_noncanonical, and target_noncanonical.
	Use them.  Rewrite removal of configure arguments for autoconf
	2.59.  Discard variable settings.
	* Makefile.in: Regenerated.
	* configure: Regenerated with autoconf 2.59.

Index: Makefile.tpl
===================================================================
--- Makefile.tpl	(revision 119685)
+++ Makefile.tpl	(working copy)
@@ -28,11 +28,11 @@ in
 # -------------------------------
 VPATH=@srcdir@
 
-build_alias=@build_alias@
+build_alias=@build_noncanonical@
 build=@build@
-host_alias=@host_alias@
+host_alias=@host_noncanonical@
 host=@host@
-target_alias=@target_alias@
+target_alias=@target_noncanonical@
 target=@target@
 
 program_transform_name = @program_transform_name@
Index: configure.in
===================================================================
--- configure.in	(revision 119685)
+++ configure.in	(working copy)
@@ -21,10 +21,12 @@
 sinclude(config/acx.m4)
 
 AC_INIT(move-if-change)
-AC_PREREQ(2.13)
+AC_PREREQ(2.59)
 AC_CANONICAL_SYSTEM
 AC_ARG_PROGRAM
 
+m4_pattern_allow([AS_FOR_TARGET])dnl
+
 # Get 'install' or 'install-sh' and its variants.
 AC_PROG_INSTALL
 ACX_PROG_LN
@@ -192,6 +194,11 @@ fi	
 # Find the build and target subdir names.
 GCC_TOPLEV_SUBDIRS
 
+# Find the build, host, and target systems.
+ACX_NONCANONICAL_BUILD
+ACX_NONCANONICAL_HOST
+ACX_NONCANONICAL_TARGET
+
 # Skipdirs are removed silently.
 skipdirs=
 # Noconfigdirs are removed loudly.
@@ -1001,9 +1008,9 @@ if test "${build}" != "${host}" ; then
   # If we are doing a Canadian Cross, in which the host and build systems
   # are not the same, we set reasonable default values for the tools.
 
-  CC=${CC-${host_alias}-gcc}
+  CC=${CC-${host_noncanonical}-gcc}
   CFLAGS=${CFLAGS-"-g -O2"}
-  CXX=${CXX-${host_alias}-c++}
+  CXX=${CXX-${host_noncanonical}-c++}
   CXXFLAGS=${CXXFLAGS-"-g -O2"}
   CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
 
@@ -1487,7 +1494,7 @@ if test x"${with_headers}" != x && test 
     "") x=${prefix} ;;
     *) x=${exec_prefix} ;;
     esac
-    copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include"
+    copy_dirs="${copy_dirs} ${with_headers} $x/${target_noncanonical}/sys-include"
   fi
 fi
 
@@ -1507,7 +1514,7 @@ if test x"${with_libs}" != x && test x"$
     *) x=${exec_prefix} ;;
     esac
     for l in ${with_libs}; do
-      copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}"
+      copy_dirs="$l $x/${target_noncanonical}/lib ${copy_dirs}"
     done
   fi
 fi
@@ -1704,7 +1711,7 @@ esac
 
 # Some systems (e.g., one of the i386-aix systems the gas testers are
 # using) don't handle "\$" correctly, so don't use it here.
-tooldir='${exec_prefix}'/${target_alias}
+tooldir='${exec_prefix}'/${target_noncanonical}
 build_tooldir=${tooldir}
 
 # Create a .gdbinit file which runs the one in srcdir
@@ -1968,40 +1975,86 @@ serialization_dependencies=serdep.tmp
 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.  Also strip program-prefix, program-suffix,
-# and program-transform-name, so that we can pass down a consistent
-# program-transform-name.  If autoconf has put single quotes around
-# any of these arguments (because they contain shell metacharacters)
-# then this will fail; in practice this only happens for
-# --program-transform-name, so be sure to override --program-transform-name
-# at the end of the argument list.
-# These will be expanded by make, so quote '$'.
-cat <<\EOF_SED > conftestsed
-s/ --no[[^ ]]*/ /g
-s/ --c[[a-z-]]*[[= ]][[^ ]]*//g
-s/ --sr[[a-z-]]*[[= ]][[^ ]]*//g
-s/ --ho[[a-z-]]*[[= ]][[^ ]]*//g
-s/ --bu[[a-z-]]*[[= ]][[^ ]]*//g
-s/ --t[[a-z-]]*[[= ]][[^ ]]*//g
-s/ --program-[[pst]][[a-z-]]*[[= ]][[^ ]]*//g
-s/ -cache-file[[= ]][[^ ]]*//g
-s/ -srcdir[[= ]][[^ ]]*//g
-s/ -host[[= ]][[^ ]]*//g
-s/ -build[[= ]][[^ ]]*//g
-s/ -target[[= ]][[^ ]]*//g
-s/ -program-prefix[[= ]][[^ ]]*//g
-s/ -program-suffix[[= ]][[^ ]]*//g
-s/ -program-transform-name[[= ]][[^ ]]*//g
-s/ [[^' -][^ ]*] / /
-s/^ *//;s/ *$//
-s,\$,$$,g
-EOF_SED
-sed -f conftestsed <<EOF_SED > conftestsed.out
- ${ac_configure_args} 
-EOF_SED
-baseargs=`cat conftestsed.out`
-rm -f conftestsed conftestsed.out
+# target, nonopt, and variable assignments.  These are the ones we
+# might not want to pass down to subconfigures.  Also strip
+# program-prefix, program-suffix, and program-transform-name, so that
+# we can pass down a consistent program-transform-name.
+baseargs=
+keep_next=no
+skip_next=no
+eval "set -- $ac_configure_args"
+for ac_arg; do
+  if test X"$skip_next" = X"yes"; then
+    skip_next=no
+    continue
+  fi
+  if test X"$keep_next" = X"yes"; then
+    case $ac_arg in
+      *\'*)
+	ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    baseargs="$baseargs '$ac_arg'"
+    keep_next=no
+    continue
+  fi
+
+  # Handle separated arguments.  Based on the logic generated by
+  # autoconf 2.59.
+  case $ac_arg in
+    *=* | --config-cache | -C | -disable-* | --disable-* \
+      | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+      | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+      | -with-* | --with-* | -without-* | --without-* | --x)
+      separate_arg=no
+      ;;
+    -*)
+      separate_arg=yes
+      ;;
+    *)
+      separate_arg=no
+      ;;
+  esac
+
+  case "$ac_arg" in
+    --no*)
+      continue
+      ;;
+    --c* | \
+    --sr* | \
+    --ho* | \
+    --bu* | \
+    --t* | \
+    --program-* | \
+    -cache_file* | \
+    -srcdir* | \
+    -host* | \
+    -build* | \
+    -target* | \
+    -program-prefix* | \
+    -program-suffix* | \
+    -program-transform-name* )
+      skip_next=$separate_arg
+      continue
+      ;;
+    -*)
+      # An option.  Add it.
+      case $ac_arg in
+	*\'*)
+	  ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+      esac
+      baseargs="$baseargs '$ac_arg'"
+      keep_next=$separate_arg
+      ;;
+    *)
+      # Either a variable assignment, or a nonopt (triplet).  Don't
+      # pass it down; let the Makefile handle this.
+      continue
+      ;;
+  esac
+done
+# Remove the initial space we just introduced and, as these will be
+# expanded by make, quote '$'.
+baseargs=`echo "x$baseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
 
 # Add in --program-transform-name, after --program-prefix and
 # --program-suffix have been applied to it.  Autoconf has already
@@ -2020,7 +2073,7 @@ baseargs="$baseargs --program-transform-
 # 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
 # desired.
-build_configargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} --target=${target_alias} ${baseargs}"
+build_configargs="--cache-file=../config.cache --build=${build_noncanonical} --host=${build_noncanonical} --target=${target_noncanonical} ${baseargs}"
 
 # For host modules, accept cache file option, or specification as blank.
 case "${cache_file}" in
@@ -2034,7 +2087,7 @@ esac
 
 # Host dirs don't like to share a cache file either, horribly enough.
 # This seems to be due to autoconf 2.5x stupidity.
-host_configargs="--cache-file=./config.cache --build=${build_alias} --host=${host_alias} --target=${target_alias} ${extra_host_args} ${baseargs}"
+host_configargs="--cache-file=./config.cache --build=${build_noncanonical} --host=${host_noncanonical} --target=${target_noncanonical} ${extra_host_args} ${baseargs}"
 
 target_configargs=${baseargs}
 
@@ -2044,7 +2097,7 @@ target_configargs=${baseargs}
 # sorts of decisions they want to make on this basis.  Please consider
 # this option to be deprecated.  FIXME.
 if test x${is_cross_compiler} = xyes ; then
-  target_configargs="--with-cross-host=${host_alias} ${target_configargs}"
+  target_configargs="--with-cross-host=${host_noncanonical} ${target_configargs}"
 fi
 
 # Default to --enable-multilib.
@@ -2070,7 +2123,7 @@ fi
 # Pass the appropriate --build, --host, --target and --cache-file arguments.
 # We need to pass --target, as newer autoconf's requires consistency
 # for target_alias and gcc doesn't manage it consistently.
-target_configargs="--cache-file=./config.cache --build=${build_alias} --host=${target_alias} --target=${target_alias} ${target_configargs}"
+target_configargs="--cache-file=./config.cache --build=${build_noncanonical} --host=${target_noncanonical} --target=${target_noncanonical} ${target_configargs}"
 
 FLAGS_FOR_TARGET=
 case " $target_configdirs " in


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