gnu: Add cl-claw.
[jackhill/guix/guix.git] / configure.ac
... / ...
CommitLineData
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.69])
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 AS_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 AS_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 AS_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 AS_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 AS_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.6])
106fi
107
108dnl Get CFLAGS and LDFLAGS for libguile.
109GUILE_FLAGS
110
111dnl Installation directories for .scm and .go files.
112guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
113guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
114AC_SUBST([guilemoduledir])
115AC_SUBST([guileobjectdir])
116
117dnl The GnuTLS bindings are necessary for substitutes over HTTPS and for 'guix
118dnl pull', among other things.
119GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)])
120if test "x$have_gnutls" != "xyes"; then
121 AC_MSG_ERROR([The Guile bindings of GnuTLS are missing; please install them.])
122fi
123
124dnl Check for Guile-Git.
125GUILE_MODULE_AVAILABLE([have_guile_git], [(git)])
126if test "x$have_guile_git" != "xyes"; then
127 AC_MSG_ERROR([Guile-Git is missing; please install it.])
128fi
129
130dnl Check for Guile-JSON.
131GUIX_CHECK_GUILE_JSON
132if test "x$guix_cv_have_recent_guile_json" != "xyes"; then
133 AC_MSG_ERROR([Guile-JSON is missing; please install it.])
134fi
135
136dnl Guile-Sqlite3 is used by the (guix store ...) modules.
137GUIX_CHECK_GUILE_SQLITE3
138if test "x$guix_cv_have_recent_guile_sqlite3" != "xyes"; then
139 AC_MSG_ERROR([A recent Guile-SQLite3 could not be found; please install it.])
140fi
141
142GUIX_CHECK_GUILE_GCRYPT
143if test "x$guix_cv_have_recent_guile_gcrypt" != "xyes"; then
144 AC_MSG_ERROR([A recent Guile-Gcrypt could not be found; please install it.])
145fi
146
147GUIX_CHECK_GUILE_GIT
148if test "x$guix_cv_have_recent_guile_git" != "xyes"; then
149 AC_MSG_ERROR([A recent Guile-Git could not be found; please install it.])
150fi
151
152dnl Check for Guile-zlib.
153GUILE_MODULE_AVAILABLE([have_guile_zlib], [(zlib)])
154if test "x$have_guile_zlib" != "xyes"; then
155 AC_MSG_ERROR([Guile-zlib is missing; please install it.])
156fi
157
158dnl Check for Guile-lzlib.
159GUILE_MODULE_AVAILABLE([have_guile_lzlib], [(lzlib)])
160if test "x$have_guile_lzlib" != "xyes"; then
161 AC_MSG_ERROR([Guile-lzlib is missing; please install it.])
162fi
163
164dnl Check for Guile-Avahi.
165GUILE_MODULE_AVAILABLE([have_guile_avahi], [(avahi)])
166AM_CONDITIONAL([HAVE_GUILE_AVAHI],
167 [test "x$have_guile_avahi" = "xyes"])
168
169dnl Guile-newt is used by the graphical installer.
170GUILE_MODULE_AVAILABLE([have_guile_newt], [(newt)])
171
172AC_ARG_ENABLE([installer],
173 AS_HELP_STRING([--enable-installer], [Build the graphical installer sources.]))
174
175AS_IF([test "x$enable_installer" = "xyes"], [
176if test "x$have_guile_newt" != "xyes"; then
177 AC_MSG_ERROR([Guile-newt could not be found; please install it.])
178fi
179])
180
181AM_CONDITIONAL([ENABLE_INSTALLER],
182 [test "x$enable_installer" = "xyes"])
183
184dnl Make sure we have a full-fledged Guile.
185GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
186
187AC_PROG_SED
188
189dnl Decompressors, for use by the substituter and other modules.
190AC_PATH_PROG([GZIP], [gzip])
191AC_PATH_PROG([BZIP2], [bzip2])
192AC_PATH_PROG([XZ], [xz])
193AC_SUBST([GZIP])
194AC_SUBST([BZIP2])
195AC_SUBST([XZ])
196
197AC_ARG_WITH([nixpkgs],
198 [AS_HELP_STRING([--with-nixpkgs=DIR],
199 [search for Nixpkgs in DIR (for testing purposes only)])],
200 [case "$withval" in
201 yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
202 *) NIXPKGS="$withval";;
203 esac],
204 [])
205
206AC_MSG_CHECKING([for Nixpkgs source tree])
207if test -f "$NIXPKGS/default.nix"; then
208 AC_MSG_RESULT([$NIXPKGS])
209 AC_SUBST([NIXPKGS])
210else
211 AC_MSG_RESULT([not found])
212fi
213
214LIBGCRYPT_LIBDIR="no"
215LIBGCRYPT_PREFIX="no"
216
217AC_ARG_WITH([libgcrypt-prefix],
218 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
219 [case "$withval" in
220 yes|no)
221 ;;
222 *)
223 LIBGCRYPT_PREFIX="$withval"
224 LIBGCRYPT_LIBDIR="$withval/lib"
225 ;;
226 esac])
227
228AC_ARG_WITH([libgcrypt-libdir],
229 [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
230 [search for GNU libgcrypt's shared library in DIR])],
231 [case "$withval" in
232 yes|no)
233 LIBGCRYPT_LIBDIR="no"
234 ;;
235 *)
236 LIBGCRYPT_LIBDIR="$withval"
237 ;;
238 esac])
239
240dnl If none of the --with-libgcrypt-* options was used, try to determine the
241dnl the library directory.
242case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
243 xnono)
244 GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
245 ;;
246esac
247
248AC_SUBST([LIBGCRYPT_PREFIX])
249AC_SUBST([LIBGCRYPT_LIBDIR])
250
251dnl Check for Guile-SSH, for the (guix ssh) module.
252GUIX_CHECK_GUILE_SSH
253AM_CONDITIONAL([HAVE_GUILE_SSH],
254 [test "x$guix_cv_have_recent_guile_ssh" = "xyes"])
255
256AC_CACHE_SAVE
257
258m4_include([config-daemon.ac])
259
260dnl `dot' (from the Graphviz package) is only needed for maintainers.
261dnl See `Building from Git' in the manual for more info.
262AM_MISSING_PROG([DOT], [dot])
263
264dnl Manual pages.
265AM_MISSING_PROG([HELP2MAN], [help2man])
266
267dnl Documentation translation.
268AM_MISSING_PROG([PO4A_TRANSLATE], [po4a-translate])
269AM_MISSING_PROG([PO4A_UPDATEPO], [po4a-updatepo])
270
271case "$storedir" in
272 /gnu/store)
273 ;;
274 *)
275 AC_MSG_WARN([Using a store directory other than '/gnu/store' will prevent you])
276 AC_MSG_WARN([from downloading substitutes from gnu.org.])
277 ;;
278esac
279
280AC_CONFIG_FILES([Makefile
281 po/guix/Makefile.in
282 po/packages/Makefile.in
283 etc/guix-daemon.cil
284 guix/config.scm])
285
286AC_CONFIG_FILES([etc/committer.scm], [chmod +x etc/committer.scm])
287AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
288AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
289 [chmod +x pre-inst-env])
290
291AC_OUTPUT