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 | |
8 | ||
9 | if test "x$guix_build_daemon" = "xyes"; then | |
10 | ||
11 | AC_PROG_RANLIB | |
12 | AC_CONFIG_HEADER([nix/config.h]) | |
13 | ||
fe0cff14 LC |
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]) | |
18 | AC_SUBST([GZIP]) | |
19 | AC_SUBST([BZIP2]) | |
20 | AC_SUBST([XZ]) | |
21 | ||
c2033df4 LC |
22 | dnl Use 64-bit file system calls so that we can support files > 2 GiB. |
23 | AC_SYS_LARGEFILE | |
24 | ||
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/.])]) | |
30 | ||
31 | dnl Look for SQLite, a required dependency. | |
32 | PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.6.19]) | |
33 | ||
34 | AC_DEFINE([NIX_VERSION], ["0.0.0"], [Fake Nix version number.]) | |
ca8dbb7d | 35 | AC_DEFINE_UNQUOTED([SYSTEM], ["$guix_system"], |
c2033df4 LC |
36 | [Guix host system type--i.e., platform and OS kernel tuple.]) |
37 | ||
38 | case "$LIBGCRYPT_PREFIX" in | |
39 | no) | |
40 | LIBGCRYPT_CFLAGS="" | |
41 | LIBGCRYPT_LIBS="" | |
42 | ;; | |
43 | *) | |
44 | LIBGCRYPT_CFLAGS="-I$LIBGCRYPT_PREFIX/include" | |
45 | LIBGCRYPT_LIBS="-L$LIBGCRYPT_PREFIX/lib -lgcrypt" | |
46 | ;; | |
47 | esac | |
48 | AC_SUBST([LIBGCRYPT_CFLAGS]) | |
49 | AC_SUBST([LIBGCRYPT_LIBS]) | |
50 | ||
51 | save_CFLAGS="$CFLAGS" | |
52 | save_LDFLAGS="$LDFLAGS" | |
53 | CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" | |
54 | LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS" | |
55 | ||
56 | have_gcrypt=yes | |
57 | AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no]) | |
58 | AC_CHECK_HEADER([gcrypt.h], [:], [have_gcrypt=no]) | |
59 | if test "x$have_gcrypt" != "xyes"; then | |
60 | AC_MSG_ERROR([GNU libgcrypt not found; please install it.]) | |
61 | fi | |
62 | ||
63 | CFLAGS="$save_CFLAGS" | |
64 | LDFLAGS="$save_LDFLAGS" | |
2606bbcf LC |
65 | |
66 | dnl Chroot support. | |
67 | AC_CHECK_FUNCS([chroot unshare]) | |
68 | AC_CHECK_HEADERS([sched.h sys/param.h sys/mount.h]) | |
69 | ||
70 | dnl Check for lutimes, optionally used for changing the mtime of | |
71 | dnl symlinks. | |
72 | AC_CHECK_FUNCS([lutimes]) | |
73 | ||
74 | dnl Check whether the store optimiser can optimise symlinks. | |
75 | AC_MSG_CHECKING([whether it is possible to create a link to a symlink]) | |
76 | ln -s bla tmp_link | |
77 | if ln tmp_link tmp_link2 2> /dev/null; then | |
78 | AC_MSG_RESULT(yes) | |
79 | AC_DEFINE(CAN_LINK_SYMLINK, 1, [Whether link() works on symlinks.]) | |
80 | else | |
81 | AC_MSG_RESULT(no) | |
82 | fi | |
83 | rm -f tmp_link tmp_link2 | |
84 | ||
85 | dnl Check for <locale>. | |
86 | AC_LANG_PUSH(C++) | |
87 | AC_CHECK_HEADERS([locale]) | |
88 | AC_LANG_POP(C++) | |
89 | ||
90 | ||
91 | dnl Check whether we have the `personality' syscall, which allows us | |
92 | dnl to do i686-linux builds on x86_64-linux machines. | |
93 | AC_CHECK_HEADERS([sys/personality.h]) | |
94 | ||
95 | dnl Check for <linux/fs.h> (for immutable file support). | |
96 | AC_CHECK_HEADERS([linux/fs.h]) | |
f5c82e15 | 97 | |
69cfce50 LC |
98 | dnl Temporary directory used to store the daemon's data. |
99 | AC_MSG_CHECKING([for unit test root]) | |
100 | GUIX_TEST_ROOT="`pwd`/test-tmp" | |
101 | AC_MSG_RESULT([$GUIX_TEST_ROOT]) | |
102 | AC_SUBST([GUIX_TEST_ROOT]) | |
103 | ||
e8b3afeb LC |
104 | AC_CONFIG_FILES([nix/scripts/list-runtime-roots], |
105 | [chmod +x nix/scripts/list-runtime-roots]) | |
106 | AC_CONFIG_FILES([nix/scripts/substitute-binary], | |
107 | [chmod +x nix/scripts/substitute-binary]) | |
c2033df4 LC |
108 | fi |
109 | ||
110 | AM_CONDITIONAL([BUILD_DAEMON], [test "x$guix_build_daemon" = "xyes"]) |