Commit | Line | Data |
---|---|---|
af51c820 LC |
1 | # -*- Autoconf -*- |
2 | # Process this file with autoconf to produce a configure script. | |
3 | ||
4 | AC_PREREQ(2.68) | |
e6860b5e LC |
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/]) | |
af51c820 LC |
9 | AC_CONFIG_AUX_DIR([build-aux]) |
10 | ||
05c4e379 | 11 | AM_INIT_AUTOMAKE([1.14 gnu silent-rules subdir-objects \ |
a84e523c | 12 | color-tests parallel-tests -Woverride -Wno-portability]) |
af51c820 | 13 | |
032c7c5f LC |
14 | # Enable silent rules by default. |
15 | AM_SILENT_RULES([yes]) | |
16 | ||
af51c820 LC |
17 | AC_CONFIG_SRCDIR([guix.scm]) |
18 | AC_CONFIG_MACRO_DIR([m4]) | |
19 | ||
c2033df4 LC |
20 | dnl For the C++ code. This must be used early. |
21 | AC_USE_SYSTEM_EXTENSIONS | |
22 | ||
f68b0893 | 23 | AM_GNU_GETTEXT([external]) |
5ac12a4f | 24 | AM_GNU_GETTEXT_VERSION([0.18.1]) |
f68b0893 | 25 | |
c2033df4 | 26 | GUIX_SYSTEM_TYPE |
b97556d7 | 27 | GUIX_ASSERT_SUPPORTED_SYSTEM |
c2033df4 | 28 | |
62bc3c5b LC |
29 | AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"]) |
30 | ||
c2033df4 LC |
31 | AC_ARG_WITH(store-dir, |
32 | AC_HELP_STRING([--with-store-dir=PATH], | |
834129e0 | 33 | [file name of the store (defaults to /gnu/store)]), |
c2033df4 | 34 | [storedir="$withval"], |
834129e0 | 35 | [storedir="/gnu/store"]) |
c2033df4 | 36 | AC_SUBST(storedir) |
73d96596 | 37 | |
ee3e157d LC |
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 | ||
96dbc930 ELB |
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 | ||
b83fc85f | 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 | ||
b617a9fe RW |
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 | ||
834129e0 LC |
66 | dnl Better be verbose. |
67 | AC_MSG_CHECKING([for the store directory]) | |
68 | AC_MSG_RESULT([$storedir]) | |
69 | ||
3a61f801 | 70 | AC_ARG_ENABLE([daemon], |
a4c1e99e | 71 | [AS_HELP_STRING([--disable-daemon], [do not build the Nix daemon (C++)])], |
3a61f801 | 72 | [guix_build_daemon="$enableval"], |
c9b70836 | 73 | [guix_build_daemon="yes"]) |
3a61f801 | 74 | |
3f40cfde | 75 | # Prepare a version of $localstatedir & co. that does not contain references |
d8eea3d2 | 76 | # to shell variables. |
6bfec3ed LC |
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"`" | |
d8eea3d2 | 81 | AC_SUBST([guix_localstatedir]) |
3f40cfde | 82 | AC_SUBST([guix_sysconfdir]) |
6bfec3ed | 83 | AC_SUBST([guix_sbindir]) |
d8eea3d2 | 84 | |
bb251307 LC |
85 | GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests]) |
86 | AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"]) | |
2178ed66 | 87 | |
0e991c25 LC |
88 | dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.) |
89 | dnl Make sure they are available. | |
ff1cbb95 | 90 | m4_pattern_forbid([PKG_CHECK_MODULES]) |
0e991c25 | 91 | m4_pattern_forbid([GUILE_MODULE_AVAILABLE]) |
dde49cfe LC |
92 | m4_pattern_forbid([^GUILE_P]) |
93 | m4_pattern_allow([^GUILE_PKG_ERRORS]) | |
28f436a9 | 94 | m4_pattern_forbid([^GUIX_]) |
ff1cbb95 | 95 | |
608e42e7 LC |
96 | dnl Search for 'guile' and 'guild'. This macro defines |
97 | dnl 'GUILE_EFFECTIVE_VERSION'. | |
7b2a47a7 | 98 | GUILE_PKG([3.0 2.2]) |
9d126aa2 | 99 | GUILE_PROGS |
73f9a978 | 100 | if test "x$GUILD" = "x"; then |
e688c2df LC |
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]) | |
73f9a978 | 106 | fi |
af51c820 | 107 | |
9437fd73 | 108 | dnl Installation directories for .scm and .go files. |
301d73f6 | 109 | guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION" |
9437fd73 | 110 | guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache" |
301d73f6 | 111 | AC_SUBST([guilemoduledir]) |
9437fd73 | 112 | AC_SUBST([guileobjectdir]) |
301d73f6 | 113 | |
1dbe3a8d LC |
114 | dnl The GnuTLS bindings are necessary for substitutes over HTTPS and for 'guix |
115 | dnl pull', among other things. | |
116 | GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)]) | |
117 | if test "x$have_gnutls" != "xyes"; then | |
118 | AC_MSG_ERROR([The Guile bindings of GnuTLS are missing; please install them.]) | |
119 | fi | |
120 | ||
7441f1db LC |
121 | dnl Check for Guile-Git. |
122 | GUILE_MODULE_AVAILABLE([have_guile_git], [(git)]) | |
123 | if test "x$have_guile_git" != "xyes"; then | |
124 | AC_MSG_ERROR([Guile-Git is missing; please install it.]) | |
125 | fi | |
126 | ||
6776af04 | 127 | dnl Check for Guile-JSON. |
81c3dc32 LC |
128 | GUIX_CHECK_GUILE_JSON |
129 | if test "x$guix_cv_have_recent_guile_json" != "xyes"; then | |
6776af04 EB |
130 | AC_MSG_ERROR([Guile-JSON is missing; please install it.]) |
131 | fi | |
1b3e9685 | 132 | |
d59e75f3 LC |
133 | dnl Guile-Sqlite3 is used by the (guix store ...) modules. |
134 | GUIX_CHECK_GUILE_SQLITE3 | |
c5a2e1ff LC |
135 | if test "x$guix_cv_have_recent_guile_sqlite3" != "xyes"; then |
136 | AC_MSG_ERROR([A recent Guile-SQLite3 could not be found; please install it.]) | |
137 | fi | |
d59e75f3 | 138 | |
c1dc50ab LC |
139 | GUIX_CHECK_GUILE_GCRYPT |
140 | if test "x$guix_cv_have_recent_guile_gcrypt" != "xyes"; then | |
141 | AC_MSG_ERROR([A recent Guile-Gcrypt could not be found; please install it.]) | |
ca719424 LC |
142 | fi |
143 | ||
d0f3a672 MO |
144 | dnl Guile-newt is used by the graphical installer. |
145 | GUILE_MODULE_AVAILABLE([have_guile_newt], [(newt)]) | |
7d328e34 MO |
146 | |
147 | AC_ARG_ENABLE([installer], | |
148 | AS_HELP_STRING([--enable-installer], [Build the graphical installer sources.])) | |
149 | ||
150 | AS_IF([test "x$enable_installer" = "xyes"], [ | |
d0f3a672 MO |
151 | if test "x$have_guile_newt" != "xyes"; then |
152 | AC_MSG_ERROR([Guile-newt could not be found; please install it.]) | |
153 | fi | |
7d328e34 MO |
154 | ]) |
155 | ||
156 | AM_CONDITIONAL([ENABLE_INSTALLER], | |
157 | [test "x$enable_installer" = "xyes"]) | |
d0f3a672 | 158 | |
9c7dd33a LC |
159 | dnl Make sure we have a full-fledged Guile. |
160 | GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads]) | |
161 | ||
14218251 LC |
162 | dnl Make sure we don't suffer from the bug in 'equal?' wrt. syntax objects |
163 | dnl found in 2.2.1. See <https://bugs.gnu.org/29903>. | |
164 | GUIX_ASSERT_SYNTAX_OBJECT_EQUAL | |
165 | ||
cba386c1 ML |
166 | AC_PROG_SED |
167 | ||
cd48eae5 LC |
168 | dnl Decompressors, for use by the substituter and other modules. |
169 | AC_PATH_PROG([GZIP], [gzip]) | |
170 | AC_PATH_PROG([BZIP2], [bzip2]) | |
171 | AC_PATH_PROG([XZ], [xz]) | |
172 | AC_SUBST([GZIP]) | |
173 | AC_SUBST([BZIP2]) | |
174 | AC_SUBST([XZ]) | |
175 | ||
af51c820 | 176 | AC_ARG_WITH([nix-prefix], |
bb0a70e1 LC |
177 | [AS_HELP_STRING([--with-nix-prefix=DIR], |
178 | [search for Nix in DIR (for testing purposes and '--disable-daemon' builds)])], | |
af51c820 LC |
179 | [case "$withval" in |
180 | yes|no) ;; | |
437e0729 LC |
181 | *) |
182 | NIX_PREFIX="$withval" | |
183 | PATH="$NIX_PREFIX/bin:$PATH"; export PATH | |
184 | AC_SUBST([NIX_PREFIX]) | |
185 | ;; | |
af51c820 LC |
186 | esac], |
187 | []) | |
188 | ||
af51c820 | 189 | AC_PATH_PROG([NIX_HASH], [nix-hash]) |
e8cb9c01 | 190 | if test "x$guix_build_daemon$NIX_HASH" = "xno"; then |
af51c820 LC |
191 | AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.]) |
192 | fi | |
193 | ||
194 | AC_ARG_WITH([nixpkgs], | |
bb0a70e1 LC |
195 | [AS_HELP_STRING([--with-nixpkgs=DIR], |
196 | [search for Nixpkgs in DIR (for testing purposes only)])], | |
af51c820 LC |
197 | [case "$withval" in |
198 | yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);; | |
199 | *) NIXPKGS="$withval";; | |
200 | esac], | |
201 | []) | |
202 | ||
e76bdf8b | 203 | AC_MSG_CHECKING([for Nixpkgs source tree]) |
af51c820 | 204 | if test -f "$NIXPKGS/default.nix"; then |
af51c820 LC |
205 | AC_MSG_RESULT([$NIXPKGS]) |
206 | AC_SUBST([NIXPKGS]) | |
207 | else | |
e76bdf8b | 208 | AC_MSG_RESULT([not found]) |
af51c820 LC |
209 | fi |
210 | ||
dd01fecd LC |
211 | LIBGCRYPT_LIBDIR="no" |
212 | LIBGCRYPT_PREFIX="no" | |
213 | ||
3a310cc0 LC |
214 | AC_ARG_WITH([libgcrypt-prefix], |
215 | [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])], | |
216 | [case "$withval" in | |
217 | yes|no) | |
3a310cc0 LC |
218 | ;; |
219 | *) | |
d388c2c4 | 220 | LIBGCRYPT_PREFIX="$withval" |
14af289e | 221 | LIBGCRYPT_LIBDIR="$withval/lib" |
3a310cc0 | 222 | ;; |
dd01fecd | 223 | esac]) |
3a310cc0 | 224 | |
14af289e LC |
225 | AC_ARG_WITH([libgcrypt-libdir], |
226 | [AS_HELP_STRING([--with-libgcrypt-libdir=DIR], | |
227 | [search for GNU libgcrypt's shared library in DIR])], | |
228 | [case "$withval" in | |
229 | yes|no) | |
14af289e LC |
230 | LIBGCRYPT_LIBDIR="no" |
231 | ;; | |
232 | *) | |
14af289e LC |
233 | LIBGCRYPT_LIBDIR="$withval" |
234 | ;; | |
dd01fecd LC |
235 | esac]) |
236 | ||
237 | dnl If none of the --with-libgcrypt-* options was used, try to determine the | |
ca719424 | 238 | dnl the library directory. |
dd01fecd LC |
239 | case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in |
240 | xnono) | |
241 | GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR]) | |
dd01fecd LC |
242 | ;; |
243 | esac | |
14af289e | 244 | |
d388c2c4 | 245 | AC_SUBST([LIBGCRYPT_PREFIX]) |
14af289e | 246 | AC_SUBST([LIBGCRYPT_LIBDIR]) |
d388c2c4 | 247 | |
72153902 LC |
248 | dnl Library name of zlib suitable for 'dynamic-link'. |
249 | GUIX_LIBZ_LIBDIR([libz_libdir]) | |
250 | if test "x$libz_libdir" = "x"; then | |
251 | LIBZ="libz" | |
252 | else | |
253 | LIBZ="$libz_libdir/libz" | |
254 | fi | |
255 | AC_MSG_CHECKING([for zlib's shared library name]) | |
256 | AC_MSG_RESULT([$LIBZ]) | |
257 | AC_SUBST([LIBZ]) | |
258 | ||
fea338c6 PN |
259 | dnl Library name of lzlib suitable for 'dynamic-link'. |
260 | GUIX_LIBLZ_FILE_NAME([LIBLZ]) | |
261 | if test "x$LIBLZ" = "x"; then | |
262 | LIBLZ="liblz" | |
263 | else | |
264 | # Strip the .so or .so.1 extension since that's what 'dynamic-link' expects. | |
265 | LIBLZ="`echo $LIBLZ | sed -es'/\.so\(\.[[0-9.]]\+\)\?//g'`" | |
266 | fi | |
267 | AC_SUBST([LIBLZ]) | |
268 | ||
987a29ba LC |
269 | dnl Check for Guile-SSH, for the (guix ssh) module. |
270 | GUIX_CHECK_GUILE_SSH | |
271 | AM_CONDITIONAL([HAVE_GUILE_SSH], | |
272 | [test "x$guix_cv_have_recent_guile_ssh" = "xyes"]) | |
273 | ||
c2033df4 LC |
274 | AC_CACHE_SAVE |
275 | ||
276 | m4_include([config-daemon.ac]) | |
3a310cc0 | 277 | |
cb9e50f6 | 278 | dnl `dot' (from the Graphviz package) is only needed for maintainers. |
8c01b9d0 | 279 | dnl See `Building from Git' in the manual for more info. |
cb9e50f6 LC |
280 | AM_MISSING_PROG([DOT], [dot]) |
281 | ||
52eca736 LC |
282 | dnl Manual pages. |
283 | AM_MISSING_PROG([HELP2MAN], [help2man]) | |
284 | ||
b9fe8fd6 JL |
285 | dnl Documentation translation. |
286 | AM_MISSING_PROG([PO4A_TRANSLATE], [po4a-translate]) | |
287 | AM_MISSING_PROG([PO4A_UPDATEPO], [po4a-updatepo]) | |
288 | ||
d480ed7e LC |
289 | case "$storedir" in |
290 | /gnu/store) | |
291 | ;; | |
292 | *) | |
293 | AC_MSG_WARN([Using a store directory other than '/gnu/store' will prevent you]) | |
294 | AC_MSG_WARN([from downloading substitutes from gnu.org.]) | |
295 | ;; | |
296 | esac | |
297 | ||
14a1c319 | 298 | AC_CONFIG_FILES([Makefile |
ef1a9bb7 | 299 | po/guix/Makefile.in |
ee764179 | 300 | po/packages/Makefile.in |
b617a9fe RW |
301 | etc/guix-daemon.cil |
302 | guix/config.scm]) | |
8dc2ecfc | 303 | |
76a841cc | 304 | AC_CONFIG_FILES([etc/committer.scm], [chmod +x etc/committer.scm]) |
a1097caa ML |
305 | AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env]) |
306 | AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in], | |
307 | [chmod +x pre-inst-env]) | |
af51c820 LC |
308 | |
309 | AC_OUTPUT |