projects/guix·blob ocaml-team · refs

342 lines · 10.9 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 Guile-GnuTLS version resp. required recently added symbol.
153GUILE_MODULE_REQUIRED_EXPORT([(gnutls)], [record-get-direction])
154
155dnl Check for Guile-Git.
156GUILE_MODULE_AVAILABLE([have_guile_git], [(git)])
157if test "x$have_guile_git" != "xyes"; then
158 AC_MSG_ERROR([Guile-Git is missing; please install it.])
159fi
160
161dnl Check Guile-Git version resp. required recently added symbol.
162GUILE_MODULE_REQUIRED_EXPORT([(git)], [graph-descendant?])
163
164dnl Check for Guile-JSON.
165GUIX_CHECK_GUILE_JSON
166if test "x$guix_cv_have_recent_guile_json" != "xyes"; then
167 AC_MSG_ERROR([Guile-JSON is missing; please install it.])
168fi
169
170dnl Guile-Sqlite3 is used by the (guix store ...) modules.
171GUIX_CHECK_GUILE_SQLITE3
172if test "x$guix_cv_have_recent_guile_sqlite3" != "xyes"; then
173 AC_MSG_ERROR([A recent Guile-SQLite3 could not be found; please install it.])
174fi
175
176GUIX_CHECK_GUILE_GCRYPT
177if test "x$guix_cv_have_recent_guile_gcrypt" != "xyes"; then
178 AC_MSG_ERROR([A recent Guile-Gcrypt could not be found; please install it.])
179fi
180
181GUIX_CHECK_GUILE_GIT
182if test "x$guix_cv_have_recent_guile_git" != "xyes"; then
183 AC_MSG_ERROR([A recent Guile-Git could not be found; please install it.])
184fi
185
186dnl Check for the optional Guile-Lib.
187GUILE_MODULE_EXPORTS([have_guile_lib], [(htmlprag)], [%strict-tokenizer?])
188AM_CONDITIONAL([HAVE_GUILE_LIB], [test "x$have_guile_lib" = "xyes"])
189AM_COND_IF(HAVE_GUILE_LIB,,
190 [AC_MSG_WARN([The Guile-Lib requirement was not satisfied (>= 0.2.7);
191Some features such as the Go importer will not be usable.])])
192
193dnl Check for Guile-zlib.
194GUIX_CHECK_GUILE_ZLIB
195if test "x$guix_cv_have_recent_guile_zlib" != "xyes"; then
196 AC_MSG_ERROR([A recent Guile-zlib could not be found; please install it.])
197fi
198
199dnl Check for Guile-lzlib.
200GUILE_MODULE_AVAILABLE([have_guile_lzlib], [(lzlib)])
201if test "x$have_guile_lzlib" != "xyes"; then
202 AC_MSG_ERROR([Guile-lzlib is missing; please install it.])
203fi
204
205dnl Check for Guile-semver.
206GUILE_MODULE_AVAILABLE([have_guile_semver], [(semver)])
207if test "x$have_guile_semver" != "xyes"; then
208 AC_MSG_ERROR([Guile-semver is missing; please install it.])
209fi
210
211dnl Check for Guile-Avahi.
212GUILE_MODULE_AVAILABLE([have_guile_avahi], [(avahi)])
213AM_CONDITIONAL([HAVE_GUILE_AVAHI],
214 [test "x$have_guile_avahi" = "xyes"])
215
216dnl Guile-newt is used by the graphical installer.
217GUILE_MODULE_AVAILABLE([have_guile_newt], [(newt)])
218
219AC_ARG_ENABLE([installer],
220 AS_HELP_STRING([--enable-installer], [Build the graphical installer sources.]))
221
222AS_IF([test "x$enable_installer" = "xyes"], [
223if test "x$have_guile_newt" != "xyes"; then
224 AC_MSG_ERROR([Guile-newt could not be found; please install it.])
225fi
226])
227
228AM_CONDITIONAL([ENABLE_INSTALLER],
229 [test "x$enable_installer" = "xyes"])
230
231dnl Make sure we have a full-fledged Guile.
232GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
233
234AC_PROG_SED
235
236dnl Decompressors, for use by the substituter and other modules.
237AC_PATH_PROG([GZIP], [gzip])
238AC_PATH_PROG([BZIP2], [bzip2])
239AC_PATH_PROG([XZ], [xz])
240AC_SUBST([GZIP])
241AC_SUBST([BZIP2])
242AC_SUBST([XZ])
243
244dnl Git is now required for the "builtin:git-download" derivation builder.
245AC_PATH_PROG([GIT], [git])
246if test "x$GIT" = "x"; then
247 AC_MSG_ERROR([Git is missing; please install it.])
248fi
249AC_SUBST([GIT])
250
251LIBGCRYPT_LIBDIR="no"
252LIBGCRYPT_PREFIX="no"
253
254AC_ARG_WITH([libgcrypt-prefix],
255 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
256 [case "$withval" in
257 yes|no)
258 ;;
259 *)
260 LIBGCRYPT_PREFIX="$withval"
261 LIBGCRYPT_LIBDIR="$withval/lib"
262 ;;
263 esac])
264
265AC_ARG_WITH([libgcrypt-libdir],
266 [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
267 [search for GNU libgcrypt's shared library in DIR])],
268 [case "$withval" in
269 yes|no)
270 LIBGCRYPT_LIBDIR="no"
271 ;;
272 *)
273 LIBGCRYPT_LIBDIR="$withval"
274 ;;
275 esac])
276
277dnl If none of the --with-libgcrypt-* options was used, try to determine the
278dnl the library directory.
279case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
280 xnono)
281 GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
282 ;;
283esac
284
285AC_SUBST([LIBGCRYPT_PREFIX])
286AC_SUBST([LIBGCRYPT_LIBDIR])
287
288dnl Check for Guile-SSH, for the (guix ssh) module.
289GUIX_CHECK_GUILE_SSH
290AM_CONDITIONAL([HAVE_GUILE_SSH],
291 [test "x$guix_cv_have_recent_guile_ssh" = "xyes"])
292
293AC_CACHE_SAVE
294
295m4_include([config-daemon.ac])
296
297dnl `dot' (from the Graphviz package) is only needed for maintainers.
298dnl See `Building from Git' in the manual for more info.
299AM_MISSING_PROG([DOT], [dot])
300
301dnl Manual pages.
302AM_MISSING_PROG([HELP2MAN], [help2man])
303
304dnl Documentation translation.
305AM_MISSING_PROG([PO4A], [po4a])
306
307AC_MSG_CHECKING([if building from git])
308if test -e .git; then
309 in_git_p=yes
310else
311 in_git_p=no
312fi
313AC_MSG_RESULT([$in_git_p])
314AM_CONDITIONAL([in_git_p],
315 [test "x$in_git_p" = "xyes"])
316
317case "$storedir" in
318 /gnu/store)
319 ;;
320 *)
321 AC_MSG_WARN([Using a store directory other than '/gnu/store' will prevent you])
322 AC_MSG_WARN([from downloading substitutes from gnu.org.])
323 ;;
324esac
325
326AC_CONFIG_FILES([Makefile
327 po/guix/Makefile.in
328 po/packages/Makefile.in
329 etc/guix-daemon.cil
330 etc/apparmor.d/tunables/guix
331 guix/config.scm])
332
333AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
334AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
335 [chmod +x pre-inst-env])
336
337dnl Automake trips on Make conditionals (see:
338dnl <https://lists.gnu.org/archive/html/bug-automake/2001-11/msg00015.html>)
339ENDIF=endif
340AC_SUBST(ENDIF)
341
342AC_OUTPUT