Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.68)
5 AC_INIT([GNU Guix], [0.8.2], [bug-guix@gnu.org], [guix],
6 [http://www.gnu.org/software/guix/])
7 AC_CONFIG_AUX_DIR([build-aux])
8
9 AM_INIT_AUTOMAKE([1.12 gnu silent-rules subdir-objects \
10 color-tests parallel-tests -Woverride])
11
12 AC_CONFIG_SRCDIR([guix.scm])
13 AC_CONFIG_MACRO_DIR([m4])
14
15 dnl For the C++ code. This must be used early.
16 AC_USE_SYSTEM_EXTENSIONS
17
18 AM_GNU_GETTEXT([external])
19 AM_GNU_GETTEXT_VERSION([0.18.1])
20
21 guilemoduledir="${datarootdir}/guile/site/2.0"
22 AC_SUBST([guilemoduledir])
23
24 GUIX_SYSTEM_TYPE
25 GUIX_ASSERT_SUPPORTED_SYSTEM
26
27 AC_ARG_WITH(store-dir,
28 AC_HELP_STRING([--with-store-dir=PATH],
29 [file name of the store (defaults to /gnu/store)]),
30 [storedir="$withval"],
31 [storedir="/gnu/store"])
32 AC_SUBST(storedir)
33
34 dnl Better be verbose.
35 AC_MSG_CHECKING([for the store directory])
36 AC_MSG_RESULT([$storedir])
37
38 AC_ARG_ENABLE([daemon],
39 [AS_HELP_STRING([--disable-daemon], [build the Nix daemon (C++)])],
40 [guix_build_daemon="$enableval"],
41 [guix_build_daemon="yes"])
42
43 # Prepare a version of $localstatedir & co. that does not contain references
44 # to shell variables.
45 guix_prefix="`eval echo $prefix | sed -e"s|NONE|/usr/local|g"`"
46 guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|$guix_prefix|g"`"
47 guix_sysconfdir="`eval echo $sysconfdir | sed -e "s|NONE|$guix_prefix|g"`"
48 guix_sbindir="`eval echo $sbindir | sed -e "s|NONE|$guix_prefix|g"`"
49 AC_SUBST([guix_localstatedir])
50 AC_SUBST([guix_sysconfdir])
51 AC_SUBST([guix_sbindir])
52
53 GUIX_CHECK_FILE_NAME_LIMITS
54
55 dnl We require the pkg.m4 set of macros from pkg-config.
56 dnl Make sure it's available.
57 m4_pattern_forbid([PKG_CHECK_MODULES])
58
59 PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.5])
60 AC_PATH_PROG([GUILE], [guile])
61 AC_PATH_PROG([GUILD], [guild])
62 if test "x$GUILD" = "x"; then
63 AC_MSG_ERROR(['guild' binary not found; please check your guile-2.x installation.])
64 fi
65
66 dnl guile-json is used for the PyPI package importer
67 GUILE_MODULE_AVAILABLE([have_guile_json], [(json)])
68 AM_CONDITIONAL([HAVE_GUILE_JSON], [test "x$have_guile_json" = "xyes"])
69
70 dnl Make sure we have a full-fledged Guile.
71 GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
72
73 dnl Check whether (srfi srfi-37) works, and provide our own if it doesn't.
74 GUIX_CHECK_SRFI_37
75 AM_CONDITIONAL([INSTALL_SRFI_37], [test "x$ac_cv_guix_srfi_37_broken" = xyes])
76
77 AC_ARG_WITH([nix-prefix],
78 [AS_HELP_STRING([--with-nix-prefix=DIR],
79 [search for Nix in DIR (for testing purposes and '--disable-daemon' builds)])],
80 [case "$withval" in
81 yes|no) ;;
82 *)
83 NIX_PREFIX="$withval"
84 PATH="$NIX_PREFIX/bin:$PATH"; export PATH
85 AC_SUBST([NIX_PREFIX])
86 ;;
87 esac],
88 [])
89
90 AC_PATH_PROG([NIX_INSTANTIATE], [nix-instantiate])
91 AC_PATH_PROG([NIX_HASH], [nix-hash])
92 if test "x$guix_build_daemon$NIX_INSTANTIATE$NIX_HASH" = "xno"; then
93 AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.])
94 fi
95
96 if test "x$NIX_INSTANTIATE" = "x"; then
97 # This program is an optional dependency, so we just want it to be
98 # taken from $PATH if it's not available right now.
99 NIX_INSTANTIATE="nix-instantiate"
100 fi
101
102 AC_ARG_WITH([nixpkgs],
103 [AS_HELP_STRING([--with-nixpkgs=DIR],
104 [search for Nixpkgs in DIR (for testing purposes only)])],
105 [case "$withval" in
106 yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
107 *) NIXPKGS="$withval";;
108 esac],
109 [])
110
111 AC_MSG_CHECKING([for Nixpkgs source tree])
112 if test -f "$NIXPKGS/default.nix"; then
113 AC_MSG_RESULT([$NIXPKGS])
114 AC_SUBST([NIXPKGS])
115 else
116 AC_MSG_RESULT([not found])
117 fi
118
119 AC_ARG_WITH([libgcrypt-prefix],
120 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
121 [case "$withval" in
122 yes|no)
123 LIBGCRYPT="libgcrypt"
124 LIBGCRYPT_PREFIX="no"
125 LIBGCRYPT_LIBDIR="no"
126 ;;
127 *)
128 LIBGCRYPT="$withval/lib/libgcrypt"
129 LIBGCRYPT_PREFIX="$withval"
130 LIBGCRYPT_LIBDIR="$withval/lib"
131 ;;
132 esac],
133 [LIBGCRYPT="libgcrypt"
134 LIBGCRYPT_PREFIX="no"
135 LIBGCRYPT_LIBDIR="no"])
136
137 AC_ARG_WITH([libgcrypt-libdir],
138 [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
139 [search for GNU libgcrypt's shared library in DIR])],
140 [case "$withval" in
141 yes|no)
142 LIBGCRYPT="libgcrypt"
143 LIBGCRYPT_LIBDIR="no"
144 ;;
145 *)
146 LIBGCRYPT="$withval/libgcrypt"
147 LIBGCRYPT_LIBDIR="$withval"
148 ;;
149 esac],
150 [if test "x$LIBGCRYPT" = x; then
151 LIBGCRYPT="libgcrypt"
152 fi
153 if test "x$LIBGCRYPT_LIBDIR" = x; then
154 LIBGCRYPT_LIBDIR="no"
155 fi])
156
157 dnl Library name suitable for `dynamic-link'.
158 AC_MSG_CHECKING([for libgcrypt shared library name])
159 AC_MSG_RESULT([$LIBGCRYPT])
160 AC_SUBST([LIBGCRYPT])
161 AC_SUBST([LIBGCRYPT_PREFIX])
162 AC_SUBST([LIBGCRYPT_LIBDIR])
163
164 GUIX_ASSERT_LIBGCRYPT_USABLE
165
166 AC_CACHE_SAVE
167
168 m4_include([config-daemon.ac])
169
170 dnl `dot' (from the Graphviz package) is only needed for maintainers.
171 dnl See `HACKING' for more info.
172 AM_MISSING_PROG([DOT], [dot])
173
174 AC_CONFIG_FILES([Makefile
175 po/guix/Makefile.in
176 po/packages/Makefile.in
177 guix/config.scm])
178
179 AC_CONFIG_FILES([scripts/guix], [chmod +x scripts/guix])
180 AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
181 AC_CONFIG_FILES([test-env], [chmod +x test-env])
182
183 dnl Emacs interface.
184 AM_PATH_LISPDIR
185 AM_CONDITIONAL([HAVE_EMACS], [test "x$EMACS" != "xno"])
186
187 emacsuidir="${guilemoduledir}/guix/emacs"
188 AC_SUBST([emacsuidir])
189 AC_CONFIG_FILES([emacs/guix-init.el
190 emacs/guix-profiles.el
191 emacs/guix-helper.scm])
192
193 AC_OUTPUT