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