gnu: mplayer: Fix configure flags on armhf.
[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
8
9if 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=""
c2033df4
LC
41 ;;
42 *)
43 LIBGCRYPT_CFLAGS="-I$LIBGCRYPT_PREFIX/include"
c2033df4
LC
44 ;;
45 esac
14af289e
LC
46
47 case "$LIBGCRYPT_LIBDIR" in
48 no)
49 LIBGCRYPT_LIBS="-lgcrypt"
50 ;;
51 *)
52 LIBGCRYPT_LIBS="-L$LIBGCRYPT_LIBDIR -lgcrypt"
53 ;;
54 esac
55
c2033df4
LC
56 AC_SUBST([LIBGCRYPT_CFLAGS])
57 AC_SUBST([LIBGCRYPT_LIBS])
58
59 save_CFLAGS="$CFLAGS"
60 save_LDFLAGS="$LDFLAGS"
61 CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
62 LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS"
63
64 have_gcrypt=yes
65 AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no])
66 AC_CHECK_HEADER([gcrypt.h], [:], [have_gcrypt=no])
67 if test "x$have_gcrypt" != "xyes"; then
68 AC_MSG_ERROR([GNU libgcrypt not found; please install it.])
69 fi
70
71 CFLAGS="$save_CFLAGS"
72 LDFLAGS="$save_LDFLAGS"
2606bbcf
LC
73
74 dnl Chroot support.
75 AC_CHECK_FUNCS([chroot unshare])
63cbe7a1 76 AC_CHECK_HEADERS([sched.h sys/param.h sys/mount.h tr1/unordered_set])
2606bbcf 77
3b9855f4
LC
78 if test "x$ac_cv_func_chroot" != "xyes"; then
79 AC_MSG_ERROR(['chroot' function missing, bailing out])
80 fi
81
c0412fed
LC
82 dnl lutimes and lchown: used when canonicalizing store items.
83 dnl posix_fallocate: used when extracting archives.
84 dnl vfork: to speed up spawning of helper programs.
3af2d27e
LC
85 dnl `--> now disabled because of unpredictable behavior:
86 dnl see <http://lists.gnu.org/archive/html/guix-devel/2014-05/msg00036.html>
87 dnl and Nix commit f794465c (Nov. 2012).
c0412fed
LC
88 dnl sched_setaffinity: to improve RPC locality.
89 dnl statvfs: to detect disk-full conditions.
90 dnl strsignal: for error reporting.
3af2d27e 91 AC_CHECK_FUNCS([lutimes lchown posix_fallocate sched_setaffinity \
c0412fed 92 statvfs nanosleep strsignal])
2606bbcf
LC
93
94 dnl Check whether the store optimiser can optimise symlinks.
95 AC_MSG_CHECKING([whether it is possible to create a link to a symlink])
96 ln -s bla tmp_link
97 if ln tmp_link tmp_link2 2> /dev/null; then
98 AC_MSG_RESULT(yes)
99 AC_DEFINE(CAN_LINK_SYMLINK, 1, [Whether link() works on symlinks.])
100 else
101 AC_MSG_RESULT(no)
102 fi
103 rm -f tmp_link tmp_link2
104
105 dnl Check for <locale>.
106 AC_LANG_PUSH(C++)
107 AC_CHECK_HEADERS([locale])
108 AC_LANG_POP(C++)
109
110
111 dnl Check whether we have the `personality' syscall, which allows us
112 dnl to do i686-linux builds on x86_64-linux machines.
113 AC_CHECK_HEADERS([sys/personality.h])
114
115 dnl Check for <linux/fs.h> (for immutable file support).
116 AC_CHECK_HEADERS([linux/fs.h])
f5c82e15 117
49e6291a
LC
118 dnl Check whether the 'offload' build hook can be built (uses
119 dnl 'restore-file-set', which requires unbuffered custom binary input
120 dnl ports from Guile >= 2.0.10.)
121 GUIX_CHECK_UNBUFFERED_CBIP
122 guix_build_daemon_offload="$ac_cv_guix_cbips_support_setvbuf"
123
124 if test "x$guix_build_daemon_offload" = "xyes"; then
125 AC_DEFINE([HAVE_DAEMON_OFFLOAD_HOOK], [1],
126 [Define if the daemon's 'offload' build hook is being built.])
127 fi
128
69cfce50 129 dnl Temporary directory used to store the daemon's data.
2178ed66
LC
130 GUIX_TEST_ROOT_DIRECTORY
131 GUIX_TEST_ROOT="$ac_cv_guix_test_root"
69cfce50
LC
132 AC_SUBST([GUIX_TEST_ROOT])
133
e8b3afeb
LC
134 AC_CONFIG_FILES([nix/scripts/list-runtime-roots],
135 [chmod +x nix/scripts/list-runtime-roots])
2c74fde0
LC
136 AC_CONFIG_FILES([nix/scripts/substitute],
137 [chmod +x nix/scripts/substitute])
526382ff
LC
138 AC_CONFIG_FILES([nix/scripts/guix-authenticate],
139 [chmod +x nix/scripts/guix-authenticate])
49e6291a
LC
140 AC_CONFIG_FILES([nix/scripts/offload],
141 [chmod +x nix/scripts/offload])
c2033df4
LC
142fi
143
144AM_CONDITIONAL([BUILD_DAEMON], [test "x$guix_build_daemon" = "xyes"])
49e6291a
LC
145AM_CONDITIONAL([BUILD_DAEMON_OFFLOAD], \
146 [test "x$guix_build_daemon" = "xyes" \
147 && test "x$guix_build_daemon_offload" = "xyes"])