store: Add 'register-path' procedure.
[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.6], [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 [path of the store (defaults to /nix/store)]),
30 [storedir="$withval"],
31 [storedir="/nix/store"])
32 AC_SUBST(storedir)
33
34 AC_ARG_ENABLE([daemon],
35 [AS_HELP_STRING([--disable-daemon], [build the Nix daemon (C++)])],
36 [guix_build_daemon="$enableval"],
37 [guix_build_daemon="yes"])
38
39 # Prepare a version of $localstatedir & co. that does not contain references
40 # to shell variables.
41 guix_prefix="`eval echo $prefix | sed -e"s|NONE|/usr/local|g"`"
42 guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|$guix_prefix|g"`"
43 guix_sysconfdir="`eval echo $sysconfdir | sed -e "s|NONE|$guix_prefix|g"`"
44 guix_sbindir="`eval echo $sbindir | sed -e "s|NONE|$guix_prefix|g"`"
45 AC_SUBST([guix_localstatedir])
46 AC_SUBST([guix_sysconfdir])
47 AC_SUBST([guix_sbindir])
48
49 dnl We require the pkg.m4 set of macros from pkg-config.
50 dnl Make sure it's available.
51 m4_pattern_forbid([PKG_CHECK_MODULES])
52
53 PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.5])
54 AC_PATH_PROG([GUILE], [guile])
55 AC_PATH_PROG([GUILD], [guild])
56 if test "x$GUILD" = "x"; then
57 AC_MSG_ERROR(['guild' binary not found; please check your guile-2.x installation.])
58 fi
59
60 dnl Make sure we have a full-fledged Guile.
61 GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
62
63 dnl Check whether (srfi srfi-37) works, and provide our own if it doesn't.
64 GUIX_CHECK_SRFI_37
65 AM_CONDITIONAL([INSTALL_SRFI_37], [test "x$ac_cv_guix_srfi_37_broken" = xyes])
66
67 AC_ARG_WITH([nix-prefix],
68 [AS_HELP_STRING([--with-nix-prefix=DIR],
69 [search for Nix in DIR (for testing purposes and '--disable-daemon' builds)])],
70 [case "$withval" in
71 yes|no) ;;
72 *)
73 NIX_PREFIX="$withval"
74 PATH="$NIX_PREFIX/bin:$PATH"; export PATH
75 AC_SUBST([NIX_PREFIX])
76 ;;
77 esac],
78 [])
79
80 AC_PATH_PROG([NIX_INSTANTIATE], [nix-instantiate])
81 AC_PATH_PROG([NIX_HASH], [nix-hash])
82 if test "x$guix_build_daemon$NIX_INSTANTIATE$NIX_HASH" = "xno"; then
83 AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.])
84 fi
85
86 if test "x$NIX_INSTANTIATE" = "x"; then
87 # This program is an optional dependency, so we just want it to be
88 # taken from $PATH if it's not available right now.
89 NIX_INSTANTIATE="nix-instantiate"
90 fi
91
92 AC_ARG_WITH([nixpkgs],
93 [AS_HELP_STRING([--with-nixpkgs=DIR],
94 [search for Nixpkgs in DIR (for testing purposes only)])],
95 [case "$withval" in
96 yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
97 *) NIXPKGS="$withval";;
98 esac],
99 [])
100
101 AC_MSG_CHECKING([for Nixpkgs source tree])
102 if test -f "$NIXPKGS/default.nix"; then
103 AC_MSG_RESULT([$NIXPKGS])
104 AC_SUBST([NIXPKGS])
105 else
106 AC_MSG_RESULT([not found])
107 fi
108
109 AC_ARG_WITH([libgcrypt-prefix],
110 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
111 [case "$withval" in
112 yes|no)
113 LIBGCRYPT="libgcrypt"
114 LIBGCRYPT_PREFIX="no"
115 ;;
116 *)
117 LIBGCRYPT="$withval/lib/libgcrypt"
118 LIBGCRYPT_PREFIX="$withval"
119 ;;
120 esac],
121 [LIBGCRYPT="libgcrypt"])
122
123 dnl Library name suitable for `dynamic-link'.
124 AC_MSG_CHECKING([for libgcrypt shared library name])
125 AC_MSG_RESULT([$LIBGCRYPT])
126 AC_SUBST([LIBGCRYPT])
127 AC_SUBST([LIBGCRYPT_PREFIX])
128
129 GUIX_ASSERT_LIBGCRYPT_USABLE
130
131 AC_CACHE_SAVE
132
133 m4_include([config-daemon.ac])
134
135 dnl `dot' (from the Graphviz package) is only needed for maintainers.
136 dnl See `HACKING' for more info.
137 AM_MISSING_PROG([DOT], [dot])
138
139 AC_CONFIG_FILES([Makefile
140 po/Makefile.in
141 guix/config.scm])
142
143 AC_CONFIG_FILES([scripts/guix], [chmod +x scripts/guix])
144 AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
145 AC_CONFIG_FILES([test-env], [chmod +x test-env])
146
147 AC_OUTPUT