Fix compilation of build/*.o when using C++.
authorDiego Novillo <dnovillo@google.com>
Thu, 31 May 2012 17:25:41 +0000 (13:25 -0400)
committerDiego Novillo <dnovillo@gcc.gnu.org>
Thu, 31 May 2012 17:25:41 +0000 (13:25 -0400)
Found this while testing the C++ conversion for vec.[ch] on the
cxx-conversion branch.  We do not build the build/*.o files with g++,
so I was getting lots of syntax errors while compiling build/vec.o.

2012-05-31   Diego Novillo  <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.

From-SVN: r188069

gcc/ChangeLog
gcc/Makefile.in
gcc/configure
gcc/configure.ac

index a2c5d69..c63e3c0 100644 (file)
@@ -1,3 +1,15 @@
+2012-05-31   Diego Novillo  <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.
+
 2012-05-31  Steven Bosscher  <steven@gcc.gnu.org>
 
        * Makefile.in: Fix many dependencies.
index 53f4980..b36818d 100644 (file)
@@ -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@
index 1cd6134..1fdf0af 100755 (executable)
@@ -703,7 +703,9 @@ LIBTOOL
 collect2
 STMP_FIXINC
 BUILD_LDFLAGS
+BUILD_CXXFLAGS
 BUILD_CFLAGS
+CXX_FOR_BUILD
 CC_FOR_BUILD
 inhibit_libc
 SYSTEM_HEADER_DIR
@@ -11835,7 +11837,9 @@ fi
 
 # These are the normal (build=host) settings:
 CC_FOR_BUILD='$(CC)'
+CXX_FOR_BUILD='$(CXX)'
 BUILD_CFLAGS='$(ALL_CFLAGS)'
+BUILD_CXXFLAGS='$(ALL_CXXFLAGS)'
 BUILD_LDFLAGS='$(LDFLAGS)'
 STMP_FIXINC=stmp-fixinc
 
@@ -17967,7 +17971,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17970 "configure"
+#line 17974 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18073,7 +18077,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18076 "configure"
+#line 18080 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index a3a4038..22dab55 100644 (file)
@@ -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)