gnu: guile-ssh: Update to 0.10.2.
[jackhill/guix/guix.git] / config-daemon.ac
CommitLineData
c2033df4
LC
1dnl -*- Autoconf -*- fragment for the C++ daemon.
2
c2033df4
LC
3AC_MSG_CHECKING([whether to build daemon])
4AC_MSG_RESULT([$guix_build_daemon])
5
6dnl C++ environment. This macro must be used unconditionnaly.
7AC_PROG_CXX
368d08f7 8AC_LANG([C++])
c2033df4
LC
9
10if test "x$guix_build_daemon" = "xyes"; then
11
368d08f7
LC
12 GUIX_ASSERT_CXX11
13
c2033df4
LC
14 AC_PROG_RANLIB
15 AC_CONFIG_HEADER([nix/config.h])
16
17 dnl Use 64-bit file system calls so that we can support files > 2 GiB.
18 AC_SYS_LARGEFILE
19
20 dnl Look for libbz2, a required dependency.
21 AC_CHECK_LIB([bz2], [BZ2_bzWriteOpen], [true],
22 [AC_MSG_ERROR([Guix requires libbz2, which is part of bzip2. See http://www.bzip.org/.])])
23 AC_CHECK_HEADERS([bzlib.h], [true],
24 [AC_MSG_ERROR([Guix requires libbz2, which is part of bzip2. See http://www.bzip.org/.])])
25
26 dnl Look for SQLite, a required dependency.
27 PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.6.19])
28
29 AC_DEFINE([NIX_VERSION], ["0.0.0"], [Fake Nix version number.])
ca8dbb7d 30 AC_DEFINE_UNQUOTED([SYSTEM], ["$guix_system"],
c2033df4
LC
31 [Guix host system type--i.e., platform and OS kernel tuple.])
32
33 case "$LIBGCRYPT_PREFIX" in
34 no)
35 LIBGCRYPT_CFLAGS=""
c2033df4
LC
36 ;;
37 *)
38 LIBGCRYPT_CFLAGS="-I$LIBGCRYPT_PREFIX/include"
c2033df4
LC
39 ;;
40 esac
14af289e
LC
41
42 case "$LIBGCRYPT_LIBDIR" in
43 no)
44 LIBGCRYPT_LIBS="-lgcrypt"
45 ;;
ca34fc31 46 *)
14af289e
LC
47 LIBGCRYPT_LIBS="-L$LIBGCRYPT_LIBDIR -lgcrypt"
48 ;;
49 esac
50
c2033df4
LC
51 AC_SUBST([LIBGCRYPT_CFLAGS])
52 AC_SUBST([LIBGCRYPT_LIBS])
53
54 save_CFLAGS="$CFLAGS"
55 save_LDFLAGS="$LDFLAGS"
56 CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
57 LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS"
58
59 have_gcrypt=yes
60 AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no])
61 AC_CHECK_HEADER([gcrypt.h], [:], [have_gcrypt=no])
62 if test "x$have_gcrypt" != "xyes"; then
63 AC_MSG_ERROR([GNU libgcrypt not found; please install it.])
64 fi
65
66 CFLAGS="$save_CFLAGS"
67 LDFLAGS="$save_LDFLAGS"
2606bbcf
LC
68
69 dnl Chroot support.
70 AC_CHECK_FUNCS([chroot unshare])
54c260e6 71 AC_CHECK_HEADERS([sched.h sys/param.h sys/mount.h sys/syscall.h])
2606bbcf 72
3b9855f4
LC
73 if test "x$ac_cv_func_chroot" != "xyes"; then
74 AC_MSG_ERROR(['chroot' function missing, bailing out])
75 fi
76
c0412fed
LC
77 dnl lutimes and lchown: used when canonicalizing store items.
78 dnl posix_fallocate: used when extracting archives.
79 dnl vfork: to speed up spawning of helper programs.
3af2d27e
LC
80 dnl `--> now disabled because of unpredictable behavior:
81 dnl see <http://lists.gnu.org/archive/html/guix-devel/2014-05/msg00036.html>
82 dnl and Nix commit f794465c (Nov. 2012).
c0412fed
LC
83 dnl sched_setaffinity: to improve RPC locality.
84 dnl statvfs: to detect disk-full conditions.
85 dnl strsignal: for error reporting.
3af2d27e 86 AC_CHECK_FUNCS([lutimes lchown posix_fallocate sched_setaffinity \
c0412fed 87 statvfs nanosleep strsignal])
2606bbcf
LC
88
89 dnl Check whether the store optimiser can optimise symlinks.
90 AC_MSG_CHECKING([whether it is possible to create a link to a symlink])
91 ln -s bla tmp_link
92 if ln tmp_link tmp_link2 2> /dev/null; then
93 AC_MSG_RESULT(yes)
94 AC_DEFINE(CAN_LINK_SYMLINK, 1, [Whether link() works on symlinks.])
95 else
96 AC_MSG_RESULT(no)
97 fi
98 rm -f tmp_link tmp_link2
99
100 dnl Check for <locale>.
101 AC_LANG_PUSH(C++)
102 AC_CHECK_HEADERS([locale])
103 AC_LANG_POP(C++)
104
105
106 dnl Check whether we have the `personality' syscall, which allows us
107 dnl to do i686-linux builds on x86_64-linux machines.
108 AC_CHECK_HEADERS([sys/personality.h])
109
110 dnl Check for <linux/fs.h> (for immutable file support).
111 AC_CHECK_HEADERS([linux/fs.h])
f5c82e15 112
df061d07
LC
113 dnl Determine the appropriate default list of substitute URLs.
114 GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)])
115 if test "x$have_gnutls" = "xyes"; then
f82ce8f6 116 guix_substitute_urls="https://mirror.hydra.gnu.org"
df061d07
LC
117 else
118 AC_MSG_WARN([GnuTLS is missing, substitutes will be downloaded in the clear])
f82ce8f6 119 guix_substitute_urls="http://mirror.hydra.gnu.org"
df061d07
LC
120 fi
121 AC_MSG_CHECKING([for default substitute URLs])
122 AC_MSG_RESULT([$guix_substitute_urls])
123
124 AC_DEFINE_UNQUOTED([GUIX_SUBSTITUTE_URLS], ["$guix_substitute_urls"],
125 [Default list of substitute URLs used by 'guix-daemon'.])
126
49e6291a
LC
127 dnl Check whether the 'offload' build hook can be built (uses
128 dnl 'restore-file-set', which requires unbuffered custom binary input
129 dnl ports from Guile >= 2.0.10.)
130 GUIX_CHECK_UNBUFFERED_CBIP
131 guix_build_daemon_offload="$ac_cv_guix_cbips_support_setvbuf"
132
133 if test "x$guix_build_daemon_offload" = "xyes"; then
134 AC_DEFINE([HAVE_DAEMON_OFFLOAD_HOOK], [1],
135 [Define if the daemon's 'offload' build hook is being built.])
136 fi
137
69cfce50 138 dnl Temporary directory used to store the daemon's data.
2178ed66
LC
139 GUIX_TEST_ROOT_DIRECTORY
140 GUIX_TEST_ROOT="$ac_cv_guix_test_root"
69cfce50
LC
141 AC_SUBST([GUIX_TEST_ROOT])
142
ef5f5c86
LC
143 GUIX_CHECK_LOCALSTATEDIR
144
e8b3afeb
LC
145 AC_CONFIG_FILES([nix/scripts/list-runtime-roots],
146 [chmod +x nix/scripts/list-runtime-roots])
94d92c77
LC
147 AC_CONFIG_FILES([nix/scripts/download],
148 [chmod +x nix/scripts/download])
2c74fde0
LC
149 AC_CONFIG_FILES([nix/scripts/substitute],
150 [chmod +x nix/scripts/substitute])
526382ff
LC
151 AC_CONFIG_FILES([nix/scripts/guix-authenticate],
152 [chmod +x nix/scripts/guix-authenticate])
49e6291a
LC
153 AC_CONFIG_FILES([nix/scripts/offload],
154 [chmod +x nix/scripts/offload])
c2033df4
LC
155fi
156
157AM_CONDITIONAL([BUILD_DAEMON], [test "x$guix_build_daemon" = "xyes"])
49e6291a
LC
158AM_CONDITIONAL([BUILD_DAEMON_OFFLOAD], \
159 [test "x$guix_build_daemon" = "xyes" \
160 && test "x$guix_build_daemon_offload" = "xyes"])