packages: Add 'package->bag' test for propagated inputs.
[guix.git] / configure.ac
blob9c000912cc7e5e0fc5e4ec80c9fb6a5f2bd92adf
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
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])
9 AM_INIT_AUTOMAKE([1.12 gnu silent-rules subdir-objects \
10  color-tests parallel-tests -Woverride])
12 AC_CONFIG_SRCDIR([guix.scm])
13 AC_CONFIG_MACRO_DIR([m4])
15 dnl For the C++ code.  This must be used early.
16 AC_USE_SYSTEM_EXTENSIONS
18 AM_GNU_GETTEXT([external])
19 AM_GNU_GETTEXT_VERSION([0.18.1])
21 guilemoduledir="${datarootdir}/guile/site/2.0"
22 AC_SUBST([guilemoduledir])
24 GUIX_SYSTEM_TYPE
25 GUIX_ASSERT_SUPPORTED_SYSTEM
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)
34 dnl Better be verbose.
35 AC_MSG_CHECKING([for the store directory])
36 AC_MSG_RESULT([$storedir])
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"])
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])
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])
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.])
64 dnl guile-json is used for the PyPI package importer
65 GUILE_MODULE_AVAILABLE([have_guile_json], [(json)])
66 AM_CONDITIONAL([HAVE_GUILE_JSON], [test "x$have_guile_json" = "xyes"])
68 dnl Make sure we have a full-fledged Guile.
69 GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
71 dnl Check whether (srfi srfi-37) works, and provide our own if it doesn't.
72 GUIX_CHECK_SRFI_37
73 AM_CONDITIONAL([INSTALL_SRFI_37], [test "x$ac_cv_guix_srfi_37_broken" = xyes])
75 AC_ARG_WITH([nix-prefix],
76   [AS_HELP_STRING([--with-nix-prefix=DIR],
77     [search for Nix in DIR (for testing purposes and '--disable-daemon' builds)])],
78   [case "$withval" in
79     yes|no) ;;
80     *)
81       NIX_PREFIX="$withval"
82       PATH="$NIX_PREFIX/bin:$PATH"; export PATH
83       AC_SUBST([NIX_PREFIX])
84       ;;
85    esac],
86   [])
88 AC_PATH_PROG([NIX_INSTANTIATE], [nix-instantiate])
89 AC_PATH_PROG([NIX_HASH], [nix-hash])
90 if test "x$guix_build_daemon$NIX_INSTANTIATE$NIX_HASH" = "xno"; then
91    AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.])
94 if test "x$NIX_INSTANTIATE" = "x"; then
95    # This program is an optional dependency, so we just want it to be
96    # taken from $PATH if it's not available right now.
97    NIX_INSTANTIATE="nix-instantiate"
100 AC_ARG_WITH([nixpkgs],
101   [AS_HELP_STRING([--with-nixpkgs=DIR],
102     [search for Nixpkgs in DIR (for testing purposes only)])],
103   [case "$withval" in
104     yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
105     *)      NIXPKGS="$withval";;
106    esac],
107   [])
109 AC_MSG_CHECKING([for Nixpkgs source tree])
110 if test -f "$NIXPKGS/default.nix"; then
111    AC_MSG_RESULT([$NIXPKGS])
112    AC_SUBST([NIXPKGS])
113 else
114    AC_MSG_RESULT([not found])
117 AC_ARG_WITH([libgcrypt-prefix],
118   [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
119   [case "$withval" in
120     yes|no)
121       LIBGCRYPT="libgcrypt"
122       LIBGCRYPT_PREFIX="no"
123       LIBGCRYPT_LIBDIR="no"
124       ;;
125     *)
126       LIBGCRYPT="$withval/lib/libgcrypt"
127       LIBGCRYPT_PREFIX="$withval"
128       LIBGCRYPT_LIBDIR="$withval/lib"
129       ;;
130    esac],
131   [LIBGCRYPT="libgcrypt"
132    LIBGCRYPT_PREFIX="no"
133    LIBGCRYPT_LIBDIR="no"])
135 AC_ARG_WITH([libgcrypt-libdir],
136   [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
137      [search for GNU libgcrypt's shared library in DIR])],
138   [case "$withval" in
139     yes|no)
140       LIBGCRYPT="libgcrypt"
141       LIBGCRYPT_LIBDIR="no"
142       ;;
143     *)
144       LIBGCRYPT="$withval/libgcrypt"
145       LIBGCRYPT_LIBDIR="$withval"
146       ;;
147    esac],
148   [if test "x$LIBGCRYPT" = x; then
149       LIBGCRYPT="libgcrypt"
150    fi
151    if test "x$LIBGCRYPT_LIBDIR" = x; then
152       LIBGCRYPT_LIBDIR="no"
153    fi])
155 dnl Library name suitable for `dynamic-link'.
156 AC_MSG_CHECKING([for libgcrypt shared library name])
157 AC_MSG_RESULT([$LIBGCRYPT])
158 AC_SUBST([LIBGCRYPT])
159 AC_SUBST([LIBGCRYPT_PREFIX])
160 AC_SUBST([LIBGCRYPT_LIBDIR])
162 GUIX_ASSERT_LIBGCRYPT_USABLE
164 AC_CACHE_SAVE
166 m4_include([config-daemon.ac])
168 dnl `dot' (from the Graphviz package) is only needed for maintainers.
169 dnl See `HACKING' for more info.
170 AM_MISSING_PROG([DOT], [dot])
172 AC_CONFIG_FILES([Makefile
173                  po/guix/Makefile.in
174                  po/packages/Makefile.in
175                  guix/config.scm])
177 AC_CONFIG_FILES([scripts/guix], [chmod +x scripts/guix])
178 AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
179 AC_CONFIG_FILES([test-env],     [chmod +x test-env])
181 dnl Emacs interface.
182 AM_PATH_LISPDIR
183 AM_CONDITIONAL([HAVE_EMACS], [test "x$EMACS" != "xno"])
185 emacsuidir="${guilemoduledir}/guix/emacs"
186 AC_SUBST([emacsuidir])
187 AC_CONFIG_FILES([emacs/guix-init.el
188                  emacs/guix-helper.scm])
190 AC_OUTPUT