build: Add a check for Guile-Lib.
[jackhill/guix/guix.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ([2.69])
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 GUIX_CHANNEL_METADATA
29
30 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"])
31
32 AC_ARG_WITH(store-dir,
33 AS_HELP_STRING([--with-store-dir=PATH],
34 [file name of the store (defaults to /gnu/store)]),
35 [storedir="$withval"],
36 [storedir="/gnu/store"])
37 AC_SUBST(storedir)
38
39 AC_ARG_WITH([bash-completion-dir],
40 AS_HELP_STRING([--with-bash-completion-dir=DIR],
41 [name of the Bash completion directory]),
42 [bashcompletiondir="$withval"],
43 [bashcompletiondir='${sysconfdir}/bash_completion.d'])
44 AC_SUBST([bashcompletiondir])
45
46 AC_ARG_WITH([zsh-completion-dir],
47 AS_HELP_STRING([--with-zsh-completion-dir=DIR],
48 [name of the Zsh completion directory]),
49 [zshcompletiondir="$withval"],
50 [zshcompletiondir='${datadir}/zsh/site-functions'])
51 AC_SUBST([zshcompletiondir])
52
53 AC_ARG_WITH([fish-completion-dir],
54 AS_HELP_STRING([--with-fish-completion-dir=DIR],
55 [name of the Fish completion directory]),
56 [fishcompletiondir="$withval"],
57 [fishcompletiondir='${datadir}/fish/vendor_completions.d'])
58 AC_SUBST([fishcompletiondir])
59
60 AC_ARG_WITH([selinux-policy-dir],
61 AS_HELP_STRING([--with-selinux-policy-dir=DIR],
62 [name of the SELinux policy directory]),
63 [selinux_policydir="$withval"],
64 [selinux_policydir='${datadir}/selinux/'])
65 AC_SUBST([selinux_policydir])
66
67 dnl Better be verbose.
68 AC_MSG_CHECKING([for the store directory])
69 AC_MSG_RESULT([$storedir])
70
71 AC_ARG_ENABLE([daemon],
72 [AS_HELP_STRING([--disable-daemon], [do not build the Nix daemon (C++)])],
73 [guix_build_daemon="$enableval"],
74 [guix_build_daemon="yes"])
75
76 # Prepare a version of $localstatedir & co. that does not contain references
77 # to shell variables.
78 guix_prefix="`eval echo $prefix | sed -e"s|NONE|/usr/local|g"`"
79 guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|$guix_prefix|g"`"
80 guix_sysconfdir="`eval echo $sysconfdir | sed -e "s|NONE|$guix_prefix|g"`"
81 guix_sbindir="`eval echo $sbindir | sed -e "s|NONE|$guix_prefix|g"`"
82 AC_SUBST([guix_localstatedir])
83 AC_SUBST([guix_sysconfdir])
84 AC_SUBST([guix_sbindir])
85
86 GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests])
87 AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"])
88
89 dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.)
90 dnl Make sure they are available.
91 m4_pattern_forbid([PKG_CHECK_MODULES])
92 m4_pattern_forbid([GUILE_MODULE_AVAILABLE])
93 m4_pattern_forbid([^GUILE_P])
94 m4_pattern_allow([^GUILE_PKG_ERRORS])
95 m4_pattern_forbid([^GUIX_])
96
97 dnl Search for 'guile' and 'guild'. This macro defines
98 dnl 'GUILE_EFFECTIVE_VERSION'.
99 GUILE_PKG([3.0 2.2])
100 GUILE_PROGS
101 if test "x$GUILD" = "x"; then
102 AC_MSG_ERROR(['guild' binary not found; please check your Guile installation.])
103 fi
104
105 if test "x$GUILE_EFFECTIVE_VERSION" = "x2.2"; then
106 PKG_CHECK_MODULES([GUILE], [guile-2.2 >= 2.2.6])
107 fi
108
109 dnl Get CFLAGS and LDFLAGS for libguile.
110 GUILE_FLAGS
111
112 dnl Installation directories for .scm and .go files.
113 guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
114 guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
115 AC_SUBST([guilemoduledir])
116 AC_SUBST([guileobjectdir])
117
118 dnl The GnuTLS bindings are necessary for substitutes over HTTPS and for 'guix
119 dnl pull', among other things.
120 GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)])
121 if test "x$have_gnutls" != "xyes"; then
122 AC_MSG_ERROR([The Guile bindings of GnuTLS are missing; please install them.])
123 fi
124
125 dnl Check for Guile-Git.
126 GUILE_MODULE_AVAILABLE([have_guile_git], [(git)])
127 if test "x$have_guile_git" != "xyes"; then
128 AC_MSG_ERROR([Guile-Git is missing; please install it.])
129 fi
130
131 dnl Check for Guile-JSON.
132 GUIX_CHECK_GUILE_JSON
133 if test "x$guix_cv_have_recent_guile_json" != "xyes"; then
134 AC_MSG_ERROR([Guile-JSON is missing; please install it.])
135 fi
136
137 dnl Guile-Sqlite3 is used by the (guix store ...) modules.
138 GUIX_CHECK_GUILE_SQLITE3
139 if test "x$guix_cv_have_recent_guile_sqlite3" != "xyes"; then
140 AC_MSG_ERROR([A recent Guile-SQLite3 could not be found; please install it.])
141 fi
142
143 GUIX_CHECK_GUILE_GCRYPT
144 if test "x$guix_cv_have_recent_guile_gcrypt" != "xyes"; then
145 AC_MSG_ERROR([A recent Guile-Gcrypt could not be found; please install it.])
146 fi
147
148 GUIX_CHECK_GUILE_GIT
149 if test "x$guix_cv_have_recent_guile_git" != "xyes"; then
150 AC_MSG_ERROR([A recent Guile-Git could not be found; please install it.])
151 fi
152
153 dnl Check for the optional Guile-Lib.
154 GUILE_MODULE_EXPORTS([have_guile_lib], [(htmlprag)], [%strict-tokenizer?])
155 AM_CONDITIONAL([HAVE_GUILE_LIB], [test "x$have_guile_lib" = "xyes"])
156 AM_COND_IF(HAVE_GUILE_LIB,,
157 [AC_MSG_WARN([The Guile-Lib requirement was not satisfied (>= 0.2.7);
158 Some features such as the Go importer will not be usable.])])
159
160 dnl Check for Guile-zlib.
161 GUIX_CHECK_GUILE_ZLIB
162 if test "x$guix_cv_have_recent_guile_zlib" != "xyes"; then
163 AC_MSG_ERROR([A recent Guile-zlib could not be found; please install it.])
164 fi
165
166 dnl Check for Guile-lzlib.
167 GUILE_MODULE_AVAILABLE([have_guile_lzlib], [(lzlib)])
168 if test "x$have_guile_lzlib" != "xyes"; then
169 AC_MSG_ERROR([Guile-lzlib is missing; please install it.])
170 fi
171
172 dnl Check for Guile-Avahi.
173 GUILE_MODULE_AVAILABLE([have_guile_avahi], [(avahi)])
174 AM_CONDITIONAL([HAVE_GUILE_AVAHI],
175 [test "x$have_guile_avahi" = "xyes"])
176
177 dnl Guile-newt is used by the graphical installer.
178 GUILE_MODULE_AVAILABLE([have_guile_newt], [(newt)])
179
180 AC_ARG_ENABLE([installer],
181 AS_HELP_STRING([--enable-installer], [Build the graphical installer sources.]))
182
183 AS_IF([test "x$enable_installer" = "xyes"], [
184 if test "x$have_guile_newt" != "xyes"; then
185 AC_MSG_ERROR([Guile-newt could not be found; please install it.])
186 fi
187 ])
188
189 AM_CONDITIONAL([ENABLE_INSTALLER],
190 [test "x$enable_installer" = "xyes"])
191
192 dnl Make sure we have a full-fledged Guile.
193 GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
194
195 AC_PROG_SED
196
197 dnl Decompressors, for use by the substituter and other modules.
198 AC_PATH_PROG([GZIP], [gzip])
199 AC_PATH_PROG([BZIP2], [bzip2])
200 AC_PATH_PROG([XZ], [xz])
201 AC_SUBST([GZIP])
202 AC_SUBST([BZIP2])
203 AC_SUBST([XZ])
204
205 AC_ARG_WITH([nixpkgs],
206 [AS_HELP_STRING([--with-nixpkgs=DIR],
207 [search for Nixpkgs in DIR (for testing purposes only)])],
208 [case "$withval" in
209 yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
210 *) NIXPKGS="$withval";;
211 esac],
212 [])
213
214 AC_MSG_CHECKING([for Nixpkgs source tree])
215 if test -f "$NIXPKGS/default.nix"; then
216 AC_MSG_RESULT([$NIXPKGS])
217 AC_SUBST([NIXPKGS])
218 else
219 AC_MSG_RESULT([not found])
220 fi
221
222 LIBGCRYPT_LIBDIR="no"
223 LIBGCRYPT_PREFIX="no"
224
225 AC_ARG_WITH([libgcrypt-prefix],
226 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
227 [case "$withval" in
228 yes|no)
229 ;;
230 *)
231 LIBGCRYPT_PREFIX="$withval"
232 LIBGCRYPT_LIBDIR="$withval/lib"
233 ;;
234 esac])
235
236 AC_ARG_WITH([libgcrypt-libdir],
237 [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
238 [search for GNU libgcrypt's shared library in DIR])],
239 [case "$withval" in
240 yes|no)
241 LIBGCRYPT_LIBDIR="no"
242 ;;
243 *)
244 LIBGCRYPT_LIBDIR="$withval"
245 ;;
246 esac])
247
248 dnl If none of the --with-libgcrypt-* options was used, try to determine the
249 dnl the library directory.
250 case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
251 xnono)
252 GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
253 ;;
254 esac
255
256 AC_SUBST([LIBGCRYPT_PREFIX])
257 AC_SUBST([LIBGCRYPT_LIBDIR])
258
259 dnl Check for Guile-SSH, for the (guix ssh) module.
260 GUIX_CHECK_GUILE_SSH
261 AM_CONDITIONAL([HAVE_GUILE_SSH],
262 [test "x$guix_cv_have_recent_guile_ssh" = "xyes"])
263
264 AC_CACHE_SAVE
265
266 m4_include([config-daemon.ac])
267
268 dnl `dot' (from the Graphviz package) is only needed for maintainers.
269 dnl See `Building from Git' in the manual for more info.
270 AM_MISSING_PROG([DOT], [dot])
271
272 dnl Manual pages.
273 AM_MISSING_PROG([HELP2MAN], [help2man])
274
275 dnl Documentation translation.
276 AM_MISSING_PROG([PO4A_TRANSLATE], [po4a-translate])
277 AM_MISSING_PROG([PO4A_UPDATEPO], [po4a-updatepo])
278
279 case "$storedir" in
280 /gnu/store)
281 ;;
282 *)
283 AC_MSG_WARN([Using a store directory other than '/gnu/store' will prevent you])
284 AC_MSG_WARN([from downloading substitutes from gnu.org.])
285 ;;
286 esac
287
288 AC_CONFIG_FILES([Makefile
289 po/guix/Makefile.in
290 po/packages/Makefile.in
291 etc/guix-daemon.cil
292 guix/config.scm])
293
294 AC_CONFIG_FILES([etc/committer.scm], [chmod +x etc/committer.scm])
295 AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
296 AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
297 [chmod +x pre-inst-env])
298
299 AC_OUTPUT