doc: Add a reference to 'Invoking guix archive'.
[jackhill/guix/guix.git] / configure.ac
CommitLineData
af51c820
LC
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.68)
aeaa5ccb 5AC_INIT([GNU Guix], [0.10.0], [bug-guix@gnu.org], [guix],
4bc3fcc7 6 [http://www.gnu.org/software/guix/])
af51c820
LC
7AC_CONFIG_AUX_DIR([build-aux])
8
8aab64fc 9AM_INIT_AUTOMAKE([1.12 gnu silent-rules subdir-objects \
a84e523c 10 color-tests parallel-tests -Woverride -Wno-portability])
af51c820 11
032c7c5f
LC
12# Enable silent rules by default.
13AM_SILENT_RULES([yes])
14
af51c820
LC
15AC_CONFIG_SRCDIR([guix.scm])
16AC_CONFIG_MACRO_DIR([m4])
17
c2033df4
LC
18dnl For the C++ code. This must be used early.
19AC_USE_SYSTEM_EXTENSIONS
20
f68b0893 21AM_GNU_GETTEXT([external])
5ac12a4f 22AM_GNU_GETTEXT_VERSION([0.18.1])
f68b0893 23
af51c820
LC
24guilemoduledir="${datarootdir}/guile/site/2.0"
25AC_SUBST([guilemoduledir])
26
c2033df4 27GUIX_SYSTEM_TYPE
b97556d7 28GUIX_ASSERT_SUPPORTED_SYSTEM
c2033df4
LC
29
30AC_ARG_WITH(store-dir,
31 AC_HELP_STRING([--with-store-dir=PATH],
834129e0 32 [file name of the store (defaults to /gnu/store)]),
c2033df4 33 [storedir="$withval"],
834129e0 34 [storedir="/gnu/store"])
c2033df4 35AC_SUBST(storedir)
73d96596 36
ee3e157d
LC
37AC_ARG_WITH([bash-completion-dir],
38 AC_HELP_STRING([--with-bash-completion-dir=DIR],
39 [name of the Bash completion directory]),
40 [bashcompletiondir="$withval"],
41 [bashcompletiondir='${sysconfdir}/bash_completion.d'])
42AC_SUBST([bashcompletiondir])
43
834129e0
LC
44dnl Better be verbose.
45AC_MSG_CHECKING([for the store directory])
46AC_MSG_RESULT([$storedir])
47
3a61f801 48AC_ARG_ENABLE([daemon],
c9b70836 49 [AS_HELP_STRING([--disable-daemon], [build the Nix daemon (C++)])],
3a61f801 50 [guix_build_daemon="$enableval"],
c9b70836 51 [guix_build_daemon="yes"])
3a61f801 52
3f40cfde 53# Prepare a version of $localstatedir & co. that does not contain references
d8eea3d2 54# to shell variables.
6bfec3ed
LC
55guix_prefix="`eval echo $prefix | sed -e"s|NONE|/usr/local|g"`"
56guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|$guix_prefix|g"`"
57guix_sysconfdir="`eval echo $sysconfdir | sed -e "s|NONE|$guix_prefix|g"`"
58guix_sbindir="`eval echo $sbindir | sed -e "s|NONE|$guix_prefix|g"`"
d8eea3d2 59AC_SUBST([guix_localstatedir])
3f40cfde 60AC_SUBST([guix_sysconfdir])
6bfec3ed 61AC_SUBST([guix_sbindir])
d8eea3d2 62
bb251307
LC
63GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests])
64AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"])
2178ed66 65
0e991c25
LC
66dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.)
67dnl Make sure they are available.
ff1cbb95 68m4_pattern_forbid([PKG_CHECK_MODULES])
0e991c25 69m4_pattern_forbid([GUILE_MODULE_AVAILABLE])
ff1cbb95 70
47c66da0 71PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.7])
af51c820
LC
72AC_PATH_PROG([GUILE], [guile])
73AC_PATH_PROG([GUILD], [guild])
73f9a978
CN
74if test "x$GUILD" = "x"; then
75 AC_MSG_ERROR(['guild' binary not found; please check your guile-2.x installation.])
76fi
af51c820 77
1b3e9685
DT
78dnl guile-json is used for the PyPI package importer
79GUILE_MODULE_AVAILABLE([have_guile_json], [(json)])
80AM_CONDITIONAL([HAVE_GUILE_JSON], [test "x$have_guile_json" = "xyes"])
81
9c7dd33a
LC
82dnl Make sure we have a full-fledged Guile.
83GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
84
1959fb04
LC
85dnl Check whether (srfi srfi-37) works, and provide our own if it doesn't.
86GUIX_CHECK_SRFI_37
87AM_CONDITIONAL([INSTALL_SRFI_37], [test "x$ac_cv_guix_srfi_37_broken" = xyes])
88
12e5b266
LC
89dnl Check whether (guix build syscalls) can be built.
90GUIX_CHECK_LIBC_MOUNT
91AM_CONDITIONAL([BUILD_SYSCALLS_MODULE],
92 [test "x$guix_cv_libc_has_mount" = "xyes"])
93
cd48eae5
LC
94dnl Decompressors, for use by the substituter and other modules.
95AC_PATH_PROG([GZIP], [gzip])
96AC_PATH_PROG([BZIP2], [bzip2])
97AC_PATH_PROG([XZ], [xz])
98AC_SUBST([GZIP])
99AC_SUBST([BZIP2])
100AC_SUBST([XZ])
101
af51c820 102AC_ARG_WITH([nix-prefix],
bb0a70e1
LC
103 [AS_HELP_STRING([--with-nix-prefix=DIR],
104 [search for Nix in DIR (for testing purposes and '--disable-daemon' builds)])],
af51c820
LC
105 [case "$withval" in
106 yes|no) ;;
437e0729
LC
107 *)
108 NIX_PREFIX="$withval"
109 PATH="$NIX_PREFIX/bin:$PATH"; export PATH
110 AC_SUBST([NIX_PREFIX])
111 ;;
af51c820
LC
112 esac],
113 [])
114
115AC_PATH_PROG([NIX_INSTANTIATE], [nix-instantiate])
116AC_PATH_PROG([NIX_HASH], [nix-hash])
3a61f801 117if test "x$guix_build_daemon$NIX_INSTANTIATE$NIX_HASH" = "xno"; then
af51c820
LC
118 AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.])
119fi
120
c217708f
LC
121if test "x$NIX_INSTANTIATE" = "x"; then
122 # This program is an optional dependency, so we just want it to be
123 # taken from $PATH if it's not available right now.
124 NIX_INSTANTIATE="nix-instantiate"
125fi
126
af51c820 127AC_ARG_WITH([nixpkgs],
bb0a70e1
LC
128 [AS_HELP_STRING([--with-nixpkgs=DIR],
129 [search for Nixpkgs in DIR (for testing purposes only)])],
af51c820
LC
130 [case "$withval" in
131 yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
132 *) NIXPKGS="$withval";;
133 esac],
134 [])
135
e76bdf8b 136AC_MSG_CHECKING([for Nixpkgs source tree])
af51c820 137if test -f "$NIXPKGS/default.nix"; then
af51c820
LC
138 AC_MSG_RESULT([$NIXPKGS])
139 AC_SUBST([NIXPKGS])
140else
e76bdf8b 141 AC_MSG_RESULT([not found])
af51c820
LC
142fi
143
dd01fecd
LC
144LIBGCRYPT="libgcrypt"
145LIBGCRYPT_LIBDIR="no"
146LIBGCRYPT_PREFIX="no"
147
3a310cc0
LC
148AC_ARG_WITH([libgcrypt-prefix],
149 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
150 [case "$withval" in
151 yes|no)
3a310cc0
LC
152 ;;
153 *)
154 LIBGCRYPT="$withval/lib/libgcrypt"
d388c2c4 155 LIBGCRYPT_PREFIX="$withval"
14af289e 156 LIBGCRYPT_LIBDIR="$withval/lib"
3a310cc0 157 ;;
dd01fecd 158 esac])
3a310cc0 159
14af289e
LC
160AC_ARG_WITH([libgcrypt-libdir],
161 [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
162 [search for GNU libgcrypt's shared library in DIR])],
163 [case "$withval" in
164 yes|no)
165 LIBGCRYPT="libgcrypt"
166 LIBGCRYPT_LIBDIR="no"
167 ;;
168 *)
169 LIBGCRYPT="$withval/libgcrypt"
170 LIBGCRYPT_LIBDIR="$withval"
171 ;;
dd01fecd
LC
172 esac])
173
174dnl If none of the --with-libgcrypt-* options was used, try to determine the
175dnl absolute file name of libgcrypt.so.
176case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
177 xnono)
178 GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
179 if test "x$LIBGCRYPT_LIBDIR" != x; then
180 LIBGCRYPT="$LIBGCRYPT_LIBDIR/libgcrypt"
ca34fc31
LC
181 else
182 dnl 'config-daemon.ac' expects "no" in this case.
183 LIBGCRYPT_LIBDIR="no"
dd01fecd
LC
184 fi
185 ;;
186esac
14af289e 187
3a310cc0
LC
188dnl Library name suitable for `dynamic-link'.
189AC_MSG_CHECKING([for libgcrypt shared library name])
190AC_MSG_RESULT([$LIBGCRYPT])
191AC_SUBST([LIBGCRYPT])
d388c2c4 192AC_SUBST([LIBGCRYPT_PREFIX])
14af289e 193AC_SUBST([LIBGCRYPT_LIBDIR])
d388c2c4
LC
194
195GUIX_ASSERT_LIBGCRYPT_USABLE
196
c2033df4
LC
197AC_CACHE_SAVE
198
199m4_include([config-daemon.ac])
3a310cc0 200
cb9e50f6 201dnl `dot' (from the Graphviz package) is only needed for maintainers.
8c01b9d0 202dnl See `Building from Git' in the manual for more info.
cb9e50f6
LC
203AM_MISSING_PROG([DOT], [dot])
204
52eca736
LC
205dnl Manual pages.
206AM_MISSING_PROG([HELP2MAN], [help2man])
207
14a1c319 208AC_CONFIG_FILES([Makefile
ef1a9bb7 209 po/guix/Makefile.in
ee764179 210 po/packages/Makefile.in
8dc2ecfc
LC
211 guix/config.scm])
212
e8b3afeb
LC
213AC_CONFIG_FILES([scripts/guix], [chmod +x scripts/guix])
214AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
215AC_CONFIG_FILES([test-env], [chmod +x test-env])
af51c820 216
457f60fa 217dnl Emacs interface.
51805219 218AC_PATH_PROG([DOT_USER_PROGRAM], [dot], [dot])
457f60fa 219AM_PATH_LISPDIR
596fcbf7
LC
220AM_CONDITIONAL([HAVE_EMACS], [test "x$EMACS" != "xno"])
221
457f60fa
AK
222emacsuidir="${guilemoduledir}/guix/emacs"
223AC_SUBST([emacsuidir])
bd6163d1 224AC_CONFIG_FILES([emacs/guix-config.el
457f60fa
AK
225 emacs/guix-helper.scm])
226
af51c820 227AC_OUTPUT