aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2014-05-06 20:04:15 -0700
committerAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2014-05-06 20:27:08 -0700
commit6ced3888a697688b14dd51cccb5d847dc5d4823c (patch)
tree0628b96a9bcb203e785b0ccae13bd493776e73e2
parent65e9d82407dbab1c731d5f9dda891127f4284108 (diff)
downloadpaludis-6ced3888a697688b14dd51cccb5d847dc5d4823c.tar.gz
paludis-6ced3888a697688b14dd51cccb5d847dc5d4823c.tar.xz
build: be more lenient about compiler versioning
paludis does not use GNU extensions to C++, use the ISO standard C++11 mode. Attempt to use the -std=c++11 flag that GNU compatible C++ compilers support. Fallback to -std=c++0x in case the compiler is older and does not support the -std=c++11 flag. This makes the check more resilient to newer compilers as well as different compilers (e.g. clang).
-rw-r--r--configure.ac25
1 files changed, 5 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac
index 6bca8d1..fd070dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -422,25 +422,10 @@ AC_PREPROC_IFELSE([AC_LANG_SOURCE([
],
[AC_MSG_RESULT([no])])
-AC_MSG_CHECKING([whether we want -std=gnu++0x])
-AC_PREPROC_IFELSE([AC_LANG_SOURCE([
-#ifndef __GNUC__
-# error not gcc
-#endif
-
-#if __GNUC__ != 4
-# error not gcc 4
-#endif
-
-#if __GNUC_MINOR__ != 4 && __GNUC_MINOR__ != 5 && __GNUC_MINOR__ != 6 && __GNUC_MINOR__ != 7 && __GNUC_MINOR__ != 8
-# error not gcc 4.4 to 4.8
-#endif
-])],
- [AC_MSG_RESULT([yes])
- PALUDIS_CXXFLAGS="${PALUDIS_CXXFLAGS} -std=gnu++0x"
- PALUDIS_PC_CFLAGS="${PALUDIS_PC_CFLAGS} -std=gnu++0x"
- ],
- [AC_MSG_RESULT([no])])
+CHECK_CXXFLAG([-std=c++11])
+if test x"$cxxflag_success" = x"no" ; then
+ CHECK_CXXFLAG([-std=c++0x])
+fi
AC_MSG_CHECKING([whether we need -fno-deduce-init-list])
AC_PREPROC_IFELSE([AC_LANG_SOURCE([
@@ -477,7 +462,7 @@ extern template struct S<int>;
template struct S<int>;
])],
[AC_MSG_RESULT([yes])
- AC_MSG_CHECKING([whether c++0x 'extern template' works as we expect])
+ AC_MSG_CHECKING([whether c++11 'extern template' works as we expect])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
template <typename T_> struct B
{