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], [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 dnl We require the pkg.m4 set of macros from pkg-config.
54 dnl Make sure it's available.
55 m4_pattern_forbid([PKG_CHECK_MODULES])
56
57 PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.5])
58 AC_PATH_PROG([GUILE], [guile])
59 AC_PATH_PROG([GUILD], [guild])
60 if test "x$GUILD" = "x"; then
61 AC_MSG_ERROR(['guild' binary not found; please check your guile-2.x installation.])
62 fi
63
64 dnl Make sure we have a full-fledged Guile.
65 GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
66
67 dnl Check whether (srfi srfi-37) works, and provide our own if it doesn't.
68 GUIX_CHECK_SRFI_37
69 AM_CONDITIONAL([INSTALL_SRFI_37], [test "x$ac_cv_guix_srfi_37_broken" = xyes])
70
71 AC_ARG_WITH([nix-prefix],
72 [AS_HELP_STRING([--with-nix-prefix=DIR],
73 [search for Nix in DIR (for testing purposes and '--disable-daemon' builds)])],
74 [case "$withval" in
75 yes|no) ;;
76 *)
77 NIX_PREFIX="$withval"
78 PATH="$NIX_PREFIX/bin:$PATH"; export PATH
79 AC_SUBST([NIX_PREFIX])
80 ;;
81 esac],
82 [])
83
84 AC_PATH_PROG([NIX_INSTANTIATE], [nix-instantiate])
85 AC_PATH_PROG([NIX_HASH], [nix-hash])
86 if test "x$guix_build_daemon$NIX_INSTANTIATE$NIX_HASH" = "xno"; then
87 AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.])
88 fi
89
90 if test "x$NIX_INSTANTIATE" = "x"; then
91 # This program is an optional dependency, so we just want it to be
92 # taken from $PATH if it's not available right now.
93 NIX_INSTANTIATE="nix-instantiate"
94 fi
95
96 AC_ARG_WITH([nixpkgs],
97 [AS_HELP_STRING([--with-nixpkgs=DIR],
98 [search for Nixpkgs in DIR (for testing purposes only)])],
99 [case "$withval" in
100 yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
101 *) NIXPKGS="$withval";;
102 esac],
103 [])
104
105 AC_MSG_CHECKING([for Nixpkgs source tree])
106 if test -f "$NIXPKGS/default.nix"; then
107 AC_MSG_RESULT([$NIXPKGS])
108 AC_SUBST([NIXPKGS])
109 else
110 AC_MSG_RESULT([not found])
111 fi
112
113 AC_ARG_WITH([libgcrypt-prefix],
114 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
115 [case "$withval" in
116 yes|no)
117 LIBGCRYPT="libgcrypt"
118 LIBGCRYPT_PREFIX="no"
119 LIBGCRYPT_LIBDIR="no"
120 ;;
121 *)
122 LIBGCRYPT="$withval/lib/libgcrypt"
123 LIBGCRYPT_PREFIX="$withval"
124 LIBGCRYPT_LIBDIR="$withval/lib"
125 ;;
126 esac],
127 [LIBGCRYPT="libgcrypt"
128 LIBGCRYPT_PREFIX="no"
129 LIBGCRYPT_LIBDIR="no"])
130
131 AC_ARG_WITH([libgcrypt-libdir],
132 [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
133 [search for GNU libgcrypt's shared library in DIR])],
134 [case "$withval" in
135 yes|no)
136 LIBGCRYPT="libgcrypt"
137 LIBGCRYPT_LIBDIR="no"
138 ;;
139 *)
140 LIBGCRYPT="$withval/libgcrypt"
141 LIBGCRYPT_LIBDIR="$withval"
142 ;;
143 esac],
144 [if test "x$LIBGCRYPT" = x; then
145 LIBGCRYPT="libgcrypt"
146 fi
147 if test "x$LIBGCRYPT_LIBDIR" = x; then
148 LIBGCRYPT_LIBDIR="no"
149 fi])
150
151 dnl Library name suitable for `dynamic-link'.
152 AC_MSG_CHECKING([for libgcrypt shared library name])
153 AC_MSG_RESULT([$LIBGCRYPT])
154 AC_SUBST([LIBGCRYPT])
155 AC_SUBST([LIBGCRYPT_PREFIX])
156 AC_SUBST([LIBGCRYPT_LIBDIR])
157
158 GUIX_ASSERT_LIBGCRYPT_USABLE
159
160 AC_CACHE_SAVE
161
162 m4_include([config-daemon.ac])
163
164 dnl `dot' (from the Graphviz package) is only needed for maintainers.
165 dnl See `HACKING' for more info.
166 AM_MISSING_PROG([DOT], [dot])
167
168 AC_CONFIG_FILES([Makefile
169 po/guix/Makefile.in
170 po/packages/Makefile.in
171 guix/config.scm])
172
173 AC_CONFIG_FILES([scripts/guix], [chmod +x scripts/guix])
174 AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
175 AC_CONFIG_FILES([test-env], [chmod +x test-env])
176
177 AC_OUTPUT