1 dnl -*- Autoconf -*- fragment for the C++ daemon.
3 AC_MSG_CHECKING([whether to build daemon])
4 AC_MSG_RESULT([$guix_build_daemon])
6 dnl C++ environment. This macro must be used unconditionnaly.
9 if test "x$guix_build_daemon" = "xyes"; then
12 AC_CONFIG_HEADER([nix/config.h])
14 dnl Decompressors, for use by the substituter.
15 AC_PATH_PROG([GZIP], [gzip])
16 AC_PATH_PROG([BZIP2], [bzip2])
17 AC_PATH_PROG([XZ], [xz])
22 dnl Use 64-bit file system calls so that we can support files > 2 GiB.
25 dnl Look for libbz2, a required dependency.
26 AC_CHECK_LIB([bz2], [BZ2_bzWriteOpen], [true],
27 [AC_MSG_ERROR([Guix requires libbz2, which is part of bzip2. See http://www.bzip.org/.])])
28 AC_CHECK_HEADERS([bzlib.h], [true],
29 [AC_MSG_ERROR([Guix requires libbz2, which is part of bzip2. See http://www.bzip.org/.])])
31 dnl Look for SQLite, a required dependency.
32 PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.6.19])
34 AC_DEFINE([NIX_VERSION], ["0.0.0"], [Fake Nix version number.])
35 AC_DEFINE_UNQUOTED([SYSTEM], ["$guix_system"],
36 [Guix host system type--i.e., platform and OS kernel tuple.])
38 case "$LIBGCRYPT_PREFIX" in
43 LIBGCRYPT_CFLAGS="-I$LIBGCRYPT_PREFIX/include"
47 case "$LIBGCRYPT_LIBDIR" in
49 LIBGCRYPT_LIBS="-lgcrypt"
52 LIBGCRYPT_LIBS="-L$LIBGCRYPT_LIBDIR -lgcrypt"
56 AC_SUBST([LIBGCRYPT_CFLAGS])
57 AC_SUBST([LIBGCRYPT_LIBS])
60 save_LDFLAGS="$LDFLAGS"
61 CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
62 LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS"
65 AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no])
66 AC_CHECK_HEADER([gcrypt.h], [:], [have_gcrypt=no])
67 if test "x$have_gcrypt" != "xyes"; then
68 AC_MSG_ERROR([GNU libgcrypt not found; please install it.])
72 LDFLAGS="$save_LDFLAGS"
75 AC_CHECK_FUNCS([chroot unshare])
76 AC_CHECK_HEADERS([sched.h sys/param.h sys/mount.h])
78 dnl lutimes and lchown: used when canonicalizing store items.
79 dnl posix_fallocate: used when extracting archives.
80 dnl vfork: to speed up spawning of helper programs.
81 dnl `--> now disabled because of unpredictable behavior:
82 dnl see <http://lists.gnu.org/archive/html/guix-devel/2014-05/msg00036.html>
83 dnl and Nix commit f794465c (Nov. 2012).
84 dnl sched_setaffinity: to improve RPC locality.
85 dnl statvfs: to detect disk-full conditions.
86 dnl strsignal: for error reporting.
87 AC_CHECK_FUNCS([lutimes lchown posix_fallocate sched_setaffinity \
88 statvfs nanosleep strsignal])
90 dnl Check whether the store optimiser can optimise symlinks.
91 AC_MSG_CHECKING([whether it is possible to create a link to a symlink])
93 if ln tmp_link tmp_link2 2> /dev/null; then
95 AC_DEFINE(CAN_LINK_SYMLINK, 1, [Whether link() works on symlinks.])
99 rm -f tmp_link tmp_link2
101 dnl Check for <locale>.
103 AC_CHECK_HEADERS([locale])
107 dnl Check whether we have the `personality' syscall, which allows us
108 dnl to do i686-linux builds on x86_64-linux machines.
109 AC_CHECK_HEADERS([sys/personality.h])
111 dnl Check for <linux/fs.h> (for immutable file support).
112 AC_CHECK_HEADERS([linux/fs.h])
114 dnl Check whether the 'offload' build hook can be built (uses
115 dnl 'restore-file-set', which requires unbuffered custom binary input
116 dnl ports from Guile >= 2.0.10.)
117 GUIX_CHECK_UNBUFFERED_CBIP
118 guix_build_daemon_offload="$ac_cv_guix_cbips_support_setvbuf"
120 if test "x$guix_build_daemon_offload" = "xyes"; then
121 AC_DEFINE([HAVE_DAEMON_OFFLOAD_HOOK], [1],
122 [Define if the daemon's 'offload' build hook is being built.])
125 dnl Temporary directory used to store the daemon's data.
126 AC_MSG_CHECKING([for unit test root])
127 GUIX_TEST_ROOT="`pwd`/test-tmp"
128 AC_MSG_RESULT([$GUIX_TEST_ROOT])
129 AC_SUBST([GUIX_TEST_ROOT])
131 AC_CONFIG_FILES([nix/scripts/list-runtime-roots],
132 [chmod +x nix/scripts/list-runtime-roots])
133 AC_CONFIG_FILES([nix/scripts/substitute-binary],
134 [chmod +x nix/scripts/substitute-binary])
135 AC_CONFIG_FILES([nix/scripts/guix-authenticate],
136 [chmod +x nix/scripts/guix-authenticate])
137 AC_CONFIG_FILES([nix/scripts/offload],
138 [chmod +x nix/scripts/offload])
141 AM_CONDITIONAL([BUILD_DAEMON], [test "x$guix_build_daemon" = "xyes"])
142 AM_CONDITIONAL([BUILD_DAEMON_OFFLOAD], \
143 [test "x$guix_build_daemon" = "xyes" \
144 && test "x$guix_build_daemon_offload" = "xyes"])