diff mbox

Use C++ in COMPILER_FOR_BUILD if needed (issue6191056)

Message ID 4FC75B08.7010705@google.com
State New
Headers show

Commit Message

Diego Novillo May 31, 2012, 11:50 a.m. UTC
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.

Comments

DJ Delorie May 31, 2012, 3:58 p.m. UTC | #1
> OK to commit this amended patch?

Ok.  Do we have a build-with-c++ FAQ page anywhere?  /me thinks it
will be useful soon ;-)
Diego Novillo May 31, 2012, 5:27 p.m. UTC | #2
On 12-05-31 11:58 , DJ Delorie wrote:
>> OK to commit this amended patch?
>
> Ok.

Thanks. Committed.

> Do we have a build-with-c++ FAQ page anywhere?  /me thinks it
> will be useful soon ;-)

Not yet.  If there are any FAQs, I propose adding them to 
http://gcc.gnu.org/wiki/cxx-conversion and then move them to the main 
FAQ page once the branch is merged.


Diego.
diff mbox

Patch

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)