diff options
| -rw-r--r-- | config-daemon.ac | 3 | ||||
| -rw-r--r-- | doc/guix.texi | 7 | ||||
| -rw-r--r-- | m4/guix.m4 | 39 |
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 | ||
| 6 | dnl C++ environment. This macro must be used unconditionnaly. | 6 | dnl C++ environment. This macro must be used unconditionnaly. |
| 7 | AC_PROG_CXX | 7 | AC_PROG_CXX |
| 8 | AC_LANG([C++]) | ||
| 8 | 9 | ||
| 9 | if test "x$guix_build_daemon" = "xyes"; then | 10 | if 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 | |||
| 368 | following packages are also needed: | 368 | following 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 |
| 374 | C++11 standard. | ||
| 374 | @end itemize | 375 | @end itemize |
| 375 | 376 | ||
| 376 | When a working installation of @url{http://nixos.org/nix/, the Nix package | 377 | When 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 | |||
| 222 | dnl GUIX_CHECK_CXX11 | ||
| 223 | dnl | ||
| 224 | dnl Check whether the C++ compiler can compile a typical C++11 program. | ||
| 225 | AC_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 | |||
| 251 | dnl GUIX_ASSERT_CXX11 | ||
| 252 | dnl | ||
| 253 | dnl Error out if the C++ compiler cannot compile C++11 code. | ||
| 254 | AC_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 | ]) | ||
