diff options
author | Alexandre Oliva <oliva@adacore.com> | 2018-11-20 00:07:47 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2018-11-20 00:07:47 +0000 |
commit | f4c53af18b727109faac7203eeb192bbbac2903d (patch) | |
tree | 44ef6ef0fd997ec5a8a98c4e447f94a4e7823ae2 /gnattools | |
parent | 502e897d1afa16df33326d255120d7cd15df9363 (diff) | |
download | gcc-f4c53af18b727109faac7203eeb192bbbac2903d.tar.gz |
PR81878: fix --disable-bootstrap --enable-languages=ada
gnattools build machinery uses just-build xgcc and xg++ as $(CC) and
$(CXX) in native builds. However, if C and C++ languages are not
enabled, it won't find them. So, enable C and C++ if Ada is enabled.
Most of the time, this is probably no big deal: C is always enabled
anyway, and C++ is already enabled for bootstraps.
We need not enable those for cross builds, however. At first I just
took the logic from gnattools/configure, but found it to be lacking:
it would use the just-built tools even in cross-back settings, whose
tools just built for the host would not run on the build machine. So
I've narrowed down the test to rely on autoconf-detected cross-ness
(build->host only), but also to ensure that host matches build, and
that target matches host.
I've considered sourcing ada/config-lang.in from within
gnattools/configure, and testing lang_requires as set by it, so as to
avoid a duplication of tests that ought to remain in sync, but decided
it would be too fragile, as ada/config-lang.in does not expect srcdir
to refer to gnattools.
for gcc/ada/ChangeLog
PR ada/81878
* gcc-interface/config-lang.in (lang_requires): Set to "c c++"
when gnattools wants it.
for gnattools/ChangeLog
PR ada/81878
* configure.ac (default_gnattools_target): Do not mistake
just-built host tools as native in cross-back toolchains.
* configure: Rebuilt.
From-SVN: r266290
Diffstat (limited to 'gnattools')
-rw-r--r-- | gnattools/ChangeLog | 7 | ||||
-rwxr-xr-x | gnattools/configure | 32 | ||||
-rw-r--r-- | gnattools/configure.ac | 30 |
3 files changed, 50 insertions, 19 deletions
diff --git a/gnattools/ChangeLog b/gnattools/ChangeLog index ca75cf00234..144cce05964 100644 --- a/gnattools/ChangeLog +++ b/gnattools/ChangeLog @@ -1,3 +1,10 @@ +2018-11-19 Alexandre Oliva <oliva@adacore.com> + + PR ada/81878 + * configure.ac (default_gnattools_target): Do not mistake + just-built host tools as native in cross-back toolchains. + * configure: Rebuilt. + 2018-11-06 Eric Botcazou <ebotcazou@adacore.com> PR ada/81878 diff --git a/gnattools/configure b/gnattools/configure index ccb512e39b6..c2d755b723a 100755 --- a/gnattools/configure +++ b/gnattools/configure @@ -584,6 +584,7 @@ PACKAGE_URL= ac_unique_file="Makefile.in" ac_subst_vars='LTLIBOBJS LIBOBJS +default_gnattools_target warn_cflags OBJEXT EXEEXT @@ -595,7 +596,6 @@ CC ADA_CFLAGS EXTRA_GNATTOOLS TOOLS_TARGET_PAIRS -default_gnattools_target LN_S target_noncanonical host_noncanonical @@ -2050,15 +2050,6 @@ $as_echo "no, using $LN_S" >&6; } fi -# Determine what to build for 'gnattools' -if test $build = $target ; then - # Note that build=target is almost certainly the wrong test; FIXME - default_gnattools_target="gnattools-native" -else - default_gnattools_target="gnattools-cross" -fi - - # Target-specific stuff (defaults) TOOLS_TARGET_PAIRS= @@ -2134,6 +2125,8 @@ esac # From user or toplevel makefile. +# This is testing the CC passed from the toplevel Makefile, not the +# one we will select below. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2929,6 +2922,25 @@ if test "x$GCC" = "xyes"; then fi +# Determine what to build for 'gnattools'. Test after the above, +# because testing for CC sets the final value of cross_compiling, even +# if we end up using a different CC. We want to build +# gnattools-native when: (a) this is a native build, i.e., +# cross_compiling=no, otherwise we know we cannot run binaries +# produced by the toolchain used for the build, not even the binaries +# created within ../gcc/; (b) build and host are the same, otherwise +# this is to be regarded as a cross build environment even if it seems +# that we can run host binaries; (c) host and target are the same, +# otherwise the tools in ../gcc/ generate code for a different +# platform. If you change this test, be sure to adjust +# ../gcc/ada/gcc-interface/config-lang.in as well. +if test "x$cross_compiling/$build/$host" = "xno/$host/$target" ; then + default_gnattools_target="gnattools-native" +else + default_gnattools_target="gnattools-cross" +fi + + # Output: create a Makefile. ac_config_files="$ac_config_files Makefile" diff --git a/gnattools/configure.ac b/gnattools/configure.ac index 0a94224a536..40d015ce8b0 100644 --- a/gnattools/configure.ac +++ b/gnattools/configure.ac @@ -51,15 +51,6 @@ ACX_NONCANONICAL_TARGET # Need to pass this down for now :-P AC_PROG_LN_S -# Determine what to build for 'gnattools' -if test $build = $target ; then - # Note that build=target is almost certainly the wrong test; FIXME - default_gnattools_target="gnattools-native" -else - default_gnattools_target="gnattools-cross" -fi -AC_SUBST([default_gnattools_target]) - # Target-specific stuff (defaults) TOOLS_TARGET_PAIRS= AC_SUBST(TOOLS_TARGET_PAIRS) @@ -135,6 +126,8 @@ esac # From user or toplevel makefile. AC_SUBST(ADA_CFLAGS) +# This is testing the CC passed from the toplevel Makefile, not the +# one we will select below. AC_PROG_CC warn_cflags= if test "x$GCC" = "xyes"; then @@ -142,6 +135,25 @@ if test "x$GCC" = "xyes"; then fi AC_SUBST(warn_cflags) +# Determine what to build for 'gnattools'. Test after the above, +# because testing for CC sets the final value of cross_compiling, even +# if we end up using a different CC. We want to build +# gnattools-native when: (a) this is a native build, i.e., +# cross_compiling=no, otherwise we know we cannot run binaries +# produced by the toolchain used for the build, not even the binaries +# created within ../gcc/; (b) build and host are the same, otherwise +# this is to be regarded as a cross build environment even if it seems +# that we can run host binaries; (c) host and target are the same, +# otherwise the tools in ../gcc/ generate code for a different +# platform. If you change this test, be sure to adjust +# ../gcc/ada/gcc-interface/config-lang.in as well. +if test "x$cross_compiling/$build/$host" = "xno/$host/$target" ; then + default_gnattools_target="gnattools-native" +else + default_gnattools_target="gnattools-cross" +fi +AC_SUBST([default_gnattools_target]) + # Output: create a Makefile. AC_CONFIG_FILES([Makefile]) |