aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2015-06-10 17:50:27 -0400
committerMark H Weaver <mhw@netris.org>2015-06-10 17:50:27 -0400
commit14928016556300a6763334d4279c3d117902caaf (patch)
treed0dc262b14164b82f97dd6e896ca9e93a1fabeea /m4
parent1511e0235525358abb52cf62abeb9457605b5093 (diff)
parent57cd353d87d6e9e6e882327be70b4d7b5ce863ba (diff)
downloadpatches-14928016556300a6763334d4279c3d117902caaf.tar
patches-14928016556300a6763334d4279c3d117902caaf.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'm4')
-rw-r--r--m4/guix.m439
1 files changed, 39 insertions, 0 deletions
diff --git a/m4/guix.m4 b/m4/guix.m4
index 445ce857dd..fa5a4023ba 100644
--- a/m4/guix.m4
+++ b/m4/guix.m4
@@ -218,3 +218,42 @@ AC_DEFUN([GUIX_CHECK_FILE_NAME_LIMITS], [
AC_MSG_ERROR([store directory '$storedir' would lead to overly long hash-bang lines])
fi
])
+
+dnl GUIX_CHECK_CXX11
+dnl
+dnl Check whether the C++ compiler can compile a typical C++11 program.
+AC_DEFUN([GUIX_CHECK_CXX11], [
+ AC_REQUIRE([AC_PROG_CXX])
+ AC_CACHE_CHECK([whether $CXX supports C++11],
+ [ac_cv_guix_cxx11_support],
+ [save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="-std=c++11 $CXXFLAGS"
+ AC_COMPILE_IFELSE([
+ AC_LANG_SOURCE([
+ #include <functional>
+
+ std::function<int(int)>
+ return_plus_lambda (int x)
+ {
+ auto result = [[&]](int y) {
+ return x + y;
+ };
+
+ return result;
+ }
+ ])],
+ [ac_cv_guix_cxx11_support=yes],
+ [ac_cv_guix_cxx11_support=no])
+ CXXFLAGS="$save_CXXFLAGS"
+ ])
+])
+
+dnl GUIX_ASSERT_CXX11
+dnl
+dnl Error out if the C++ compiler cannot compile C++11 code.
+AC_DEFUN([GUIX_ASSERT_CXX11], [
+ GUIX_CHECK_CXX11
+ if test "x$ac_cv_guix_cxx11_support" != "xyes"; then
+ AC_MSG_ERROR([C++ compiler '$CXX' does not support the C++11 standard])
+ fi
+])