Bug 933047 - Add a configure check whether the C++ compiler actually is a C++ compiler. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 01 Nov 2013 10:30:46 +0900
changeset 152932 cb728c8c416ed0face711f2ae3c8203cb4e1a64b
parent 152931 a9dda9a1bfa24273b79dfc6f3b3babe975ee7176
child 152933 8a236c59b0f0bb2b4c487653a0e95a20fad1b826
push id35636
push usermh@glandium.org
push dateFri, 01 Nov 2013 01:38:56 +0000
treeherdermozilla-inbound@8a236c59b0f0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs933047
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 933047 - Add a configure check whether the C++ compiler actually is a C++ compiler. r=ted
build/autoconf/compiler-opts.m4
js/src/build/autoconf/compiler-opts.m4
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -187,16 +187,28 @@ if test "$CLANG_CXX"; then
     ## from C.
     ##
     ## mismatched-tags is disabled (bug 780474) mostly because it's useless.
     ## Worse, it's not supported by gcc, so it will cause tryserver bustage
     ## without any easy way for non-Clang users to check for it.
     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-mismatched-tags"
 fi
 
+AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) actually is a C++ compiler])
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+_SAVE_LIBS=$LIBS
+LIBS=
+AC_TRY_LINK([#include <new>], [int *foo = new int;],,
+            AC_MSG_RESULT([no])
+            AC_MSG_ERROR([$CXX $CXXFLAGS $LDFLAGS failed to compile and link a simple C++ source.]))
+LIBS=$_SAVE_LIBS
+AC_LANG_RESTORE
+AC_MSG_RESULT([yes])
+
 if test -z "$GNU_CC"; then
     case "$target" in
     *-mingw*)
         ## Warning 4099 (equivalent of mismatched-tags) is disabled (bug 780474)
         ## for the same reasons as above.
         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -wd4099"
     esac
 fi
--- a/js/src/build/autoconf/compiler-opts.m4
+++ b/js/src/build/autoconf/compiler-opts.m4
@@ -187,16 +187,28 @@ if test "$CLANG_CXX"; then
     ## from C.
     ##
     ## mismatched-tags is disabled (bug 780474) mostly because it's useless.
     ## Worse, it's not supported by gcc, so it will cause tryserver bustage
     ## without any easy way for non-Clang users to check for it.
     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-mismatched-tags"
 fi
 
+AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) actually is a C++ compiler])
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+_SAVE_LIBS=$LIBS
+LIBS=
+AC_TRY_LINK([#include <new>], [int *foo = new int;],,
+            AC_MSG_RESULT([no])
+            AC_MSG_ERROR([$CXX $CXXFLAGS $LDFLAGS failed to compile and link a simple C++ source.]))
+LIBS=$_SAVE_LIBS
+AC_LANG_RESTORE
+AC_MSG_RESULT([yes])
+
 if test -z "$GNU_CC"; then
     case "$target" in
     *-mingw*)
         ## Warning 4099 (equivalent of mismatched-tags) is disabled (bug 780474)
         ## for the same reasons as above.
         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -wd4099"
     esac
 fi