diff --git a/configure.in b/configure.in index 52074f8e715..fad2fef4fd5 100644 --- a/configure.in +++ b/configure.in @@ -2735,10 +2735,11 @@ else AC_MSG_RESULT(no) fi -dnl Check whether gcc's c++0x mode works +dnl Check whether we can use gcc's c++0x mode AC_LANG_CPLUSPLUS if test "$GNU_CXX"; then + _SAVE_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS -std=gnu++0x" AC_CACHE_CHECK(for gcc c++0x headers bug without rtti, @@ -2756,10 +2757,10 @@ if test "$GNU_CXX"; then ac_cv_cxx0x_clang_workaround="no")]) if test "ac_cv_cxx0x_clang_workaround" = "no"; then - AC_MSG_ERROR([Your toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain]) + CXXFLAGS="$_SAVE_CXXFLAGS" fi elif test "$ac_cv_cxx0x_headers_bug" = "yes"; then - AC_MSG_ERROR([Your toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain]) + CXXFLAGS="$_SAVE_CXXFLAGS" fi fi diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 7fafa7451be..87984986de0 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -510,7 +510,7 @@ JS_CONFIG_SUBSTITUTIONS=\ -DMOZJS_ALPHA="$(MOZJS_ALPHA)" \ -DNSPR_CFLAGS="$(NSPR_CFLAGS)" \ -DNSPR_PKGCONF_CHECK="$(NSPR_PKGCONF_CHECK)" \ - $(NULL) + -DUSE_CXX11="$(USE_CXX11)" $(JS_CONFIG_NAME): js-config.in Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk $(topsrcdir)/config/rules.mk $(RM) $@.tmp diff --git a/js/src/configure.in b/js/src/configure.in index 90c4ec3a383..c437adabd8e 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -2347,11 +2347,13 @@ else AC_MSG_RESULT(no) fi -dnl Check whether gcc's c++0x mode works +dnl Check whether we can use gcc's c++0x mode AC_LANG_CPLUSPLUS if test "$GNU_CXX"; then + _SAVE_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS -std=gnu++0x" + USE_CXX11=1 AC_CACHE_CHECK(for gcc c++0x headers bug without rtti, ac_cv_cxx0x_headers_bug, @@ -2368,10 +2370,12 @@ if test "$GNU_CXX"; then ac_cv_cxx0x_clang_workaround="no")]) if test "ac_cv_cxx0x_clang_workaround" = "no"; then - AC_MSG_ERROR([Your toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain]) + CXXFLAGS="$_SAVE_CXXFLAGS" + USE_CXX11= fi elif test "$ac_cv_cxx0x_headers_bug" = "yes"; then - AC_MSG_ERROR([Your toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain]) + CXXFLAGS="$_SAVE_CXXFLAGS" + USE_CXX11= fi fi @@ -4270,6 +4274,7 @@ AC_SUBST(OS_TEST) AC_SUBST(CPU_ARCH) AC_SUBST(INTEL_ARCHITECTURE) +AC_SUBST(USE_CXX11) AC_SUBST(WRAP_LDFLAGS) AC_SUBST(MKSHLIB) AC_SUBST(MKCSHLIB) diff --git a/js/src/js-config.in b/js/src/js-config.in index 505615b0921..cf0d867c44f 100644 --- a/js/src/js-config.in +++ b/js/src/js-config.in @@ -109,7 +109,11 @@ if test "$echo_libdir" = "yes"; then fi if test "$echo_cflags" = "yes"; then - echo "-std=gnu++0x -include $includedir/$LIBRARY_NAME/js/RequiredDefines.h -I$includedir/$LIBRARY_NAME $NSPR_CFLAGS" + cflags="-include $includedir/$LIBRARY_NAME/js/RequiredDefines.h -I$includedir/$LIBRARY_NAME $NSPR_CFLAGS" + if test '@USE_CXX11@' = "1"; then + cflags="$cflags -std=gnu++0x" + fi + echo $cflags fi if test "$echo_libs" = "yes"; then