diff gnattools/configure.ac @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
line wrap: on
line diff
--- a/gnattools/configure.ac	Thu Oct 25 07:37:49 2018 +0900
+++ b/gnattools/configure.ac	Thu Feb 13 11:34:05 2020 +0900
@@ -19,7 +19,6 @@
 sinclude(../config/override.m4)
 
 AC_INIT
-AC_PREREQ([2.64])
 
 AC_CONFIG_SRCDIR([Makefile.in])
 
@@ -52,15 +51,6 @@
 # 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)
@@ -136,6 +126,8 @@
 # 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
@@ -143,6 +135,25 @@
 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])