Commit | Line | Data |
---|---|---|
c2033df4 LC |
1 | dnl -*- Autoconf -*- fragment for the C++ daemon. |
2 | ||
c2033df4 LC |
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 | |
1ca0f20a | 8 | AM_PROG_AR |
368d08f7 | 9 | AC_LANG([C++]) |
c2033df4 LC |
10 | |
11 | if test "x$guix_build_daemon" = "xyes"; then | |
12 | ||
368d08f7 LC |
13 | GUIX_ASSERT_CXX11 |
14 | ||
c2033df4 LC |
15 | AC_PROG_RANLIB |
16 | AC_CONFIG_HEADER([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 | ||
29a68668 LC |
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 | ||
f997137d LC |
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 | |
c2033df4 LC |
33 | |
34 | dnl Look for SQLite, a required dependency. | |
35 | PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.6.19]) | |
36 | ||
37 | AC_DEFINE([NIX_VERSION], ["0.0.0"], [Fake Nix version number.]) | |
ca8dbb7d | 38 | AC_DEFINE_UNQUOTED([SYSTEM], ["$guix_system"], |
c2033df4 LC |
39 | [Guix host system type--i.e., platform and OS kernel tuple.]) |
40 | ||
41 | case "$LIBGCRYPT_PREFIX" in | |
42 | no) | |
43 | LIBGCRYPT_CFLAGS="" | |
c2033df4 LC |
44 | ;; |
45 | *) | |
46 | LIBGCRYPT_CFLAGS="-I$LIBGCRYPT_PREFIX/include" | |
c2033df4 LC |
47 | ;; |
48 | esac | |
14af289e LC |
49 | |
50 | case "$LIBGCRYPT_LIBDIR" in | |
51 | no) | |
52 | LIBGCRYPT_LIBS="-lgcrypt" | |
53 | ;; | |
ca34fc31 | 54 | *) |
14af289e LC |
55 | LIBGCRYPT_LIBS="-L$LIBGCRYPT_LIBDIR -lgcrypt" |
56 | ;; | |
57 | esac | |
58 | ||
c2033df4 LC |
59 | AC_SUBST([LIBGCRYPT_CFLAGS]) |
60 | AC_SUBST([LIBGCRYPT_LIBS]) | |
61 | ||
62 | save_CFLAGS="$CFLAGS" | |
63 | save_LDFLAGS="$LDFLAGS" | |
64 | CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" | |
65 | LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS" | |
66 | ||
67 | have_gcrypt=yes | |
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.]) | |
72 | fi | |
73 | ||
74 | CFLAGS="$save_CFLAGS" | |
75 | LDFLAGS="$save_LDFLAGS" | |
2606bbcf LC |
76 | |
77 | dnl Chroot support. | |
78 | AC_CHECK_FUNCS([chroot unshare]) | |
54c260e6 | 79 | AC_CHECK_HEADERS([sched.h sys/param.h sys/mount.h sys/syscall.h]) |
2606bbcf | 80 | |
3b9855f4 LC |
81 | if test "x$ac_cv_func_chroot" != "xyes"; then |
82 | AC_MSG_ERROR(['chroot' function missing, bailing out]) | |
83 | fi | |
84 | ||
c0412fed LC |
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. | |
3af2d27e LC |
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). | |
c0412fed LC |
91 | dnl sched_setaffinity: to improve RPC locality. |
92 | dnl statvfs: to detect disk-full conditions. | |
93 | dnl strsignal: for error reporting. | |
3af2d27e | 94 | AC_CHECK_FUNCS([lutimes lchown posix_fallocate sched_setaffinity \ |
c0412fed | 95 | statvfs nanosleep strsignal]) |
2606bbcf LC |
96 | |
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]) | |
99 | ln -s bla tmp_link | |
100 | if ln tmp_link tmp_link2 2> /dev/null; then | |
101 | AC_MSG_RESULT(yes) | |
102 | AC_DEFINE(CAN_LINK_SYMLINK, 1, [Whether link() works on symlinks.]) | |
103 | else | |
104 | AC_MSG_RESULT(no) | |
105 | fi | |
106 | rm -f tmp_link tmp_link2 | |
107 | ||
108 | dnl Check for <locale>. | |
109 | AC_LANG_PUSH(C++) | |
110 | AC_CHECK_HEADERS([locale]) | |
111 | AC_LANG_POP(C++) | |
112 | ||
113 | ||
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]) | |
117 | ||
118 | dnl Check for <linux/fs.h> (for immutable file support). | |
119 | AC_CHECK_HEADERS([linux/fs.h]) | |
f5c82e15 | 120 | |
df061d07 LC |
121 | dnl Determine the appropriate default list of substitute URLs. |
122 | GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)]) | |
123 | if test "x$have_gnutls" = "xyes"; then | |
f82ce8f6 | 124 | guix_substitute_urls="https://mirror.hydra.gnu.org" |
df061d07 LC |
125 | else |
126 | AC_MSG_WARN([GnuTLS is missing, substitutes will be downloaded in the clear]) | |
f82ce8f6 | 127 | guix_substitute_urls="http://mirror.hydra.gnu.org" |
df061d07 LC |
128 | fi |
129 | AC_MSG_CHECKING([for default substitute URLs]) | |
130 | AC_MSG_RESULT([$guix_substitute_urls]) | |
131 | ||
132 | AC_DEFINE_UNQUOTED([GUIX_SUBSTITUTE_URLS], ["$guix_substitute_urls"], | |
133 | [Default list of substitute URLs used by 'guix-daemon'.]) | |
134 | ||
49e6291a LC |
135 | dnl Check whether the 'offload' build hook can be built (uses |
136 | dnl 'restore-file-set', which requires unbuffered custom binary input | |
137 | dnl ports from Guile >= 2.0.10.) | |
138 | GUIX_CHECK_UNBUFFERED_CBIP | |
49e6291a | 139 | |
21531add LC |
140 | dnl Check for Guile-SSH, which is required by 'guix offload'. |
141 | GUIX_CHECK_GUILE_SSH | |
142 | ||
143 | case "x$ac_cv_guix_cbips_support_setvbuf$guix_cv_have_recent_guile_ssh" in | |
144 | xyesyes) | |
145 | guix_build_daemon_offload="yes" | |
146 | AC_DEFINE([HAVE_DAEMON_OFFLOAD_HOOK], [1], | |
147 | [Define if the daemon's 'offload' build hook is being built (requires Guile-SSH).]) | |
148 | ;; | |
149 | *) | |
150 | guix_build_daemon_offload="no" | |
151 | ;; | |
152 | esac | |
49e6291a | 153 | |
69cfce50 | 154 | dnl Temporary directory used to store the daemon's data. |
2178ed66 LC |
155 | GUIX_TEST_ROOT_DIRECTORY |
156 | GUIX_TEST_ROOT="$ac_cv_guix_test_root" | |
69cfce50 LC |
157 | AC_SUBST([GUIX_TEST_ROOT]) |
158 | ||
ef5f5c86 LC |
159 | GUIX_CHECK_LOCALSTATEDIR |
160 | ||
e8b3afeb LC |
161 | AC_CONFIG_FILES([nix/scripts/list-runtime-roots], |
162 | [chmod +x nix/scripts/list-runtime-roots]) | |
94d92c77 LC |
163 | AC_CONFIG_FILES([nix/scripts/download], |
164 | [chmod +x nix/scripts/download]) | |
2c74fde0 LC |
165 | AC_CONFIG_FILES([nix/scripts/substitute], |
166 | [chmod +x nix/scripts/substitute]) | |
526382ff LC |
167 | AC_CONFIG_FILES([nix/scripts/guix-authenticate], |
168 | [chmod +x nix/scripts/guix-authenticate]) | |
49e6291a LC |
169 | AC_CONFIG_FILES([nix/scripts/offload], |
170 | [chmod +x nix/scripts/offload]) | |
c2033df4 LC |
171 | fi |
172 | ||
f997137d | 173 | AM_CONDITIONAL([HAVE_LIBBZ2], [test "x$HAVE_LIBBZ2" = "xyes"]) |
c2033df4 | 174 | AM_CONDITIONAL([BUILD_DAEMON], [test "x$guix_build_daemon" = "xyes"]) |
49e6291a LC |
175 | AM_CONDITIONAL([BUILD_DAEMON_OFFLOAD], \ |
176 | [test "x$guix_build_daemon" = "xyes" \ | |
177 | && test "x$guix_build_daemon_offload" = "xyes"]) |