| 1 | dnl -*- Autoconf -*- fragment for the C++ daemon. |
| 2 | |
| 3 | AC_MSG_CHECKING([whether to build daemon]) |
| 4 | AC_MSG_RESULT([$guix_build_daemon]) |
| 5 | |
| 6 | dnl C++ environment. This macro must be used unconditionnaly. |
| 7 | AC_PROG_CXX |
| 8 | AM_PROG_AR |
| 9 | AC_LANG([C++]) |
| 10 | |
| 11 | if test "x$guix_build_daemon" = "xyes"; then |
| 12 | |
| 13 | GUIX_ASSERT_CXX11 |
| 14 | |
| 15 | AC_PROG_RANLIB |
| 16 | AC_CONFIG_HEADERS([nix/config.h]) |
| 17 | |
| 18 | dnl Use 64-bit file system calls so that we can support files > 2 GiB. |
| 19 | AC_SYS_LARGEFILE |
| 20 | |
| 21 | dnl Look for zlib, a required dependency. |
| 22 | AC_CHECK_LIB([z], [gzdopen], [true], |
| 23 | [AC_MSG_ERROR([Guix requires zlib. See http://www.zlib.net/.])]) |
| 24 | AC_CHECK_HEADERS([zlib.h], [true], |
| 25 | [AC_MSG_ERROR([Guix requires zlib. See http://www.zlib.net/.])]) |
| 26 | |
| 27 | dnl Look for libbz2, an optional dependency. |
| 28 | AC_CHECK_LIB([bz2], [BZ2_bzWriteOpen], [HAVE_LIBBZ2=yes], [HAVE_LIBBZ2=no]) |
| 29 | if test "x$HAVE_LIBBZ2" = xyes; then |
| 30 | AC_CHECK_HEADERS([bzlib.h]) |
| 31 | HAVE_LIBBZ2="$ac_cv_header_bzlib_h" |
| 32 | fi |
| 33 | |
| 34 | dnl Look for SQLite, a required dependency. |
| 35 | PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.6.19]) |
| 36 | |
| 37 | AC_DEFINE_UNQUOTED([SYSTEM], ["$guix_system"], |
| 38 | [Guix host system type--i.e., platform and OS kernel tuple.]) |
| 39 | |
| 40 | case "$LIBGCRYPT_PREFIX" in |
| 41 | no) |
| 42 | LIBGCRYPT_CFLAGS="" |
| 43 | ;; |
| 44 | *) |
| 45 | LIBGCRYPT_CFLAGS="-I$LIBGCRYPT_PREFIX/include" |
| 46 | ;; |
| 47 | esac |
| 48 | |
| 49 | case "$LIBGCRYPT_LIBDIR" in |
| 50 | no | "") |
| 51 | LIBGCRYPT_LIBS="-lgcrypt" |
| 52 | ;; |
| 53 | *) |
| 54 | LIBGCRYPT_LIBS="-L$LIBGCRYPT_LIBDIR -lgcrypt" |
| 55 | ;; |
| 56 | esac |
| 57 | |
| 58 | AC_SUBST([LIBGCRYPT_CFLAGS]) |
| 59 | AC_SUBST([LIBGCRYPT_LIBS]) |
| 60 | |
| 61 | save_CFLAGS="$CFLAGS" |
| 62 | save_LDFLAGS="$LDFLAGS" |
| 63 | CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" |
| 64 | LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS" |
| 65 | |
| 66 | have_gcrypt=yes |
| 67 | AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no]) |
| 68 | AC_CHECK_HEADER([gcrypt.h], [:], [have_gcrypt=no]) |
| 69 | if test "x$have_gcrypt" != "xyes"; then |
| 70 | AC_MSG_ERROR([GNU libgcrypt not found; please install it.]) |
| 71 | fi |
| 72 | |
| 73 | CFLAGS="$save_CFLAGS" |
| 74 | LDFLAGS="$save_LDFLAGS" |
| 75 | |
| 76 | dnl Chroot support. |
| 77 | AC_CHECK_FUNCS([chroot unshare]) |
| 78 | AC_CHECK_HEADERS([sched.h sys/param.h sys/mount.h sys/syscall.h]) |
| 79 | |
| 80 | if test "x$ac_cv_func_chroot" != "xyes"; then |
| 81 | AC_MSG_ERROR(['chroot' function missing, bailing out]) |
| 82 | fi |
| 83 | |
| 84 | dnl lutimes and lchown: used when canonicalizing store items. |
| 85 | dnl posix_fallocate: used when extracting archives. |
| 86 | dnl vfork: to speed up spawning of helper programs. |
| 87 | dnl `--> now disabled because of unpredictable behavior: |
| 88 | dnl see <http://lists.gnu.org/archive/html/guix-devel/2014-05/msg00036.html> |
| 89 | dnl and Nix commit f794465c (Nov. 2012). |
| 90 | dnl sched_setaffinity: to improve RPC locality. |
| 91 | dnl statvfs: to detect disk-full conditions. |
| 92 | dnl strsignal: for error reporting. |
| 93 | dnl statx: fine-grain 'stat' call, new in glibc 2.28. |
| 94 | AC_CHECK_FUNCS([lutimes lchown posix_fallocate sched_setaffinity \ |
| 95 | statvfs nanosleep strsignal statx]) |
| 96 | |
| 97 | dnl Check for <locale>. |
| 98 | AC_LANG_PUSH(C++) |
| 99 | AC_CHECK_HEADERS([locale]) |
| 100 | AC_LANG_POP(C++) |
| 101 | |
| 102 | |
| 103 | dnl Check whether we have the `personality' syscall, which allows us |
| 104 | dnl to do i686-linux builds on x86_64-linux machines. |
| 105 | AC_CHECK_HEADERS([sys/personality.h]) |
| 106 | |
| 107 | dnl Determine the appropriate default list of substitute URLs (GnuTLS |
| 108 | dnl is required so we can default to 'https'.) |
| 109 | guix_substitute_urls="https://ci.guix.gnu.org https://bordeaux.guix.gnu.org" |
| 110 | |
| 111 | AC_MSG_CHECKING([for default substitute URLs]) |
| 112 | AC_MSG_RESULT([$guix_substitute_urls]) |
| 113 | |
| 114 | AC_DEFINE_UNQUOTED([GUIX_SUBSTITUTE_URLS], ["$guix_substitute_urls"], |
| 115 | [Default list of substitute URLs used by 'guix-daemon'.]) |
| 116 | |
| 117 | dnl Check for Guile-SSH, which is required by 'guix offload'. |
| 118 | GUIX_CHECK_GUILE_SSH |
| 119 | |
| 120 | case "x$guix_cv_have_recent_guile_ssh" in |
| 121 | xyes) |
| 122 | guix_build_daemon_offload="yes" |
| 123 | AC_DEFINE([HAVE_DAEMON_OFFLOAD_HOOK], [1], |
| 124 | [Define if the daemon's 'offload' build hook is being built (requires Guile-SSH).]) |
| 125 | ;; |
| 126 | *) |
| 127 | guix_build_daemon_offload="no" |
| 128 | ;; |
| 129 | esac |
| 130 | |
| 131 | dnl Temporary directory used to store the daemon's data. |
| 132 | GUIX_TEST_ROOT_DIRECTORY |
| 133 | GUIX_TEST_ROOT="$ac_cv_guix_test_root" |
| 134 | AC_SUBST([GUIX_TEST_ROOT]) |
| 135 | |
| 136 | GUIX_CHECK_LOCALSTATEDIR |
| 137 | fi |
| 138 | |
| 139 | AM_CONDITIONAL([HAVE_LIBBZ2], [test "x$HAVE_LIBBZ2" = "xyes"]) |
| 140 | AM_CONDITIONAL([BUILD_DAEMON], [test "x$guix_build_daemon" = "xyes"]) |
| 141 | AM_CONDITIONAL([BUILD_DAEMON_OFFLOAD], \ |
| 142 | [test "x$guix_build_daemon" = "xyes" \ |
| 143 | && test "x$guix_build_daemon_offload" = "xyes"]) |