projects/guix·blob science-team · refs

340 lines · 10.8 KiB

1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3#
4# GNU Guix --- Functional package management for GNU
5# Copyright © 2012-2021, 2022-2023, 2025 Ludovic Courtès <[email protected]>
6# Copyright © 2013, 2016 Mark H Weaver <[email protected]>
7# Copyright © 2014-2016 Alex Kost <[email protected]>
8# Copyright © 2014-2016 David Thompson <[email protected]>
9# Copyright © 2015-2016, 2018 Mathieu Lirzin <[email protected]>
10# Copyright © 2015-2020 Mathieu Othacehe <[email protected]>
11# Copyright © 2016 Eric Le Bihan <[email protected]>
12# Copyright © 2016, 2018, 2020, 2022 Ricardo Wurmus <[email protected]>
13# Copyright © 2017 Tobias Geerinckx-Rice <[email protected]>
14# Copyright © 2018 nikita <[email protected]>
15# Copyright © 2018, 2021 Julien Lepiller <[email protected]>
16# Copyright © 2017-2018 Eric Bavier <[email protected]>
17# Copyright © 2020-2021, 2023-2024 Maxim Cournoyer <[email protected]>
18# Copyright © 2024 Janneke Nieuwenhuizen <[email protected]>
19# Copyright © 2024 gemmaro <[email protected]>
20
21AC_PREREQ([2.69])
22AC_INIT([GNU Guix],
23 [m4_esyscmd([build-aux/git-version-gen .tarball-version])],
24 [https://codeberg.org/guix/guix/issues/], [guix],
25 [https://www.gnu.org/software/guix/])
26AC_CONFIG_AUX_DIR([build-aux])
27
28AM_INIT_AUTOMAKE([1.14 gnu tar-ustar silent-rules subdir-objects \
29 color-tests parallel-tests -Woverride -Wno-portability])
30
31# Enable silent rules by default.
32AM_SILENT_RULES([yes])
33
34AC_CONFIG_SRCDIR([guix.scm])
35AC_CONFIG_MACRO_DIR([m4])
36
37dnl For the C++ code. This must be used early.
38AC_USE_SYSTEM_EXTENSIONS
39
40AM_GNU_GETTEXT([external])
41AM_GNU_GETTEXT_VERSION([0.19.1])
42
43GUIX_SYSTEM_TYPE
44GUIX_ASSERT_SUPPORTED_SYSTEM
45GUIX_CHANNEL_METADATA
46
47AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"])
48
49AC_ARG_WITH(store-dir,
50 AS_HELP_STRING([--with-store-dir=PATH],
51 [file name of the store (defaults to /gnu/store)]),
52 [storedir="$withval"],
53 [storedir="/gnu/store"])
54AC_SUBST(storedir)
55
56AC_ARG_WITH([bash-completion-dir],
57 AS_HELP_STRING([--with-bash-completion-dir=DIR],
58 [name of the Bash completion directory]),
59 [bashcompletiondir="$withval"],
60 [bashcompletiondir='${sysconfdir}/bash_completion.d'])
61AC_SUBST([bashcompletiondir])
62
63AC_ARG_WITH([zsh-completion-dir],
64 AS_HELP_STRING([--with-zsh-completion-dir=DIR],
65 [name of the Zsh completion directory]),
66 [zshcompletiondir="$withval"],
67 [zshcompletiondir='${datadir}/zsh/site-functions'])
68AC_SUBST([zshcompletiondir])
69
70AC_ARG_WITH([fish-completion-dir],
71 AS_HELP_STRING([--with-fish-completion-dir=DIR],
72 [name of the Fish completion directory]),
73 [fishcompletiondir="$withval"],
74 [fishcompletiondir='${datadir}/fish/vendor_completions.d'])
75AC_SUBST([fishcompletiondir])
76
77AC_ARG_WITH([selinux-policy-dir],
78 AS_HELP_STRING([--with-selinux-policy-dir=DIR],
79 [name of the SELinux policy directory]),
80 [selinux_policydir="$withval"],
81 [selinux_policydir='${datadir}/selinux/'])
82AC_SUBST([selinux_policydir])
83
84AC_ARG_WITH([apparmor-profile-dir],
85 AS_HELP_STRING([--with-apparmor-profile-dir=DIR],
86 [name of the AppArmor profile directory]),
87 [apparmor_profiledir="$withval"],
88 [apparmor_profiledir='${sysconfdir}/apparmor.d'])
89AC_SUBST([apparmor_profiledir])
90apparmor_profile_tunablesdir='${apparmor_profiledir}/tunables'
91AC_SUBST([apparmor_profile_tunablesdir])
92
93dnl Better be verbose.
94AC_MSG_CHECKING([for the store directory])
95AC_MSG_RESULT([$storedir])
96
97AC_ARG_ENABLE([daemon],
98 [AS_HELP_STRING([--disable-daemon], [do not build the Nix daemon (C++)])],
99 [guix_build_daemon="$enableval"],
100 [guix_build_daemon="yes"])
101
102dnl Prepare a version of $localstatedir & co. that does not contain references
103dnl to shell variables. Also set some sane default directory variables for
104dnl use with the Guix. This also causes localstatedir to be /var and
105dnl sysconfdir to be /etc.
106AC_PREFIX_DEFAULT()
107guix_prefix="`eval echo $prefix | sed -e"s|NONE|$ac_default_prefix|g"`"
108guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|$guix_prefix|g"`"
109guix_sysconfdir="`eval echo $sysconfdir | sed -e "s|NONE|$guix_prefix|g"`"
110AC_SUBST([guix_localstatedir])
111AC_SUBST([guix_sysconfdir])
112
113GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests])
114AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"])
115
116dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.)
117dnl Make sure they are available.
118m4_pattern_forbid([PKG_CHECK_MODULES])
119m4_pattern_forbid([GUILE_MODULE_AVAILABLE])
120m4_pattern_forbid([^GUILE_P])
121m4_pattern_allow([^GUILE_PKG_ERRORS])
122m4_pattern_forbid([^GUIX_])
123
124dnl Search for 'guile' and 'guild'. This macro defines
125dnl 'GUILE_EFFECTIVE_VERSION'.
126GUILE_PKG([3.0])
127GUILE_PROGS
128if test "x$GUILD" = "x"; then
129 AC_MSG_ERROR(['guild' binary not found; please check your Guile installation.])
130fi
131
132dnl (guix ui), notably, requires 'default-optimization-level' added in 3.0.3.
133dnl (guix serialization) requires 'bytevector-slice' added in 3.0.9.
134PKG_CHECK_MODULES([GUILE], [guile-3.0 >= 3.0.9])
135
136dnl Get CFLAGS and LDFLAGS for libguile.
137GUILE_FLAGS
138
139dnl Installation directories for .scm and .go files.
140guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
141guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
142AC_SUBST([guilemoduledir])
143AC_SUBST([guileobjectdir])
144
145dnl The GnuTLS bindings are necessary for substitutes over HTTPS and for 'guix
146dnl pull', among other things.
147GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)])
148if test "x$have_gnutls" != "xyes"; then
149 AC_MSG_ERROR([The Guile bindings of GnuTLS are missing; please install them.])
150fi
151
152dnl Check for Guile-Git.
153GUILE_MODULE_AVAILABLE([have_guile_git], [(git)])
154if test "x$have_guile_git" != "xyes"; then
155 AC_MSG_ERROR([Guile-Git is missing; please install it.])
156fi
157
158dnl Check Guile-Git version resp. required recently added symbol.
159GUILE_MODULE_REQUIRED_EXPORT([(git)], [graph-descendant?])
160
161dnl Check for Guile-JSON.
162GUIX_CHECK_GUILE_JSON
163if test "x$guix_cv_have_recent_guile_json" != "xyes"; then
164 AC_MSG_ERROR([Guile-JSON is missing; please install it.])
165fi
166
167dnl Guile-Sqlite3 is used by the (guix store ...) modules.
168GUIX_CHECK_GUILE_SQLITE3
169if test "x$guix_cv_have_recent_guile_sqlite3" != "xyes"; then
170 AC_MSG_ERROR([A recent Guile-SQLite3 could not be found; please install it.])
171fi
172
173GUIX_CHECK_GUILE_GCRYPT
174if test "x$guix_cv_have_recent_guile_gcrypt" != "xyes"; then
175 AC_MSG_ERROR([A recent Guile-Gcrypt could not be found; please install it.])
176fi
177
178GUIX_CHECK_GUILE_GIT
179if test "x$guix_cv_have_recent_guile_git" != "xyes"; then
180 AC_MSG_ERROR([A recent Guile-Git could not be found; please install it.])
181fi
182
183dnl Check for the optional Guile-Lib.
184GUILE_MODULE_EXPORTS([have_guile_lib], [(htmlprag)], [%strict-tokenizer?])
185AM_CONDITIONAL([HAVE_GUILE_LIB], [test "x$have_guile_lib" = "xyes"])
186AM_COND_IF(HAVE_GUILE_LIB,,
187 [AC_MSG_WARN([The Guile-Lib requirement was not satisfied (>= 0.2.7);
188Some features such as the Go importer will not be usable.])])
189
190dnl Check for Guile-zlib.
191GUIX_CHECK_GUILE_ZLIB
192if test "x$guix_cv_have_recent_guile_zlib" != "xyes"; then
193 AC_MSG_ERROR([A recent Guile-zlib could not be found; please install it.])
194fi
195
196dnl Check for Guile-lzlib.
197GUILE_MODULE_AVAILABLE([have_guile_lzlib], [(lzlib)])
198if test "x$have_guile_lzlib" != "xyes"; then
199 AC_MSG_ERROR([Guile-lzlib is missing; please install it.])
200fi
201
202dnl Check for Guile-semver.
203GUILE_MODULE_AVAILABLE([have_guile_semver], [(semver)])
204if test "x$have_guile_semver" != "xyes"; then
205 AC_MSG_ERROR([Guile-semver is missing; please install it.])
206fi
207
208dnl Check for Guile-Avahi.
209GUILE_MODULE_AVAILABLE([have_guile_avahi], [(avahi)])
210AM_CONDITIONAL([HAVE_GUILE_AVAHI],
211 [test "x$have_guile_avahi" = "xyes"])
212
213dnl Guile-newt is used by the graphical installer.
214GUILE_MODULE_AVAILABLE([have_guile_newt], [(newt)])
215
216AC_ARG_ENABLE([installer],
217 AS_HELP_STRING([--enable-installer], [Build the graphical installer sources.]))
218
219AS_IF([test "x$enable_installer" = "xyes"], [
220if test "x$have_guile_newt" != "xyes"; then
221 AC_MSG_ERROR([Guile-newt could not be found; please install it.])
222fi
223])
224
225AM_CONDITIONAL([ENABLE_INSTALLER],
226 [test "x$enable_installer" = "xyes"])
227
228dnl Make sure we have a full-fledged Guile.
229GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
230
231AC_PROG_SED
232
233dnl Decompressors, for use by the substituter and other modules.
234AC_PATH_PROG([GZIP], [gzip])
235AC_PATH_PROG([BZIP2], [bzip2])
236AC_PATH_PROG([XZ], [xz])
237AC_SUBST([GZIP])
238AC_SUBST([BZIP2])
239AC_SUBST([XZ])
240
241dnl Git is now required for the "builtin:git-download" derivation builder.
242AC_PATH_PROG([GIT], [git])
243if test "x$GIT" = "x"; then
244 AC_MSG_ERROR([Git is missing; please install it.])
245fi
246AC_SUBST([GIT])
247
248LIBGCRYPT_LIBDIR="no"
249LIBGCRYPT_PREFIX="no"
250
251AC_ARG_WITH([libgcrypt-prefix],
252 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
253 [case "$withval" in
254 yes|no)
255 ;;
256 *)
257 LIBGCRYPT_PREFIX="$withval"
258 LIBGCRYPT_LIBDIR="$withval/lib"
259 ;;
260 esac])
261
262AC_ARG_WITH([libgcrypt-libdir],
263 [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
264 [search for GNU libgcrypt's shared library in DIR])],
265 [case "$withval" in
266 yes|no)
267 LIBGCRYPT_LIBDIR="no"
268 ;;
269 *)
270 LIBGCRYPT_LIBDIR="$withval"
271 ;;
272 esac])
273
274dnl If none of the --with-libgcrypt-* options was used, try to determine the
275dnl the library directory.
276case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
277 xnono)
278 GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
279 ;;
280esac
281
282AC_SUBST([LIBGCRYPT_PREFIX])
283AC_SUBST([LIBGCRYPT_LIBDIR])
284
285dnl Check for Guile-SSH, for the (guix ssh) module.
286GUIX_CHECK_GUILE_SSH
287AM_CONDITIONAL([HAVE_GUILE_SSH],
288 [test "x$guix_cv_have_recent_guile_ssh" = "xyes"])
289
290AC_CACHE_SAVE
291
292m4_include([config-daemon.ac])
293
294dnl `dot' (from the Graphviz package) is only needed for maintainers.
295dnl See `Building from Git' in the manual for more info.
296AM_MISSING_PROG([DOT], [dot])
297
298dnl Manual pages.
299AM_MISSING_PROG([HELP2MAN], [help2man])
300
301dnl Documentation translation.
302AM_MISSING_PROG([PO4A], [po4a])
303
304AC_MSG_CHECKING([if building from git])
305if test -e .git; then
306 in_git_p=yes
307else
308 in_git_p=no
309fi
310AC_MSG_RESULT([$in_git_p])
311AM_CONDITIONAL([in_git_p],
312 [test "x$in_git_p" = "xyes"])
313
314case "$storedir" in
315 /gnu/store)
316 ;;
317 *)
318 AC_MSG_WARN([Using a store directory other than '/gnu/store' will prevent you])
319 AC_MSG_WARN([from downloading substitutes from gnu.org.])
320 ;;
321esac
322
323AC_CONFIG_FILES([Makefile
324 po/guix/Makefile.in
325 po/packages/Makefile.in
326 etc/guix-daemon.cil
327 etc/apparmor.d/tunables/guix
328 guix/config.scm])
329
330AC_CONFIG_FILES([etc/committer.scm], [chmod +x etc/committer.scm])
331AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
332AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
333 [chmod +x pre-inst-env])
334
335dnl Automake trips on Make conditionals (see:
336dnl <https://lists.gnu.org/archive/html/bug-automake/2001-11/msg00015.html>)
337ENDIF=endif
338AC_SUBST(ENDIF)
339
340AC_OUTPUT