This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Use C++ in COMPILER_FOR_BUILD if needed (issue6191056)


On 12-05-30 13:42 , DJ Delorie wrote:

  BUILD_CFLAGS= @BUILD_CFLAGS@ -DGENERATOR_FILE
+BUILD_CXXFLAGS = $(INTERNAL_CFLAGS) $(CXXFLAGS) -DGENERATOR_FILE

Why are these so different?


The rest seem OK

Ah, I missed adding BUILD_CXXFLAGS to configure.ac. Thanks.


OK to commit this amended patch?

2012-05-31 <dnovillo@google.com>

        * configure.ac (CXX_FOR_BUILD): Define and substitute.
        (BUILD_CXXFLAGS): Define and substitute.
        * Makefile.in (BUILD_CXXFLAGS): Define.
        (CXX_FOR_BUILD): Define.
        (COMPILER_FOR_BUILD): Set to CXX_FOR_BUILD if building with C++.
        (LINKER_FOR_BUILD): Likewise.
        (BUILD_COMPILERFLAGS): Set to BUILD_CXXFLAGS if building with C++.
        (BUILD_LINKERFLAGS): Likewise.
        * configure: Regenerate.

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 7b61b71..502cde8 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -728,15 +728,27 @@ DIR = ../gcc

 # Native compiler for the build machine and its switches.
 CC_FOR_BUILD = @CC_FOR_BUILD@
+CXX_FOR_BUILD = @CXX_FOR_BUILD@
 BUILD_CFLAGS= @BUILD_CFLAGS@ -DGENERATOR_FILE
+BUILD_CXXFLAGS = @BUILD_CXXFLAGS@ -DGENERATOR_FILE

 # Native compiler that we use.  This may be C++ some day.
+ifneq ($(ENABLE_BUILD_WITH_CXX),yes)
 COMPILER_FOR_BUILD = $(CC_FOR_BUILD)
 BUILD_COMPILERFLAGS = $(BUILD_CFLAGS)
+else
+COMPILER_FOR_BUILD = $(CXX_FOR_BUILD)
+BUILD_COMPILERFLAGS = $(BUILD_CXXFLAGS)
+endif

 # Native linker that we use.
+ifneq ($(ENABLE_BUILD_WITH_CXX),yes)
 LINKER_FOR_BUILD = $(CC_FOR_BUILD)
 BUILD_LINKERFLAGS = $(BUILD_CFLAGS)
+else
+LINKER_FOR_BUILD = $(CXX_FOR_BUILD)
+BUILD_LINKERFLAGS = $(BUILD_CXXFLAGS)
+endif

 # Native linker and preprocessor flags.  For x-fragment overrides.
 BUILD_LDFLAGS=@BUILD_LDFLAGS@
diff --git a/gcc/configure.ac b/gcc/configure.ac
index a3a4038..0c55952 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1848,7 +1848,9 @@ AC_SUBST(inhibit_libc)

 # These are the normal (build=host) settings:
 CC_FOR_BUILD='$(CC)'           AC_SUBST(CC_FOR_BUILD)
+CXX_FOR_BUILD='$(CXX)'         AC_SUBST(CXX_FOR_BUILD)
 BUILD_CFLAGS='$(ALL_CFLAGS)'   AC_SUBST(BUILD_CFLAGS)
+BUILD_CXXFLAGS='$(ALL_CXXFLAGS)' AC_SUBST(BUILD_CXXFLAGS)
 BUILD_LDFLAGS='$(LDFLAGS)'     AC_SUBST(BUILD_LDFLAGS)
 STMP_FIXINC=stmp-fixinc                AC_SUBST(STMP_FIXINC)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]