syscalls: Add 'getxattr'.
[jackhill/guix/guix.git] / configure.ac
... / ...
CommitLineData
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.68)
5AC_INIT([GNU Guix],
6 [m4_esyscmd([build-aux/git-version-gen .tarball-version])],
7 [bug-guix@gnu.org], [guix],
8 [https://www.gnu.org/software/guix/])
9AC_CONFIG_AUX_DIR([build-aux])
10
11AM_INIT_AUTOMAKE([1.14 gnu silent-rules subdir-objects \
12 color-tests parallel-tests -Woverride -Wno-portability])
13
14# Enable silent rules by default.
15AM_SILENT_RULES([yes])
16
17AC_CONFIG_SRCDIR([guix.scm])
18AC_CONFIG_MACRO_DIR([m4])
19
20dnl For the C++ code. This must be used early.
21AC_USE_SYSTEM_EXTENSIONS
22
23AM_GNU_GETTEXT([external])
24AM_GNU_GETTEXT_VERSION([0.18.1])
25
26GUIX_SYSTEM_TYPE
27GUIX_ASSERT_SUPPORTED_SYSTEM
28
29AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"])
30
31AC_ARG_WITH(store-dir,
32 AC_HELP_STRING([--with-store-dir=PATH],
33 [file name of the store (defaults to /gnu/store)]),
34 [storedir="$withval"],
35 [storedir="/gnu/store"])
36AC_SUBST(storedir)
37
38AC_ARG_WITH([bash-completion-dir],
39 AC_HELP_STRING([--with-bash-completion-dir=DIR],
40 [name of the Bash completion directory]),
41 [bashcompletiondir="$withval"],
42 [bashcompletiondir='${sysconfdir}/bash_completion.d'])
43AC_SUBST([bashcompletiondir])
44
45AC_ARG_WITH([zsh-completion-dir],
46 AC_HELP_STRING([--with-zsh-completion-dir=DIR],
47 [name of the Zsh completion directory]),
48 [zshcompletiondir="$withval"],
49 [zshcompletiondir='${datadir}/zsh/site-functions'])
50AC_SUBST([zshcompletiondir])
51
52AC_ARG_WITH([fish-completion-dir],
53 AC_HELP_STRING([--with-fish-completion-dir=DIR],
54 [name of the Fish completion directory]),
55 [fishcompletiondir="$withval"],
56 [fishcompletiondir='${datadir}/fish/vendor_completions.d'])
57AC_SUBST([fishcompletiondir])
58
59AC_ARG_WITH([selinux-policy-dir],
60 AC_HELP_STRING([--with-selinux-policy-dir=DIR],
61 [name of the SELinux policy directory]),
62 [selinux_policydir="$withval"],
63 [selinux_policydir='${datadir}/selinux/'])
64AC_SUBST([selinux_policydir])
65
66dnl Better be verbose.
67AC_MSG_CHECKING([for the store directory])
68AC_MSG_RESULT([$storedir])
69
70AC_ARG_ENABLE([daemon],
71 [AS_HELP_STRING([--disable-daemon], [do not build the Nix daemon (C++)])],
72 [guix_build_daemon="$enableval"],
73 [guix_build_daemon="yes"])
74
75# Prepare a version of $localstatedir & co. that does not contain references
76# to shell variables.
77guix_prefix="`eval echo $prefix | sed -e"s|NONE|/usr/local|g"`"
78guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|$guix_prefix|g"`"
79guix_sysconfdir="`eval echo $sysconfdir | sed -e "s|NONE|$guix_prefix|g"`"
80guix_sbindir="`eval echo $sbindir | sed -e "s|NONE|$guix_prefix|g"`"
81AC_SUBST([guix_localstatedir])
82AC_SUBST([guix_sysconfdir])
83AC_SUBST([guix_sbindir])
84
85GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests])
86AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"])
87
88dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.)
89dnl Make sure they are available.
90m4_pattern_forbid([PKG_CHECK_MODULES])
91m4_pattern_forbid([GUILE_MODULE_AVAILABLE])
92m4_pattern_forbid([^GUILE_P])
93m4_pattern_allow([^GUILE_PKG_ERRORS])
94m4_pattern_forbid([^GUIX_])
95
96dnl Search for 'guile' and 'guild'. This macro defines
97dnl 'GUILE_EFFECTIVE_VERSION'.
98GUILE_PKG([3.0 2.2])
99GUILE_PROGS
100if test "x$GUILD" = "x"; then
101 AC_MSG_ERROR(['guild' binary not found; please check your Guile installation.])
102fi
103
104if test "x$GUILE_EFFECTIVE_VERSION" = "x2.2"; then
105 PKG_CHECK_MODULES([GUILE], [guile-2.2 >= 2.2.3])
106fi
107
108dnl Installation directories for .scm and .go files.
109guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
110guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
111AC_SUBST([guilemoduledir])
112AC_SUBST([guileobjectdir])
113
114dnl The GnuTLS bindings are necessary for substitutes over HTTPS and for 'guix
115dnl pull', among other things.
116GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)])
117if test "x$have_gnutls" != "xyes"; then
118 AC_MSG_ERROR([The Guile bindings of GnuTLS are missing; please install them.])
119fi
120
121dnl Check for Guile-Git.
122GUILE_MODULE_AVAILABLE([have_guile_git], [(git)])
123if test "x$have_guile_git" != "xyes"; then
124 AC_MSG_ERROR([Guile-Git is missing; please install it.])
125fi
126
127dnl Check for Guile-JSON.
128GUIX_CHECK_GUILE_JSON
129if test "x$guix_cv_have_recent_guile_json" != "xyes"; then
130 AC_MSG_ERROR([Guile-JSON is missing; please install it.])
131fi
132
133dnl Guile-Sqlite3 is used by the (guix store ...) modules.
134GUIX_CHECK_GUILE_SQLITE3
135if test "x$guix_cv_have_recent_guile_sqlite3" != "xyes"; then
136 AC_MSG_ERROR([A recent Guile-SQLite3 could not be found; please install it.])
137fi
138
139GUILE_MODULE_AVAILABLE([have_guile_gcrypt], [(gcrypt hash)])
140if test "x$have_guile_gcrypt" != "xyes"; then
141 AC_MSG_ERROR([Guile-Gcrypt could not be found; please install it.])
142fi
143
144dnl Guile-newt is used by the graphical installer.
145GUILE_MODULE_AVAILABLE([have_guile_newt], [(newt)])
146
147AC_ARG_ENABLE([installer],
148 AS_HELP_STRING([--enable-installer], [Build the graphical installer sources.]))
149
150AS_IF([test "x$enable_installer" = "xyes"], [
151if test "x$have_guile_newt" != "xyes"; then
152 AC_MSG_ERROR([Guile-newt could not be found; please install it.])
153fi
154])
155
156AM_CONDITIONAL([ENABLE_INSTALLER],
157 [test "x$enable_installer" = "xyes"])
158
159dnl Make sure we have a full-fledged Guile.
160GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
161
162dnl Make sure we don't suffer from the bug in 'equal?' wrt. syntax objects
163dnl found in 2.2.1. See <https://bugs.gnu.org/29903>.
164GUIX_ASSERT_SYNTAX_OBJECT_EQUAL
165
166AC_PROG_SED
167
168dnl Decompressors, for use by the substituter and other modules.
169AC_PATH_PROG([GZIP], [gzip])
170AC_PATH_PROG([BZIP2], [bzip2])
171AC_PATH_PROG([XZ], [xz])
172AC_SUBST([GZIP])
173AC_SUBST([BZIP2])
174AC_SUBST([XZ])
175
176AC_ARG_WITH([nix-prefix],
177 [AS_HELP_STRING([--with-nix-prefix=DIR],
178 [search for Nix in DIR (for testing purposes and '--disable-daemon' builds)])],
179 [case "$withval" in
180 yes|no) ;;
181 *)
182 NIX_PREFIX="$withval"
183 PATH="$NIX_PREFIX/bin:$PATH"; export PATH
184 AC_SUBST([NIX_PREFIX])
185 ;;
186 esac],
187 [])
188
189AC_PATH_PROG([NIX_HASH], [nix-hash])
190if test "x$guix_build_daemon$NIX_HASH" = "xno"; then
191 AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.])
192fi
193
194AC_ARG_WITH([nixpkgs],
195 [AS_HELP_STRING([--with-nixpkgs=DIR],
196 [search for Nixpkgs in DIR (for testing purposes only)])],
197 [case "$withval" in
198 yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
199 *) NIXPKGS="$withval";;
200 esac],
201 [])
202
203AC_MSG_CHECKING([for Nixpkgs source tree])
204if test -f "$NIXPKGS/default.nix"; then
205 AC_MSG_RESULT([$NIXPKGS])
206 AC_SUBST([NIXPKGS])
207else
208 AC_MSG_RESULT([not found])
209fi
210
211LIBGCRYPT_LIBDIR="no"
212LIBGCRYPT_PREFIX="no"
213
214AC_ARG_WITH([libgcrypt-prefix],
215 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
216 [case "$withval" in
217 yes|no)
218 ;;
219 *)
220 LIBGCRYPT_PREFIX="$withval"
221 LIBGCRYPT_LIBDIR="$withval/lib"
222 ;;
223 esac])
224
225AC_ARG_WITH([libgcrypt-libdir],
226 [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
227 [search for GNU libgcrypt's shared library in DIR])],
228 [case "$withval" in
229 yes|no)
230 LIBGCRYPT_LIBDIR="no"
231 ;;
232 *)
233 LIBGCRYPT_LIBDIR="$withval"
234 ;;
235 esac])
236
237dnl If none of the --with-libgcrypt-* options was used, try to determine the
238dnl the library directory.
239case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
240 xnono)
241 GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
242 ;;
243esac
244
245AC_SUBST([LIBGCRYPT_PREFIX])
246AC_SUBST([LIBGCRYPT_LIBDIR])
247
248dnl Library name of zlib suitable for 'dynamic-link'.
249GUIX_LIBZ_LIBDIR([libz_libdir])
250if test "x$libz_libdir" = "x"; then
251 LIBZ="libz"
252else
253 LIBZ="$libz_libdir/libz"
254fi
255AC_MSG_CHECKING([for zlib's shared library name])
256AC_MSG_RESULT([$LIBZ])
257AC_SUBST([LIBZ])
258
259dnl Library name of lzlib suitable for 'dynamic-link'.
260GUIX_LIBLZ_FILE_NAME([LIBLZ])
261if test "x$LIBLZ" = "x"; then
262 LIBLZ="liblz"
263else
264 # Strip the .so or .so.1 extension since that's what 'dynamic-link' expects.
265 LIBLZ="`echo $LIBLZ | sed -es'/\.so\(\.[[0-9.]]\+\)\?//g'`"
266fi
267AC_SUBST([LIBLZ])
268
269dnl Check for Guile-SSH, for the (guix ssh) module.
270GUIX_CHECK_GUILE_SSH
271AM_CONDITIONAL([HAVE_GUILE_SSH],
272 [test "x$guix_cv_have_recent_guile_ssh" = "xyes"])
273
274AC_CACHE_SAVE
275
276m4_include([config-daemon.ac])
277
278dnl `dot' (from the Graphviz package) is only needed for maintainers.
279dnl See `Building from Git' in the manual for more info.
280AM_MISSING_PROG([DOT], [dot])
281
282dnl Manual pages.
283AM_MISSING_PROG([HELP2MAN], [help2man])
284
285dnl Documentation translation.
286AM_MISSING_PROG([PO4A_TRANSLATE], [po4a-translate])
287AM_MISSING_PROG([PO4A_UPDATEPO], [po4a-updatepo])
288
289dnl Emacs (optional), for 'etc/indent-code.el'.
290AC_PATH_PROG([EMACS], [emacs])
291if test "x$EMACS" = x; then
292 AC_MSG_WARN([Please install GNU Emacs to use etc/indent-code.el.])
293else
294 AC_SUBST([EMACS])
295 AC_CONFIG_FILES([etc/indent-code.el], [chmod +x etc/indent-code.el])
296fi
297
298case "$storedir" in
299 /gnu/store)
300 ;;
301 *)
302 AC_MSG_WARN([Using a store directory other than '/gnu/store' will prevent you])
303 AC_MSG_WARN([from downloading substitutes from gnu.org.])
304 ;;
305esac
306
307AC_CONFIG_FILES([Makefile
308 po/guix/Makefile.in
309 po/packages/Makefile.in
310 etc/guix-daemon.cil
311 guix/config.scm])
312
313AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
314AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
315 [chmod +x pre-inst-env])
316
317AC_OUTPUT