This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch for Review: Allow Explicit CFLAGS_FOR_BUILD
- From: Mohan Embar <gnustuff at thisiscool dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: GCJ Patches <java-patches at gcc dot gnu dot org>
- Date: Sun, 05 Oct 2003 08:39:00 -0500
- Subject: Patch for Review: Allow Explicit CFLAGS_FOR_BUILD
- Reply-to: gnustuff at thisiscool dot com
Hi People,
This patch is the result of this issue:
http://article.gmane.org/gmane.comp.gnu.mingw.devel/760
Here is the relevant text from this post:
------------------------8<--------------------------
Building with -f-no-unit-at-a-time was problematic for my cross
build because the (i686-pc-linux-gnu,i686-pc-mingw32,i686-pc-mingw32)
build uses i686-pc-linux-gnu-gcc to build libiberty for the
build machine. I have gcc 3.2 on my Linux box, which
doesn't understand -f-no-unit-at-a-time, so the build choked.
I worked around this by commenting out this line in the
top-level gcc Makefile.in:
CFLAGS_FOR_BUILD = $(CFLAGS)
...and explicitly declaring a CFLAGS_FOR_BUILD in the shell
script which run configure which didn't have -f-no-unit-at-a-time:
export CFLAGS_FOR_BUILD="-O2 -g0 -pipe"
export CFLAGS="$CFLAGS_FOR_BUILD -fno-unit-at-a-time"
It seems to be a weakness in the configure process that for
a crossed-native build (build!=host, host=target), that CFLAGS_FOR_BUILD
(for libiberty) is doomed to be the same as the CFLAGS passed to
the cross compiler. Should I follow up on this?
------------------------8<--------------------------
This patch allows the explicit specification of CFLAGS_FOR_BUILD
to work around the issue where the flags to the build machine
compiler may not necessarily be the same as the flags to whatever
cross compiler is building the real compiler and its libraries.
What do you think? Please CC me personally as I am not subscribed
to gcc-patches.
-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/
ChangeLog
2003-10-05 Mohan Embar <gnustuff@thisiscool.com>
* configure.in: Allow explicit specification of CFLAGS_FOR_BUILD.
* configure: Rebuilt
* Makefile.tpl: Use CFLAGS_FOR_BUILD computed by configure
* Makefile.in: Rebuilt
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/configure.in,v
retrieving revision 1.258
diff -u -2 -r1.258 configure.in
--- configure.in 21 Sep 2003 19:32:22 -0000 1.258
+++ configure.in 5 Oct 2003 13:24:31 -0000
@@ -1920,4 +1920,8 @@
esac
+# Allow the user to override the flags for
+# our build compiler if desired.
+CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
+
# On Canadian crosses, we'll be searching the right directories for
# the previously-installed cross compiler, so don't bother to add
@@ -2061,4 +2065,5 @@
AC_SUBST(CXX)
AC_SUBST(CFLAGS)
+AC_SUBST(CFLAGS_FOR_BUILD)
AC_SUBST(CXXFLAGS)
AC_SUBST(DEFAULT_YACC)
Index: Makefile.tpl
===================================================================
RCS file: /cvs/gcc/gcc/Makefile.tpl,v
retrieving revision 1.72
diff -u -2 -r1.72 Makefile.tpl
--- Makefile.tpl 20 Sep 2003 21:16:09 -0000 1.72
+++ Makefile.tpl 5 Oct 2003 13:24:19 -0000
@@ -146,5 +146,5 @@
# environment.
CC_FOR_BUILD = @CC_FOR_BUILD@
-CFLAGS_FOR_BUILD = $(CFLAGS)
+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
CXX_FOR_BUILD = $(CXX)