projects/guix·blob wip-riscv-bootstrap1 · refs

319 lines · 10.0 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 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-204 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 [[email protected]], [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
84dnl Better be verbose.
85AC_MSG_CHECKING([for the store directory])
86AC_MSG_RESULT([$storedir])
87
88AC_ARG_ENABLE([daemon],
89 [AS_HELP_STRING([--disable-daemon], [do not build the Nix daemon (C++)])],
90 [guix_build_daemon="$enableval"],
91 [guix_build_daemon="yes"])
92
93dnl Prepare a version of $localstatedir & co. that does not contain references
94dnl to shell variables. Also set some sane default directory variables for
95dnl use with the Guix. This also causes localstatedir to be /var and
96dnl sysconfdir to be /etc.
97test "$prefix" = NONE && prefix=
98guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|$guix_prefix|g"`"
99guix_sysconfdir="`eval echo $sysconfdir | sed -e "s|NONE|$guix_prefix|g"`"
100guix_sbindir="`eval echo $sbindir | sed -e "s|NONE|$guix_prefix|g"`"
101AC_SUBST([guix_localstatedir])
102AC_SUBST([guix_sysconfdir])
103AC_SUBST([guix_sbindir])
104
105GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests])
106AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"])
107
108dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.)
109dnl Make sure they are available.
110m4_pattern_forbid([PKG_CHECK_MODULES])
111m4_pattern_forbid([GUILE_MODULE_AVAILABLE])
112m4_pattern_forbid([^GUILE_P])
113m4_pattern_allow([^GUILE_PKG_ERRORS])
114m4_pattern_forbid([^GUIX_])
115
116dnl Search for 'guile' and 'guild'. This macro defines
117dnl 'GUILE_EFFECTIVE_VERSION'.
118GUILE_PKG([3.0])
119GUILE_PROGS
120if test "x$GUILD" = "x"; then
121 AC_MSG_ERROR(['guild' binary not found; please check your Guile installation.])
122fi
123
124dnl (guix ui), notably, requires 'default-optimization-level' added in 3.0.3.
125PKG_CHECK_MODULES([GUILE], [guile-3.0 >= 3.0.3])
126
127dnl Get CFLAGS and LDFLAGS for libguile.
128GUILE_FLAGS
129
130dnl Installation directories for .scm and .go files.
131guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
132guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
133AC_SUBST([guilemoduledir])
134AC_SUBST([guileobjectdir])
135
136dnl The GnuTLS bindings are necessary for substitutes over HTTPS and for 'guix
137dnl pull', among other things.
138GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)])
139if test "x$have_gnutls" != "xyes"; then
140 AC_MSG_ERROR([The Guile bindings of GnuTLS are missing; please install them.])
141fi
142
143dnl Check for Guile-Git.
144GUILE_MODULE_AVAILABLE([have_guile_git], [(git)])
145if test "x$have_guile_git" != "xyes"; then
146 AC_MSG_ERROR([Guile-Git is missing; please install it.])
147fi
148
149dnl Check Guile-Git version resp. required recently added symbol.
150GUILE_MODULE_REQUIRED_EXPORT([(git)], [graph-descendant?])
151
152dnl Check for Guile-JSON.
153GUIX_CHECK_GUILE_JSON
154if test "x$guix_cv_have_recent_guile_json" != "xyes"; then
155 AC_MSG_ERROR([Guile-JSON is missing; please install it.])
156fi
157
158dnl Guile-Sqlite3 is used by the (guix store ...) modules.
159GUIX_CHECK_GUILE_SQLITE3
160if test "x$guix_cv_have_recent_guile_sqlite3" != "xyes"; then
161 AC_MSG_ERROR([A recent Guile-SQLite3 could not be found; please install it.])
162fi
163
164GUIX_CHECK_GUILE_GCRYPT
165if test "x$guix_cv_have_recent_guile_gcrypt" != "xyes"; then
166 AC_MSG_ERROR([A recent Guile-Gcrypt could not be found; please install it.])
167fi
168
169GUIX_CHECK_GUILE_GIT
170if test "x$guix_cv_have_recent_guile_git" != "xyes"; then
171 AC_MSG_ERROR([A recent Guile-Git could not be found; please install it.])
172fi
173
174dnl Check for the optional Guile-Lib.
175GUILE_MODULE_EXPORTS([have_guile_lib], [(htmlprag)], [%strict-tokenizer?])
176AM_CONDITIONAL([HAVE_GUILE_LIB], [test "x$have_guile_lib" = "xyes"])
177AM_COND_IF(HAVE_GUILE_LIB,,
178 [AC_MSG_WARN([The Guile-Lib requirement was not satisfied (>= 0.2.7);
179Some features such as the Go importer will not be usable.])])
180
181dnl Check for Guile-zlib.
182GUIX_CHECK_GUILE_ZLIB
183if test "x$guix_cv_have_recent_guile_zlib" != "xyes"; then
184 AC_MSG_ERROR([A recent Guile-zlib could not be found; please install it.])
185fi
186
187dnl Check for Guile-lzlib.
188GUILE_MODULE_AVAILABLE([have_guile_lzlib], [(lzlib)])
189if test "x$have_guile_lzlib" != "xyes"; then
190 AC_MSG_ERROR([Guile-lzlib is missing; please install it.])
191fi
192
193dnl Check for Guile-Avahi.
194GUILE_MODULE_AVAILABLE([have_guile_avahi], [(avahi)])
195AM_CONDITIONAL([HAVE_GUILE_AVAHI],
196 [test "x$have_guile_avahi" = "xyes"])
197
198dnl Guile-newt is used by the graphical installer.
199GUILE_MODULE_AVAILABLE([have_guile_newt], [(newt)])
200
201AC_ARG_ENABLE([installer],
202 AS_HELP_STRING([--enable-installer], [Build the graphical installer sources.]))
203
204AS_IF([test "x$enable_installer" = "xyes"], [
205if test "x$have_guile_newt" != "xyes"; then
206 AC_MSG_ERROR([Guile-newt could not be found; please install it.])
207fi
208])
209
210AM_CONDITIONAL([ENABLE_INSTALLER],
211 [test "x$enable_installer" = "xyes"])
212
213dnl Make sure we have a full-fledged Guile.
214GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
215
216AC_PROG_SED
217
218dnl Decompressors, for use by the substituter and other modules.
219AC_PATH_PROG([GZIP], [gzip])
220AC_PATH_PROG([BZIP2], [bzip2])
221AC_PATH_PROG([XZ], [xz])
222AC_SUBST([GZIP])
223AC_SUBST([BZIP2])
224AC_SUBST([XZ])
225
226dnl Git is now required for the "builtin:git-download" derivation builder.
227AC_PATH_PROG([GIT], [git])
228if test "x$GIT" = "x"; then
229 AC_MSG_ERROR([Git is missing; please install it.])
230fi
231AC_SUBST([GIT])
232
233LIBGCRYPT_LIBDIR="no"
234LIBGCRYPT_PREFIX="no"
235
236AC_ARG_WITH([libgcrypt-prefix],
237 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
238 [case "$withval" in
239 yes|no)
240 ;;
241 *)
242 LIBGCRYPT_PREFIX="$withval"
243 LIBGCRYPT_LIBDIR="$withval/lib"
244 ;;
245 esac])
246
247AC_ARG_WITH([libgcrypt-libdir],
248 [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
249 [search for GNU libgcrypt's shared library in DIR])],
250 [case "$withval" in
251 yes|no)
252 LIBGCRYPT_LIBDIR="no"
253 ;;
254 *)
255 LIBGCRYPT_LIBDIR="$withval"
256 ;;
257 esac])
258
259dnl If none of the --with-libgcrypt-* options was used, try to determine the
260dnl the library directory.
261case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
262 xnono)
263 GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
264 ;;
265esac
266
267AC_SUBST([LIBGCRYPT_PREFIX])
268AC_SUBST([LIBGCRYPT_LIBDIR])
269
270dnl Check for Guile-SSH, for the (guix ssh) module.
271GUIX_CHECK_GUILE_SSH
272AM_CONDITIONAL([HAVE_GUILE_SSH],
273 [test "x$guix_cv_have_recent_guile_ssh" = "xyes"])
274
275AC_CACHE_SAVE
276
277m4_include([config-daemon.ac])
278
279dnl `dot' (from the Graphviz package) is only needed for maintainers.
280dnl See `Building from Git' in the manual for more info.
281AM_MISSING_PROG([DOT], [dot])
282
283dnl Manual pages.
284AM_MISSING_PROG([HELP2MAN], [help2man])
285
286dnl Documentation translation.
287AM_MISSING_PROG([PO4A], [po4a])
288
289AC_MSG_CHECKING([if building from git])
290if test -e .git; then
291 in_git_p=yes
292else
293 in_git_p=no
294fi
295AC_MSG_RESULT([$in_git_p])
296AM_CONDITIONAL([in_git_p],
297 [test "x$in_git_p" = "xyes"])
298
299case "$storedir" in
300 /gnu/store)
301 ;;
302 *)
303 AC_MSG_WARN([Using a store directory other than '/gnu/store' will prevent you])
304 AC_MSG_WARN([from downloading substitutes from gnu.org.])
305 ;;
306esac
307
308AC_CONFIG_FILES([Makefile
309 po/guix/Makefile.in
310 po/packages/Makefile.in
311 etc/guix-daemon.cil
312 guix/config.scm])
313
314AC_CONFIG_FILES([etc/committer.scm], [chmod +x etc/committer.scm])
315AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
316AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
317 [chmod +x pre-inst-env])
318
319AC_OUTPUT