diff --git a/Rakefile b/Rakefile index 8d50ce494..ced0c2a61 100755 --- a/Rakefile +++ b/Rakefile @@ -96,7 +96,7 @@ def setup_globals ldflags_extra = c?(:MINGW) ? '' : "-Wl,--enable-auto-import" $flags = { :cflags => "#{cflags_common} #{c(:USER_CFLAGS)}", - :cxxflags => "#{cflags_common} #{c(:STD_CXX0X)} -Wnon-virtual-dtor -Woverloaded-virtual -Wextra #{c(:WXWIDGETS_CFLAGS)} #{c(:QT_CFLAGS)} #{c(:BOOST_CPPFLAGS)} #{c(:CURL_CFLAGS)} #{c(:USER_CXXFLAGS)}", + :cxxflags => "#{cflags_common} #{c(:STD_CXX11)} -Wnon-virtual-dtor -Woverloaded-virtual -Wextra #{c(:WXWIDGETS_CFLAGS)} #{c(:QT_CFLAGS)} #{c(:BOOST_CPPFLAGS)} #{c(:CURL_CFLAGS)} #{c(:USER_CXXFLAGS)}", :cppflags => "#{c(:USER_CPPFLAGS)}", :ldflags => "#{c(:EBML_LDFLAGS)} #{c(:MATROSKA_LDFLAGS)} #{c(:EXTRA_LDFLAGS)} #{c(:PROFILING_LIBS)} #{c(:USER_LDFLAGS)} #{c(:LDFLAGS_RPATHS)} #{c(:BOOST_LDFLAGS)}", :windres => c?(:USE_WXWIDGETS) ? c(:WXWIDGETS_INCLUDES) : '-DNOWXWIDGETS', diff --git a/ac/c++11.m4 b/ac/c++11.m4 index 4b24dfa77..bfdbec2ba 100644 --- a/ac/c++11.m4 +++ b/ac/c++11.m4 @@ -1,33 +1,36 @@ -AC_DEFUN([AX_CXX_STD_CXX0X_FLAG],[ - AC_CACHE_CHECK([for support for the "-std=c++0x" flag], [ax_cv_std_cxx0x_flag],[ +AC_DEFUN([AX_CXX_STD_CXX11_FLAG],[ + AC_CACHE_CHECK([for support for the "-std=c++11"/"-std=c++0x" flag], [ax_cv_std_cxx11_flag],[ CXXFLAGS_SAVED=$CXXFLAGS - CXXFLAGS="$CXXFLAGS -std=c++0x" + CXXFLAGS="$CXXFLAGS -std=c++11" export CXXFLAGS AC_LANG_PUSH(C++) - AC_TRY_COMPILE( - [], - [true;], - [ax_cv_std_cxx0x_flag="yes"], - [ax_cv_std_cxx0x_flag="no"]) - AC_LANG_POP + AC_TRY_COMPILE([], [true;], [ax_cv_std_cxx11_flag="-std=c++11"], [ax_cv_std_cxx11_flag="undecided"]) + + if test x"$ax_cv_std_cxx11_flag" = xundecided ; then + CXXFLAGS="$CXXFLAGS_SAVED -std=c++0x" + AC_TRY_COMPILE([], [true;], [ax_cv_std_cxx11_flag="-std=c++0x"], [ax_cv_std_cxx11_flag="no"]) + fi + + AC_LANG_POP CXXFLAGS="$CXXFLAGS_SAVED" ]) - STD_CXX0X="" - if test x"$ax_cv_std_cxx0x_flag" = xyes ; then - STD_CXX0X=-std=c++0x + STD_CXX11="" + if test x"$ax_cv_std_cxx11_flag" != xno ; then + STD_CXX11=$ax_cv_std_cxx11_flag fi - AC_SUBST(STD_CXX0X) + + AC_SUBST(STD_CXX11) ]) AC_DEFUN([AX_CXX11_INITIALIZER_LISTS],[ AC_CACHE_CHECK([for support for C++11 feature "initializer lists"], [ax_cv_cxx11_initializer_lists],[ CXXFLAGS_SAVED=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $STD_CXX0X" + CXXFLAGS="$CXXFLAGS $STD_CXX11" export CXXFLAGS AC_LANG_PUSH(C++) @@ -53,7 +56,7 @@ AC_DEFUN([AX_CXX11_RANGE_BASED_FOR],[ AC_CACHE_CHECK([for support for C++11 feature "range-based 'for'"], [ax_cv_cxx11_range_based_for],[ CXXFLAGS_SAVED=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $STD_CXX0X" + CXXFLAGS="$CXXFLAGS $STD_CXX11" export CXXFLAGS AC_LANG_PUSH(C++) @@ -83,7 +86,7 @@ AC_DEFUN([AX_CXX11_RIGHT_ANGLE_BRACKETS],[ AC_CACHE_CHECK([for support for C++11 feature "right angle brackets"], [ax_cv_cxx11_right_angle_brackets],[ CXXFLAGS_SAVED=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $STD_CXX0X" + CXXFLAGS="$CXXFLAGS $STD_CXX11" export CXXFLAGS AC_LANG_PUSH(C++) @@ -111,7 +114,7 @@ AC_DEFUN([AX_CXX11_AUTO_KEYWORD],[ AC_CACHE_CHECK([for support for C++11 feature "'auto' keyword"], [ax_cv_cxx11_auto_keyword],[ CXXFLAGS_SAVED=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $STD_CXX0X" + CXXFLAGS="$CXXFLAGS $STD_CXX11" export CXXFLAGS AC_LANG_PUSH(C++) @@ -140,7 +143,7 @@ AC_DEFUN([AX_CXX11_LAMBDA_FUNCTIONS],[ AC_CACHE_CHECK([for support for C++11 feature "lambda functions"], [ax_cv_cxx11_lambda_functions],[ CXXFLAGS_SAVED=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $STD_CXX0X" + CXXFLAGS="$CXXFLAGS $STD_CXX11" export CXXFLAGS AC_LANG_PUSH(C++) @@ -170,7 +173,7 @@ AC_DEFUN([AX_CXX11_NULLPTR],[ AC_CACHE_CHECK([for support for C++11 feature "nullptr"], [ax_cv_cxx11_nullptr],[ CXXFLAGS_SAVED=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $STD_CXX0X" + CXXFLAGS="$CXXFLAGS $STD_CXX11" export CXXFLAGS AC_LANG_PUSH(C++) @@ -193,7 +196,7 @@ AC_DEFUN([AX_CXX11_TUPLES],[ AC_CACHE_CHECK([for support for C++11 feature "tuples"], [ax_cv_cxx11_tuples],[ CXXFLAGS_SAVED=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $STD_CXX0X" + CXXFLAGS="$CXXFLAGS $STD_CXX11" export CXXFLAGS AC_LANG_PUSH(C++) @@ -219,7 +222,7 @@ dnl AC_DEFUN([AX_CXX11_DEF_NAME],[ dnl AC_CACHE_CHECK([for support for C++11 feature "human"], [ax_cv_cxx11_def_name],[ dnl dnl CXXFLAGS_SAVED=$CXXFLAGS -dnl CXXFLAGS="$CXXFLAGS $STD_CXX0X" +dnl CXXFLAGS="$CXXFLAGS $STD_CXX11" dnl export CXXFLAGS dnl dnl AC_LANG_PUSH(C++) @@ -238,7 +241,7 @@ dnl missing_cxx11_features="$missing_cxx11_features\n * human" dnl fi dnl ]) -AX_CXX_STD_CXX0X_FLAG +AX_CXX_STD_CXX11_FLAG AX_CXX11_INITIALIZER_LISTS AX_CXX11_RANGE_BASED_FOR AX_CXX11_RIGHT_ANGLE_BRACKETS diff --git a/build-config.in b/build-config.in index a51691761..92ef8ded2 100644 --- a/build-config.in +++ b/build-config.in @@ -103,7 +103,7 @@ PROFILING_LIBS = @PROFILING_LIBS@ QT_CFLAGS = @QT_CFLAGS@ QT_LIBS = @QT_LIBS@ QUNUSED_ARGUMENTS = @QUNUSED_ARGUMENTS@ -STD_CXX0X = @STD_CXX0X@ +STD_CXX11 = @STD_CXX11@ USE_CLANG = @USE_CLANG@ USE_PRECOMPILED_HEADERS = @USE_PRECOMPILED_HEADERS@ USER_CPPFLAGS = @USER_CPPFLAGS@