Re: Updating top-level autoconf to 2.59

Daniel Jacobowitz
2007-02-08T22:20:33Z

On Wed, Feb 07, 2007 at 04:11:18PM -0500, DJ Delorie wrote:
>
> Daniel Jacobowitz <drow@false.org> writes:
> > Only a week late. I have lightly retested this on x86_64-pc-linux-gnu
> > native; I am willing to do any specific testing requested. OK to
> > commit, and what testing would you like to see first?
>
> Could you test Solaris or Cygwin? Preferably in a combined tree, or
> at least a gcc/binutils/newlib combo?
>
> A canadian cross would be nice too.

This patch is just like yesterday's, except that it does not suffer
from the naming problem associated with explicit --host and --target.

I tested yesterday's patch by bootstrapping all languages on
sparc-sun-solaris2.10.1 (well, almost. See if I ever volunteer to do
that again. It's still going through libjava).

I tested today's by building and installing C on x86_64-pc-linux-gnu
(with and without explicit --build/--host/--target), and building and
installing an x86_64-linux -> Windows -> ARM EABI combined tree for C
and C++.

In all cases I inspected the arguments passed to subdirectory
configures. They were the same except for replacement of s,x,x,
by s,y,y, in the "mostly native" case, as expected.

Is this OK?

Alexandre asked me to rename configure.in to configure.ac at the same
time as committing this; I'll do that too if approved. Yay for svn mv.

--
Daniel Jacobowitz
CodeSourcery

2007-02-08 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. Force program_transform_name for
native tools.
* Makefile.in: Regenerated.
* configure: Regenerated with autoconf 2.59.

Index: Makefile.tpl
===================================================================
--- Makefile.tpl (revision 121693)
+++ Makefile.tpl (working copy)
@@ -28,15 +28,15 @@ in
# -------------------------------
VPATH=@srcdir@

-build_alias=@build_alias@
+build_alias=@build_noncanonical@
build_vendor=@build_vendor@
build_os=@build_os@
build=@build@
-host_alias=@host_alias@
+host_alias=@host_noncanonical@
host_vendor=@host_vendor@
host_os=@host_os@
host=@host@
-target_alias=@target_alias@
+target_alias=@target_noncanonical@
target_vendor=@target_vendor@
target_os=@target_os@
target=@target@
Index: configure.in
===================================================================
--- configure.in (revision 121693)
+++ configure.in (working copy)
@@ -21,10 +21,27 @@
sinclude(config/acx.m4)

AC_INIT(move-if-change)
-AC_PREREQ(2.13)
+AC_PREREQ(2.59)
+
+# Find the build, host, and target systems.
+ACX_NONCANONICAL_BUILD
+ACX_NONCANONICAL_HOST
+ACX_NONCANONICAL_TARGET
+
+dnl Autoconf 2.5x and later will set a default program prefix if
+dnl --target was used, even if it was the same as --host. Disable
+dnl that behavior. This must be done before AC_CANONICAL_SYSTEM
+dnl to take effect.
+test "$host_noncanonical" = "$target_noncanonical" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_transform_name=s,y,y,
+
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
@@ -1016,9 +1033,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}

@@ -1584,7 +1601,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

@@ -1604,7 +1621,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
@@ -1804,7 +1821,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
@@ -2068,40 +2085,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
@@ -2144,7 +2207,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.