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