Add Avahi support.
[jackhill/guix/guix.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.68)
5 AC_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/])
9 AC_CONFIG_AUX_DIR([build-aux])
10
11 AM_INIT_AUTOMAKE([1.14 gnu silent-rules subdir-objects \
12 color-tests parallel-tests -Woverride -Wno-portability])
13
14 # Enable silent rules by default.
15 AM_SILENT_RULES([yes])
16
17 AC_CONFIG_SRCDIR([guix.scm])
18 AC_CONFIG_MACRO_DIR([m4])
19
20 dnl For the C++ code. This must be used early.
21 AC_USE_SYSTEM_EXTENSIONS
22
23 AM_GNU_GETTEXT([external])
24 AM_GNU_GETTEXT_VERSION([0.18.1])
25
26 GUIX_SYSTEM_TYPE
27 GUIX_ASSERT_SUPPORTED_SYSTEM
28
29 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"])
30
31 AC_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"])
36 AC_SUBST(storedir)
37
38 AC_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'])
43 AC_SUBST([bashcompletiondir])
44
45 AC_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'])
50 AC_SUBST([zshcompletiondir])
51
52 AC_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'])
57 AC_SUBST([fishcompletiondir])
58
59 AC_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/'])
64 AC_SUBST([selinux_policydir])
65
66 dnl Better be verbose.
67 AC_MSG_CHECKING([for the store directory])
68 AC_MSG_RESULT([$storedir])
69
70 AC_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.
77 guix_prefix="`eval echo $prefix | sed -e"s|NONE|/usr/local|g"`"
78 guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|$guix_prefix|g"`"
79 guix_sysconfdir="`eval echo $sysconfdir | sed -e "s|NONE|$guix_prefix|g"`"
80 guix_sbindir="`eval echo $sbindir | sed -e "s|NONE|$guix_prefix|g"`"
81 AC_SUBST([guix_localstatedir])
82 AC_SUBST([guix_sysconfdir])
83 AC_SUBST([guix_sbindir])
84
85 GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests])
86 AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"])
87
88 dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.)
89 dnl Make sure they are available.
90 m4_pattern_forbid([PKG_CHECK_MODULES])
91 m4_pattern_forbid([GUILE_MODULE_AVAILABLE])
92 m4_pattern_forbid([^GUILE_P])
93 m4_pattern_allow([^GUILE_PKG_ERRORS])
94 m4_pattern_forbid([^GUIX_])
95
96 dnl Search for 'guile' and 'guild'. This macro defines
97 dnl 'GUILE_EFFECTIVE_VERSION'.
98 GUILE_PKG([3.0 2.2])
99 GUILE_PROGS
100 if test "x$GUILD" = "x"; then
101 AC_MSG_ERROR(['guild' binary not found; please check your Guile installation.])
102 fi
103
104 if test "x$GUILE_EFFECTIVE_VERSION" = "x2.2"; then
105 PKG_CHECK_MODULES([GUILE], [guile-2.2 >= 2.2.3])
106 fi
107
108 dnl Get CFLAGS and LDFLAGS for libguile.
109 GUILE_FLAGS
110
111 dnl Installation directories for .scm and .go files.
112 guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
113 guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
114 AC_SUBST([guilemoduledir])
115 AC_SUBST([guileobjectdir])
116
117 dnl The GnuTLS bindings are necessary for substitutes over HTTPS and for 'guix
118 dnl pull', among other things.
119 GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)])
120 if test "x$have_gnutls" != "xyes"; then
121 AC_MSG_ERROR([The Guile bindings of GnuTLS are missing; please install them.])
122 fi
123
124 dnl Check for Guile-Git.
125 GUILE_MODULE_AVAILABLE([have_guile_git], [(git)])
126 if test "x$have_guile_git" != "xyes"; then
127 AC_MSG_ERROR([Guile-Git is missing; please install it.])
128 fi
129
130 dnl Check for Guile-JSON.
131 GUIX_CHECK_GUILE_JSON
132 if test "x$guix_cv_have_recent_guile_json" != "xyes"; then
133 AC_MSG_ERROR([Guile-JSON is missing; please install it.])
134 fi
135
136 dnl Guile-Sqlite3 is used by the (guix store ...) modules.
137 GUIX_CHECK_GUILE_SQLITE3
138 if 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.])
140 fi
141
142 GUIX_CHECK_GUILE_GCRYPT
143 if 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.])
145 fi
146
147 GUIX_CHECK_GUILE_GIT
148 if 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.])
150 fi
151
152 dnl Check for Guile-zlib.
153 GUILE_MODULE_AVAILABLE([have_guile_zlib], [(zlib)])
154 if test "x$have_guile_zlib" != "xyes"; then
155 AC_MSG_ERROR([Guile-zlib is missing; please install it.])
156 fi
157
158 dnl Check for Guile-lzlib.
159 GUILE_MODULE_AVAILABLE([have_guile_lzlib], [(lzlib)])
160 if test "x$have_guile_lzlib" != "xyes"; then
161 AC_MSG_ERROR([Guile-lzlib is missing; please install it.])
162 fi
163
164 dnl Check for Guile-Avahi.
165 GUILE_MODULE_AVAILABLE([have_guile_avahi], [(avahi)])
166 if test "x$have_guile_avahi" != "xyes"; then
167 AC_MSG_ERROR([Guile-Avahi is missing; please install it.])
168 fi
169
170 dnl Guile-newt is used by the graphical installer.
171 GUILE_MODULE_AVAILABLE([have_guile_newt], [(newt)])
172
173 AC_ARG_ENABLE([installer],
174 AS_HELP_STRING([--enable-installer], [Build the graphical installer sources.]))
175
176 AS_IF([test "x$enable_installer" = "xyes"], [
177 if test "x$have_guile_newt" != "xyes"; then
178 AC_MSG_ERROR([Guile-newt could not be found; please install it.])
179 fi
180 ])
181
182 AM_CONDITIONAL([ENABLE_INSTALLER],
183 [test "x$enable_installer" = "xyes"])
184
185 dnl Make sure we have a full-fledged Guile.
186 GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
187
188 AC_PROG_SED
189
190 dnl Decompressors, for use by the substituter and other modules.
191 AC_PATH_PROG([GZIP], [gzip])
192 AC_PATH_PROG([BZIP2], [bzip2])
193 AC_PATH_PROG([XZ], [xz])
194 AC_SUBST([GZIP])
195 AC_SUBST([BZIP2])
196 AC_SUBST([XZ])
197
198 AC_ARG_WITH([nix-prefix],
199 [AS_HELP_STRING([--with-nix-prefix=DIR],
200 [search for Nix in DIR (for testing purposes and '--disable-daemon' builds)])],
201 [case "$withval" in
202 yes|no) ;;
203 *)
204 NIX_PREFIX="$withval"
205 PATH="$NIX_PREFIX/bin:$PATH"; export PATH
206 AC_SUBST([NIX_PREFIX])
207 ;;
208 esac],
209 [])
210
211 AC_ARG_WITH([nixpkgs],
212 [AS_HELP_STRING([--with-nixpkgs=DIR],
213 [search for Nixpkgs in DIR (for testing purposes only)])],
214 [case "$withval" in
215 yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
216 *) NIXPKGS="$withval";;
217 esac],
218 [])
219
220 AC_MSG_CHECKING([for Nixpkgs source tree])
221 if test -f "$NIXPKGS/default.nix"; then
222 AC_MSG_RESULT([$NIXPKGS])
223 AC_SUBST([NIXPKGS])
224 else
225 AC_MSG_RESULT([not found])
226 fi
227
228 LIBGCRYPT_LIBDIR="no"
229 LIBGCRYPT_PREFIX="no"
230
231 AC_ARG_WITH([libgcrypt-prefix],
232 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
233 [case "$withval" in
234 yes|no)
235 ;;
236 *)
237 LIBGCRYPT_PREFIX="$withval"
238 LIBGCRYPT_LIBDIR="$withval/lib"
239 ;;
240 esac])
241
242 AC_ARG_WITH([libgcrypt-libdir],
243 [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
244 [search for GNU libgcrypt's shared library in DIR])],
245 [case "$withval" in
246 yes|no)
247 LIBGCRYPT_LIBDIR="no"
248 ;;
249 *)
250 LIBGCRYPT_LIBDIR="$withval"
251 ;;
252 esac])
253
254 dnl If none of the --with-libgcrypt-* options was used, try to determine the
255 dnl the library directory.
256 case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
257 xnono)
258 GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
259 ;;
260 esac
261
262 AC_SUBST([LIBGCRYPT_PREFIX])
263 AC_SUBST([LIBGCRYPT_LIBDIR])
264
265 dnl Check for Guile-SSH, for the (guix ssh) module.
266 GUIX_CHECK_GUILE_SSH
267 AM_CONDITIONAL([HAVE_GUILE_SSH],
268 [test "x$guix_cv_have_recent_guile_ssh" = "xyes"])
269
270 AC_CACHE_SAVE
271
272 m4_include([config-daemon.ac])
273
274 dnl `dot' (from the Graphviz package) is only needed for maintainers.
275 dnl See `Building from Git' in the manual for more info.
276 AM_MISSING_PROG([DOT], [dot])
277
278 dnl Manual pages.
279 AM_MISSING_PROG([HELP2MAN], [help2man])
280
281 dnl Documentation translation.
282 AM_MISSING_PROG([PO4A_TRANSLATE], [po4a-translate])
283 AM_MISSING_PROG([PO4A_UPDATEPO], [po4a-updatepo])
284
285 case "$storedir" in
286 /gnu/store)
287 ;;
288 *)
289 AC_MSG_WARN([Using a store directory other than '/gnu/store' will prevent you])
290 AC_MSG_WARN([from downloading substitutes from gnu.org.])
291 ;;
292 esac
293
294 AC_CONFIG_FILES([Makefile
295 po/guix/Makefile.in
296 po/packages/Makefile.in
297 etc/guix-daemon.cil
298 guix/config.scm])
299
300 AC_CONFIG_FILES([etc/committer.scm], [chmod +x etc/committer.scm])
301 AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
302 AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
303 [chmod +x pre-inst-env])
304
305 AC_OUTPUT