]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gnattools/configure
PR81878: fix --disable-bootstrap --enable-languages=ada
[thirdparty/gcc.git] / gnattools / configure
index ccb512e39b6b4ae1e7960783e21ad48c51fec10e..c2d755b723a9b958c3d97b96393661d8f8487db9 100755 (executable)
@@ -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"