I was hoping for a reply from someone who could OK the previous patches
submitted.  Admittedly, I didn't tick all the boxes (no changelog entry),
so here they are again.

The Makefile.in BUILD_CPPFLAGS change is for exactly the same reason
as my 2013-12-05 change.  When GMPINC points at an installed host gmp,
it results in picking up other host headers, which might be wrong for
the build machine.  We found this to be true even for very similar
build and host machines, in our case a powerpc64-linux build,
powerpc64le-linux host and target configuration, where differences in
glibc version between the build and host were enough to cause errors.

The configure.ac change is to fix a bug Bernd found when gmp is
in-tree but not installed.  In that case the recursive configure fails
due to system.h wanting to include gmp.h and not finding it:

/* Do not introduce a gmp.h dependency on the build system.  */
#ifndef GENERATOR_FILE
#include <gmp.h>
#endif

So, define GENERATOR_FILE for configure as we do when actually running
the build compiler.  The other changes are for consistency, but are
not strictly necessary.  I left them in this patch because they make
sense to me, and that's the way both Bernd and I tested this patch.

OK for mainline?

Bernd, if this isn't approved then I'll revert my previous change.
I believe I can do that without approval.

        * Makefile.in (BUILD_CPPFLAGS): Do not use ALL_CPPFLAGS.
        * configure.ac <recursive call for build != host>: Define
        GENERATOR_FILE.  Comment.  Use CXX_FOR_BUILD, CXXFLAGS_FOR_BUILD
        and LD_FOR_BUILD too.
        * configure: Regenerate.

Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in     (revision 206915)
+++ gcc/Makefile.in     (working copy)
@@ -761,7 +761,8 @@
 
 # Native linker and preprocessor flags.  For x-fragment overrides.
 BUILD_LDFLAGS=@BUILD_LDFLAGS@
-BUILD_CPPFLAGS=$(ALL_CPPFLAGS)
+BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
+               -I$(srcdir)/../include $(CPPINC)
 
 # Actual name to use when installing a native compiler.
 GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac    (revision 206915)
+++ gcc/configure.ac    (working copy)
@@ -1529,8 +1529,13 @@
        /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};;
        *) realsrcdir=../${srcdir};;
        esac
+       # Clearing GMPINC is necessary to prevent host headers being
+       # used by the build compiler.  Defining GENERATOR_FILE stops
+       # system.h from including gmp.h.
        CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
-       LDFLAGS="${LDFLAGS_FOR_BUILD}" GMPINC="" \
+       CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
+       LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
+       GMPINC="" CPPFLAGS="${CPPFLAGS} -DGENERATOR_FILE" \
        ${realsrcdir}/configure \
                --enable-languages=${enable_languages-all} \
                --target=$target_alias --host=$build_alias --build=$build_alias


-- 
Alan Modra
Australia Development Lab, IBM

Reply via email to