diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-06-14 11:43:56 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-06-14 11:43:56 +0200 |
commit | 9d1d5475fdf28a459b8671472026b8a9d6c42370 (patch) | |
tree | 271fac288dc6290b5c0c565f387742d3dd012889 /configure.ac | |
parent | 2699cb7d324ffb1d2adc62e1f62434397aa39e2d (diff) |
Better check for c++11 support and fix for missing override/final keywords.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 17aae11..7934cc2 100644 --- a/configure.ac +++ b/configure.ac @@ -6,16 +6,58 @@ AM_INIT_AUTOMAKE AC_PROG_CXX AM_PROG_CC_C_O -dnl Compile with C++11 support. -#AX_CXX_COMPILE_STDCXX_11 -CXXFLAGS="$CXXFLAGS -std=c++0x" - LT_INIT AC_CONFIG_HEADERS(config.h) need_jack=no +dnl =========================== +dnl Compile with C++11 support. +dnl =========================== +AC_LANG_PUSH([C++]) +TMP_CXXFLAGS="$CXXFLAGS" +CXXFLAGS=-std=c++11 +AC_MSG_CHECKING([whether CXX supports -std=c++11]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes])], + [ + AC_MSG_RESULT([no]) + CXXFLAGS=-std=c++0x + AC_MSG_CHECKING([whether CXX supports -std=c++0x]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes])], + [ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Compiler does not support c++11]) + ] + ) +] +) +CXXFLAGS="$TMP_CXXFLAGS $CXXFLAGS" +AC_LANG_POP([C++]) + +dnl =========================== +dnl Check for override /final keywords support +dnl =========================== +AC_LANG_PUSH([C++]) +AC_MSG_CHECKING([whether 'override' and 'final' keywords are supported]) +AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [ + class A { virtual void foo() {} }; + class B : public A { virtual void foo() override {} }; + class C : public B { virtual void foo() final {} }; + ] + ) + ], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no (deploying fix)]) + CXXFLAGS="$CXXFLAGS -Doverride=\"\" -Dfinal=\"\"" + ] +) +AC_LANG_POP([C++]) + dnl ====================== dnl Init pkg-config dnl ====================== |