Make "guile-avahi" dependency optional.
[jackhill/guix/guix.git] / configure.ac
CommitLineData
af51c820
LC
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.68)
e6860b5e
LC
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/])
af51c820
LC
9AC_CONFIG_AUX_DIR([build-aux])
10
05c4e379 11AM_INIT_AUTOMAKE([1.14 gnu silent-rules subdir-objects \
a84e523c 12 color-tests parallel-tests -Woverride -Wno-portability])
af51c820 13
032c7c5f
LC
14# Enable silent rules by default.
15AM_SILENT_RULES([yes])
16
af51c820
LC
17AC_CONFIG_SRCDIR([guix.scm])
18AC_CONFIG_MACRO_DIR([m4])
19
c2033df4
LC
20dnl For the C++ code. This must be used early.
21AC_USE_SYSTEM_EXTENSIONS
22
f68b0893 23AM_GNU_GETTEXT([external])
5ac12a4f 24AM_GNU_GETTEXT_VERSION([0.18.1])
f68b0893 25
c2033df4 26GUIX_SYSTEM_TYPE
b97556d7 27GUIX_ASSERT_SUPPORTED_SYSTEM
c2033df4 28
62bc3c5b
LC
29AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"])
30
c2033df4
LC
31AC_ARG_WITH(store-dir,
32 AC_HELP_STRING([--with-store-dir=PATH],
834129e0 33 [file name of the store (defaults to /gnu/store)]),
c2033df4 34 [storedir="$withval"],
834129e0 35 [storedir="/gnu/store"])
c2033df4 36AC_SUBST(storedir)
73d96596 37
ee3e157d
LC
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
96dbc930
ELB
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
b83fc85f 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
b617a9fe
RW
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
834129e0
LC
66dnl Better be verbose.
67AC_MSG_CHECKING([for the store directory])
68AC_MSG_RESULT([$storedir])
69
3a61f801 70AC_ARG_ENABLE([daemon],
a4c1e99e 71 [AS_HELP_STRING([--disable-daemon], [do not build the Nix daemon (C++)])],
3a61f801 72 [guix_build_daemon="$enableval"],
c9b70836 73 [guix_build_daemon="yes"])
3a61f801 74
3f40cfde 75# Prepare a version of $localstatedir & co. that does not contain references
d8eea3d2 76# to shell variables.
6bfec3ed
LC
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"`"
d8eea3d2 81AC_SUBST([guix_localstatedir])
3f40cfde 82AC_SUBST([guix_sysconfdir])
6bfec3ed 83AC_SUBST([guix_sbindir])
d8eea3d2 84
bb251307
LC
85GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests])
86AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"])
2178ed66 87
0e991c25
LC
88dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.)
89dnl Make sure they are available.
ff1cbb95 90m4_pattern_forbid([PKG_CHECK_MODULES])
0e991c25 91m4_pattern_forbid([GUILE_MODULE_AVAILABLE])
dde49cfe
LC
92m4_pattern_forbid([^GUILE_P])
93m4_pattern_allow([^GUILE_PKG_ERRORS])
28f436a9 94m4_pattern_forbid([^GUIX_])
ff1cbb95 95
608e42e7
LC
96dnl Search for 'guile' and 'guild'. This macro defines
97dnl 'GUILE_EFFECTIVE_VERSION'.
7b2a47a7 98GUILE_PKG([3.0 2.2])
9d126aa2 99GUILE_PROGS
73f9a978 100if test "x$GUILD" = "x"; then
e688c2df
LC
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])
73f9a978 106fi
af51c820 107
880fe019
LC
108dnl Get CFLAGS and LDFLAGS for libguile.
109GUILE_FLAGS
110
9437fd73 111dnl Installation directories for .scm and .go files.
301d73f6 112guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
9437fd73 113guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
301d73f6 114AC_SUBST([guilemoduledir])
9437fd73 115AC_SUBST([guileobjectdir])
301d73f6 116
1dbe3a8d
LC
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
7441f1db
LC
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
6776af04 130dnl Check for Guile-JSON.
81c3dc32
LC
131GUIX_CHECK_GUILE_JSON
132if test "x$guix_cv_have_recent_guile_json" != "xyes"; then
6776af04
EB
133 AC_MSG_ERROR([Guile-JSON is missing; please install it.])
134fi
1b3e9685 135
d59e75f3
LC
136dnl Guile-Sqlite3 is used by the (guix store ...) modules.
137GUIX_CHECK_GUILE_SQLITE3
c5a2e1ff
LC
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
d59e75f3 141
c1dc50ab
LC
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.])
ca719424
LC
145fi
146
59bb1ae3
LC
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
4c0c65ac
MO
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
375cc7de
MO
164dnl Check for Guile-Avahi.
165GUILE_MODULE_AVAILABLE([have_guile_avahi], [(avahi)])
35a32fef
MO
166AM_CONDITIONAL([HAVE_GUILE_AVAHI],
167 [test "x$have_guile_avahi" = "xyes"])
375cc7de 168
d0f3a672
MO
169dnl Guile-newt is used by the graphical installer.
170GUILE_MODULE_AVAILABLE([have_guile_newt], [(newt)])
7d328e34
MO
171
172AC_ARG_ENABLE([installer],
173 AS_HELP_STRING([--enable-installer], [Build the graphical installer sources.]))
174
175AS_IF([test "x$enable_installer" = "xyes"], [
d0f3a672
MO
176if test "x$have_guile_newt" != "xyes"; then
177 AC_MSG_ERROR([Guile-newt could not be found; please install it.])
178fi
7d328e34
MO
179])
180
181AM_CONDITIONAL([ENABLE_INSTALLER],
182 [test "x$enable_installer" = "xyes"])
d0f3a672 183
9c7dd33a
LC
184dnl Make sure we have a full-fledged Guile.
185GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
186
cba386c1
ML
187AC_PROG_SED
188
cd48eae5
LC
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
af51c820 197AC_ARG_WITH([nix-prefix],
bb0a70e1
LC
198 [AS_HELP_STRING([--with-nix-prefix=DIR],
199 [search for Nix in DIR (for testing purposes and '--disable-daemon' builds)])],
af51c820
LC
200 [case "$withval" in
201 yes|no) ;;
437e0729
LC
202 *)
203 NIX_PREFIX="$withval"
204 PATH="$NIX_PREFIX/bin:$PATH"; export PATH
205 AC_SUBST([NIX_PREFIX])
206 ;;
af51c820
LC
207 esac],
208 [])
209
af51c820 210AC_ARG_WITH([nixpkgs],
bb0a70e1
LC
211 [AS_HELP_STRING([--with-nixpkgs=DIR],
212 [search for Nixpkgs in DIR (for testing purposes only)])],
af51c820
LC
213 [case "$withval" in
214 yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
215 *) NIXPKGS="$withval";;
216 esac],
217 [])
218
e76bdf8b 219AC_MSG_CHECKING([for Nixpkgs source tree])
af51c820 220if test -f "$NIXPKGS/default.nix"; then
af51c820
LC
221 AC_MSG_RESULT([$NIXPKGS])
222 AC_SUBST([NIXPKGS])
223else
e76bdf8b 224 AC_MSG_RESULT([not found])
af51c820
LC
225fi
226
dd01fecd
LC
227LIBGCRYPT_LIBDIR="no"
228LIBGCRYPT_PREFIX="no"
229
3a310cc0
LC
230AC_ARG_WITH([libgcrypt-prefix],
231 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
232 [case "$withval" in
233 yes|no)
3a310cc0
LC
234 ;;
235 *)
d388c2c4 236 LIBGCRYPT_PREFIX="$withval"
14af289e 237 LIBGCRYPT_LIBDIR="$withval/lib"
3a310cc0 238 ;;
dd01fecd 239 esac])
3a310cc0 240
14af289e
LC
241AC_ARG_WITH([libgcrypt-libdir],
242 [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
243 [search for GNU libgcrypt's shared library in DIR])],
244 [case "$withval" in
245 yes|no)
14af289e
LC
246 LIBGCRYPT_LIBDIR="no"
247 ;;
248 *)
14af289e
LC
249 LIBGCRYPT_LIBDIR="$withval"
250 ;;
dd01fecd
LC
251 esac])
252
253dnl If none of the --with-libgcrypt-* options was used, try to determine the
ca719424 254dnl the library directory.
dd01fecd
LC
255case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
256 xnono)
257 GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
dd01fecd
LC
258 ;;
259esac
14af289e 260
d388c2c4 261AC_SUBST([LIBGCRYPT_PREFIX])
14af289e 262AC_SUBST([LIBGCRYPT_LIBDIR])
d388c2c4 263
987a29ba
LC
264dnl Check for Guile-SSH, for the (guix ssh) module.
265GUIX_CHECK_GUILE_SSH
266AM_CONDITIONAL([HAVE_GUILE_SSH],
267 [test "x$guix_cv_have_recent_guile_ssh" = "xyes"])
268
c2033df4
LC
269AC_CACHE_SAVE
270
271m4_include([config-daemon.ac])
3a310cc0 272
cb9e50f6 273dnl `dot' (from the Graphviz package) is only needed for maintainers.
8c01b9d0 274dnl See `Building from Git' in the manual for more info.
cb9e50f6
LC
275AM_MISSING_PROG([DOT], [dot])
276
52eca736
LC
277dnl Manual pages.
278AM_MISSING_PROG([HELP2MAN], [help2man])
279
b9fe8fd6
JL
280dnl Documentation translation.
281AM_MISSING_PROG([PO4A_TRANSLATE], [po4a-translate])
282AM_MISSING_PROG([PO4A_UPDATEPO], [po4a-updatepo])
283
d480ed7e
LC
284case "$storedir" in
285 /gnu/store)
286 ;;
287 *)
288 AC_MSG_WARN([Using a store directory other than '/gnu/store' will prevent you])
289 AC_MSG_WARN([from downloading substitutes from gnu.org.])
290 ;;
291esac
292
14a1c319 293AC_CONFIG_FILES([Makefile
ef1a9bb7 294 po/guix/Makefile.in
ee764179 295 po/packages/Makefile.in
b617a9fe
RW
296 etc/guix-daemon.cil
297 guix/config.scm])
8dc2ecfc 298
76a841cc 299AC_CONFIG_FILES([etc/committer.scm], [chmod +x etc/committer.scm])
a1097caa
ML
300AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
301AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
302 [chmod +x pre-inst-env])
af51c820
LC
303
304AC_OUTPUT