substitute-binary: Directly replace the global `regexp-exec'.
[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.3], [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])
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 that does not contain references
40 # to shell variables.
41 guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|/usr/local|g"`"
42 AC_SUBST([guix_localstatedir])
43
44 PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.5])
45 AC_PATH_PROG([GUILE], [guile])
46 AC_PATH_PROG([GUILD], [guild])
47 if test "x$GUILD" = "x"; then
48 AC_MSG_ERROR(['guild' binary not found; please check your guile-2.x installation.])
49 fi
50
51 dnl Make sure we have a full-fledged Guile.
52 GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
53
54 AC_ARG_WITH([nix-prefix],
55 [AS_HELP_STRING([--with-nix-prefix=DIR], [search for Nix in DIR])],
56 [case "$withval" in
57 yes|no) ;;
58 *)
59 NIX_PREFIX="$withval"
60 PATH="$NIX_PREFIX/bin:$PATH"; export PATH
61 AC_SUBST([NIX_PREFIX])
62 ;;
63 esac],
64 [])
65
66 AC_PATH_PROG([NIX_INSTANTIATE], [nix-instantiate])
67 AC_PATH_PROG([NIX_HASH], [nix-hash])
68 if test "x$guix_build_daemon$NIX_INSTANTIATE$NIX_HASH" = "xno"; then
69 AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.])
70 fi
71
72 if test "x$NIX_INSTANTIATE" = "x"; then
73 # This program is an optional dependency, so we just want it to be
74 # taken from $PATH if it's not available right now.
75 NIX_INSTANTIATE="nix-instantiate"
76 fi
77
78 AC_ARG_WITH([nixpkgs],
79 [AS_HELP_STRING([--with-nixpkgs=DIR], [search for Nixpkgs in DIR])],
80 [case "$withval" in
81 yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
82 *) NIXPKGS="$withval";;
83 esac],
84 [])
85
86 AC_MSG_CHECKING([for Nixpkgs source tree])
87 if test -f "$NIXPKGS/default.nix"; then
88 AC_MSG_RESULT([$NIXPKGS])
89 AC_SUBST([NIXPKGS])
90 else
91 AC_MSG_RESULT([not found])
92 fi
93
94 AC_ARG_WITH([libgcrypt-prefix],
95 [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
96 [case "$withval" in
97 yes|no)
98 LIBGCRYPT="libgcrypt"
99 LIBGCRYPT_PREFIX="no"
100 ;;
101 *)
102 LIBGCRYPT="$withval/lib/libgcrypt"
103 LIBGCRYPT_PREFIX="$withval"
104 ;;
105 esac],
106 [LIBGCRYPT="libgcrypt"])
107
108 dnl Library name suitable for `dynamic-link'.
109 AC_MSG_CHECKING([for libgcrypt shared library name])
110 AC_MSG_RESULT([$LIBGCRYPT])
111 AC_SUBST([LIBGCRYPT])
112 AC_SUBST([LIBGCRYPT_PREFIX])
113
114 GUIX_ASSERT_LIBGCRYPT_USABLE
115
116 AC_CACHE_SAVE
117
118 m4_include([config-daemon.ac])
119
120 AC_CONFIG_FILES([Makefile
121 po/Makefile.in
122 guix/config.scm])
123
124 AC_CONFIG_FILES([scripts/guix], [chmod +x scripts/guix])
125 AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
126 AC_CONFIG_FILES([test-env], [chmod +x test-env])
127
128 AC_OUTPUT