Add Zsh completion file.
[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)
bd883da3 5AC_INIT([GNU Guix], [0.11.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
96dbc930
ELB
44AC_ARG_WITH([zsh-completion-dir],
45 AC_HELP_STRING([--with-zsh-completion-dir=DIR],
46 [name of the Zsh completion directory]),
47 [zshcompletiondir="$withval"],
48 [zshcompletiondir='${datadir}/zsh/site-functions'])
49AC_SUBST([zshcompletiondir])
50
834129e0
LC
51dnl Better be verbose.
52AC_MSG_CHECKING([for the store directory])
53AC_MSG_RESULT([$storedir])
54
3a61f801 55AC_ARG_ENABLE([daemon],
c9b70836 56 [AS_HELP_STRING([--disable-daemon], [build the Nix daemon (C++)])],
3a61f801 57 [guix_build_daemon="$enableval"],
c9b70836 58 [guix_build_daemon="yes"])
3a61f801 59
3f40cfde 60# Prepare a version of $localstatedir & co. that does not contain references
d8eea3d2 61# to shell variables.
6bfec3ed
LC
62guix_prefix="`eval echo $prefix | sed -e"s|NONE|/usr/local|g"`"
63guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|$guix_prefix|g"`"
64guix_sysconfdir="`eval echo $sysconfdir | sed -e "s|NONE|$guix_prefix|g"`"
65guix_sbindir="`eval echo $sbindir | sed -e "s|NONE|$guix_prefix|g"`"
d8eea3d2 66AC_SUBST([guix_localstatedir])
3f40cfde 67AC_SUBST([guix_sysconfdir])
6bfec3ed 68AC_SUBST([guix_sbindir])
d8eea3d2 69
bb251307
LC
70GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests])
71AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"])
2178ed66 72
0e991c25
LC
73dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.)
74dnl Make sure they are available.
ff1cbb95 75m4_pattern_forbid([PKG_CHECK_MODULES])
0e991c25 76m4_pattern_forbid([GUILE_MODULE_AVAILABLE])
ff1cbb95 77
47c66da0 78PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.7])
af51c820
LC
79AC_PATH_PROG([GUILE], [guile])
80AC_PATH_PROG([GUILD], [guild])
73f9a978
CN
81if test "x$GUILD" = "x"; then
82 AC_MSG_ERROR(['guild' binary not found; please check your guile-2.x installation.])
83fi
af51c820 84
1b3e9685
DT
85dnl guile-json is used for the PyPI package importer
86GUILE_MODULE_AVAILABLE([have_guile_json], [(json)])
87AM_CONDITIONAL([HAVE_GUILE_JSON], [test "x$have_guile_json" = "xyes"])
88
9c7dd33a
LC
89dnl Make sure we have a full-fledged Guile.
90GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
91
1959fb04
LC
92dnl Check whether (srfi srfi-37) works, and provide our own if it doesn't.
93GUIX_CHECK_SRFI_37
94AM_CONDITIONAL([INSTALL_SRFI_37], [test "x$ac_cv_guix_srfi_37_broken" = xyes])
95
cd48eae5
LC
96dnl Decompressors, for use by the substituter and other modules.
97AC_PATH_PROG([GZIP], [gzip])
98AC_PATH_PROG([BZIP2], [bzip2])
99AC_PATH_PROG([XZ], [xz])
100AC_SUBST([GZIP])
101AC_SUBST([BZIP2])
102AC_SUBST([XZ])
103
af51c820 104AC_ARG_WITH([nix-prefix],
bb0a70e1
LC
105 [AS_HELP_STRING([--with-nix-prefix=DIR],
106 [search for Nix in DIR (for testing purposes and '--disable-daemon' builds)])],
af51c820
LC
107 [case "$withval" in
108 yes|no) ;;
437e0729
LC
109 *)
110 NIX_PREFIX="$withval"
111 PATH="$NIX_PREFIX/bin:$PATH"; export PATH
112 AC_SUBST([NIX_PREFIX])
113 ;;
af51c820
LC
114 esac],
115 [])
116
117AC_PATH_PROG([NIX_INSTANTIATE], [nix-instantiate])
118AC_PATH_PROG([NIX_HASH], [nix-hash])
3a61f801 119if test "x$guix_build_daemon$NIX_INSTANTIATE$NIX_HASH" = "xno"; then
af51c820
LC
120 AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.])
121fi
122
c217708f
LC
123if test "x$NIX_INSTANTIATE" = "x"; then
124 # This program is an optional dependency, so we just want it to be
125 # taken from $PATH if it's not available right now.
126 NIX_INSTANTIATE="nix-instantiate"
127fi
128
af51c820 129AC_ARG_WITH([nixpkgs],
bb0a70e1
LC
130 [AS_HELP_STRING([--with-nixpkgs=DIR],
131 [search for Nixpkgs in DIR (for testing purposes only)])],
af51c820
LC
132 [case "$withval" in
133 yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
134 *) NIXPKGS="$withval";;
135 esac],
136 [])
137
e76bdf8b 138AC_MSG_CHECKING([for Nixpkgs source tree])
af51c820 139if test -f "$NIXPKGS/default.nix"; then
af51c820
LC
140 AC_MSG_RESULT([$NIXPKGS])
141 AC_SUBST([NIXPKGS])
142else
e76bdf8b 143 AC_MSG_RESULT([not found])
af51c820
LC
144fi
145
dd01fecd
LC
146LIBGCRYPT="libgcrypt"
147LIBGCRYPT_LIBDIR="no"
148LIBGCRYPT_PREFIX="no"
149
3a310cc0
LC
150AC_ARG_WITH([libgcrypt-prefix],
151 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
152 [case "$withval" in
153 yes|no)
3a310cc0
LC
154 ;;
155 *)
156 LIBGCRYPT="$withval/lib/libgcrypt"
d388c2c4 157 LIBGCRYPT_PREFIX="$withval"
14af289e 158 LIBGCRYPT_LIBDIR="$withval/lib"
3a310cc0 159 ;;
dd01fecd 160 esac])
3a310cc0 161
14af289e
LC
162AC_ARG_WITH([libgcrypt-libdir],
163 [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
164 [search for GNU libgcrypt's shared library in DIR])],
165 [case "$withval" in
166 yes|no)
167 LIBGCRYPT="libgcrypt"
168 LIBGCRYPT_LIBDIR="no"
169 ;;
170 *)
171 LIBGCRYPT="$withval/libgcrypt"
172 LIBGCRYPT_LIBDIR="$withval"
173 ;;
dd01fecd
LC
174 esac])
175
176dnl If none of the --with-libgcrypt-* options was used, try to determine the
177dnl absolute file name of libgcrypt.so.
178case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
179 xnono)
180 GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
181 if test "x$LIBGCRYPT_LIBDIR" != x; then
182 LIBGCRYPT="$LIBGCRYPT_LIBDIR/libgcrypt"
ca34fc31
LC
183 else
184 dnl 'config-daemon.ac' expects "no" in this case.
185 LIBGCRYPT_LIBDIR="no"
dd01fecd
LC
186 fi
187 ;;
188esac
14af289e 189
3a310cc0
LC
190dnl Library name suitable for `dynamic-link'.
191AC_MSG_CHECKING([for libgcrypt shared library name])
192AC_MSG_RESULT([$LIBGCRYPT])
193AC_SUBST([LIBGCRYPT])
d388c2c4 194AC_SUBST([LIBGCRYPT_PREFIX])
14af289e 195AC_SUBST([LIBGCRYPT_LIBDIR])
d388c2c4
LC
196
197GUIX_ASSERT_LIBGCRYPT_USABLE
198
72153902
LC
199dnl Library name of zlib suitable for 'dynamic-link'.
200GUIX_LIBZ_LIBDIR([libz_libdir])
201if test "x$libz_libdir" = "x"; then
202 LIBZ="libz"
203else
204 LIBZ="$libz_libdir/libz"
205fi
206AC_MSG_CHECKING([for zlib's shared library name])
207AC_MSG_RESULT([$LIBZ])
208AC_SUBST([LIBZ])
209
c2033df4
LC
210AC_CACHE_SAVE
211
212m4_include([config-daemon.ac])
3a310cc0 213
cb9e50f6 214dnl `dot' (from the Graphviz package) is only needed for maintainers.
8c01b9d0 215dnl See `Building from Git' in the manual for more info.
cb9e50f6
LC
216AM_MISSING_PROG([DOT], [dot])
217
52eca736
LC
218dnl Manual pages.
219AM_MISSING_PROG([HELP2MAN], [help2man])
220
14a1c319 221AC_CONFIG_FILES([Makefile
ef1a9bb7 222 po/guix/Makefile.in
ee764179 223 po/packages/Makefile.in
8dc2ecfc
LC
224 guix/config.scm])
225
e8b3afeb 226AC_CONFIG_FILES([scripts/guix], [chmod +x scripts/guix])
a1097caa
ML
227AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
228AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
229 [chmod +x pre-inst-env])
af51c820 230
457f60fa 231dnl Emacs interface.
51805219 232AC_PATH_PROG([DOT_USER_PROGRAM], [dot], [dot])
457f60fa 233AM_PATH_LISPDIR
596fcbf7
LC
234AM_CONDITIONAL([HAVE_EMACS], [test "x$EMACS" != "xno"])
235
457f60fa
AK
236emacsuidir="${guilemoduledir}/guix/emacs"
237AC_SUBST([emacsuidir])
bd6163d1 238AC_CONFIG_FILES([emacs/guix-config.el
457f60fa
AK
239 emacs/guix-helper.scm])
240
af51c820 241AC_OUTPUT