diff --git a/configure b/configure index 5066557ad..3002675a0 100755 --- a/configure +++ b/configure @@ -10068,9 +10068,12 @@ fi # The C++ compiler, if desired. -# The following test is quick and harmless. -# It defaults to 'g++' if no compiler is found. -ac_ext=cpp +# Now actually check that the C++ compiler works if it is needed. +want_cxx=no +if test $enable_cxx != no; then + test_CXXFLAGS=${CXXFLAGS+set} + + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' @@ -10328,11 +10331,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -# Now actually check that the C++ compiler works if it is needed. -want_cxx=no -if test $enable_cxx != no; then - test_CXXFLAGS=${CXXFLAGS+set} - echo "CXXFLAGS chosen by autoconf: $CXXFLAGS" >&5 cxxflags_ac_prog_cxx=$CXXFLAGS cxxflags_list=ac_prog_cxx diff --git a/configure.ac b/configure.ac index eaaa903f3..ffbe46a44 100644 --- a/configure.ac +++ b/configure.ac @@ -1753,15 +1753,13 @@ AC_SUBST(MPIR_AS) # The C++ compiler, if desired. -# The following test is quick and harmless. -# It defaults to 'g++' if no compiler is found. -AC_PROG_CXX - # Now actually check that the C++ compiler works if it is needed. want_cxx=no if test $enable_cxx != no; then test_CXXFLAGS=${CXXFLAGS+set} + AC_PROG_CXX + echo "CXXFLAGS chosen by autoconf: $CXXFLAGS" >&AC_FD_CC cxxflags_ac_prog_cxx=$CXXFLAGS cxxflags_list=ac_prog_cxx