summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config-daemon.ac3
-rw-r--r--doc/guix.texi7
-rw-r--r--m4/guix.m439
3 files changed, 46 insertions, 3 deletions
diff --git a/config-daemon.ac b/config-daemon.ac
index fb80c754c9c..a6cf29ca426 100644
--- a/config-daemon.ac
+++ b/config-daemon.ac
@@ -5,9 +5,12 @@ AC_MSG_RESULT([$guix_build_daemon])
5 5
6dnl C++ environment. This macro must be used unconditionnaly. 6dnl C++ environment. This macro must be used unconditionnaly.
7AC_PROG_CXX 7AC_PROG_CXX
8AC_LANG([C++])
8 9
9if test "x$guix_build_daemon" = "xyes"; then 10if test "x$guix_build_daemon" = "xyes"; then
10 11
12 GUIX_ASSERT_CXX11
13
11 AC_PROG_RANLIB 14 AC_PROG_RANLIB
12 AC_CONFIG_HEADER([nix/config.h]) 15 AC_CONFIG_HEADER([nix/config.h])
13 16
diff --git a/doc/guix.texi b/doc/guix.texi
index 6964a4ec18e..91c86dc30a1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -368,9 +368,10 @@ Unless @code{--disable-daemon} was passed to @command{configure}, the
368following packages are also needed: 368following packages are also needed:
369 369
370@itemize 370@itemize
371@item @url{http://sqlite.org, SQLite 3} 371@item @url{http://sqlite.org, SQLite 3};
372@item @url{http://www.bzip.org, libbz2} 372@item @url{http://www.bzip.org, libbz2};
373@item @url{http://gcc.gnu.org, GCC's g++} 373@item @url{http://gcc.gnu.org, GCC's g++}, with support for the
374C++11 standard.
374@end itemize 375@end itemize
375 376
376When a working installation of @url{http://nixos.org/nix/, the Nix package 377When a working installation of @url{http://nixos.org/nix/, the Nix package
diff --git a/m4/guix.m4 b/m4/guix.m4
index 445ce857dd6..fa5a4023ba0 100644
--- a/m4/guix.m4
+++ b/m4/guix.m4
@@ -218,3 +218,42 @@ AC_DEFUN([GUIX_CHECK_FILE_NAME_LIMITS], [
218 AC_MSG_ERROR([store directory '$storedir' would lead to overly long hash-bang lines]) 218 AC_MSG_ERROR([store directory '$storedir' would lead to overly long hash-bang lines])
219 fi 219 fi
220]) 220])
221
222dnl GUIX_CHECK_CXX11
223dnl
224dnl Check whether the C++ compiler can compile a typical C++11 program.
225AC_DEFUN([GUIX_CHECK_CXX11], [
226 AC_REQUIRE([AC_PROG_CXX])
227 AC_CACHE_CHECK([whether $CXX supports C++11],
228 [ac_cv_guix_cxx11_support],
229 [save_CXXFLAGS="$CXXFLAGS"
230 CXXFLAGS="-std=c++11 $CXXFLAGS"
231 AC_COMPILE_IFELSE([
232 AC_LANG_SOURCE([
233 #include <functional>
234
235 std::function<int(int)>
236 return_plus_lambda (int x)
237 {
238 auto result = [[&]](int y) {
239 return x + y;
240 };
241
242 return result;
243 }
244 ])],
245 [ac_cv_guix_cxx11_support=yes],
246 [ac_cv_guix_cxx11_support=no])
247 CXXFLAGS="$save_CXXFLAGS"
248 ])
249])
250
251dnl GUIX_ASSERT_CXX11
252dnl
253dnl Error out if the C++ compiler cannot compile C++11 code.
254AC_DEFUN([GUIX_ASSERT_CXX11], [
255 GUIX_CHECK_CXX11
256 if test "x$ac_cv_guix_cxx11_support" != "xyes"; then
257 AC_MSG_ERROR([C++ compiler '$CXX' does not support the C++11 standard])
258 fi
259])