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.
10 if test "x$guix_build_daemon" = "xyes"; then
15 AC_CONFIG_HEADER([nix/config.h])
17 dnl Decompressors, for use by the substituter.
18 AC_PATH_PROG([GZIP], [gzip])
19 AC_PATH_PROG([BZIP2], [bzip2])
20 AC_PATH_PROG([XZ], [xz])
25 dnl Use 64-bit file system calls so that we can support files > 2 GiB.
28 dnl Look for libbz2, a required dependency.
29 AC_CHECK_LIB([bz2], [BZ2_bzWriteOpen], [true],
30 [AC_MSG_ERROR([Guix requires libbz2, which is part of bzip2. See http://www.bzip.org/.])])
31 AC_CHECK_HEADERS([bzlib.h], [true],
32 [AC_MSG_ERROR([Guix requires libbz2, which is part of bzip2. See http://www.bzip.org/.])])
34 dnl Look for SQLite, a required dependency.
35 PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.6.19])
37 AC_DEFINE([NIX_VERSION], ["0.0.0"], [Fake Nix version number.])
38 AC_DEFINE_UNQUOTED([SYSTEM], ["$guix_system"],
39 [Guix host system type--i.e., platform and OS kernel tuple.])
41 case "$LIBGCRYPT_PREFIX" in
46 LIBGCRYPT_CFLAGS="-I$LIBGCRYPT_PREFIX/include"
50 case "$LIBGCRYPT_LIBDIR" in
52 LIBGCRYPT_LIBS="-lgcrypt"
55 LIBGCRYPT_LIBS="-L$LIBGCRYPT_LIBDIR -lgcrypt"
59 AC_SUBST([LIBGCRYPT_CFLAGS])
60 AC_SUBST([LIBGCRYPT_LIBS])
63 save_LDFLAGS="$LDFLAGS"
64 CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
65 LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS"
68 AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no])
69 AC_CHECK_HEADER([gcrypt.h], [:], [have_gcrypt=no])
70 if test "x$have_gcrypt" != "xyes"; then
71 AC_MSG_ERROR([GNU libgcrypt not found; please install it.])
75 LDFLAGS="$save_LDFLAGS"
78 AC_CHECK_FUNCS([chroot unshare])
79 AC_CHECK_HEADERS([sched.h sys/param.h sys/mount.h sys/syscall.h])
81 if test "x$ac_cv_func_chroot" != "xyes"; then
82 AC_MSG_ERROR(['chroot' function missing, bailing out])
85 dnl lutimes and lchown: used when canonicalizing store items.
86 dnl posix_fallocate: used when extracting archives.
87 dnl vfork: to speed up spawning of helper programs.
88 dnl `--> now disabled because of unpredictable behavior:
89 dnl see <http://lists.gnu.org/archive/html/guix-devel/2014-05/msg00036.html>
90 dnl and Nix commit f794465c (Nov. 2012).
91 dnl sched_setaffinity: to improve RPC locality.
92 dnl statvfs: to detect disk-full conditions.
93 dnl strsignal: for error reporting.
94 AC_CHECK_FUNCS([lutimes lchown posix_fallocate sched_setaffinity \
95 statvfs nanosleep strsignal])
97 dnl Check whether the store optimiser can optimise symlinks.
98 AC_MSG_CHECKING([whether it is possible to create a link to a symlink])
100 if ln tmp_link tmp_link2 2> /dev/null; then
102 AC_DEFINE(CAN_LINK_SYMLINK, 1, [Whether link() works on symlinks.])
106 rm -f tmp_link tmp_link2
108 dnl Check for <locale>.
110 AC_CHECK_HEADERS([locale])
114 dnl Check whether we have the `personality' syscall, which allows us
115 dnl to do i686-linux builds on x86_64-linux machines.
116 AC_CHECK_HEADERS([sys/personality.h])
118 dnl Check for <linux/fs.h> (for immutable file support).
119 AC_CHECK_HEADERS([linux/fs.h])
121 dnl Check whether the 'offload' build hook can be built (uses
122 dnl 'restore-file-set', which requires unbuffered custom binary input
123 dnl ports from Guile >= 2.0.10.)
124 GUIX_CHECK_UNBUFFERED_CBIP
125 guix_build_daemon_offload="$ac_cv_guix_cbips_support_setvbuf"
127 if test "x$guix_build_daemon_offload" = "xyes"; then
128 AC_DEFINE([HAVE_DAEMON_OFFLOAD_HOOK], [1],
129 [Define if the daemon's 'offload' build hook is being built.])
132 dnl Temporary directory used to store the daemon's data.
133 GUIX_TEST_ROOT_DIRECTORY
134 GUIX_TEST_ROOT="$ac_cv_guix_test_root"
135 AC_SUBST([GUIX_TEST_ROOT])
137 AC_CONFIG_FILES([nix/scripts/list-runtime-roots],
138 [chmod +x nix/scripts/list-runtime-roots])
139 AC_CONFIG_FILES([nix/scripts/substitute],
140 [chmod +x nix/scripts/substitute])
141 AC_CONFIG_FILES([nix/scripts/guix-authenticate],
142 [chmod +x nix/scripts/guix-authenticate])
143 AC_CONFIG_FILES([nix/scripts/offload],
144 [chmod +x nix/scripts/offload])
147 AM_CONDITIONAL([BUILD_DAEMON], [test "x$guix_build_daemon" = "xyes"])
148 AM_CONDITIONAL([BUILD_DAEMON_OFFLOAD], \
149 [test "x$guix_build_daemon" = "xyes" \
150 && test "x$guix_build_daemon_offload" = "xyes"])