build: Correctly determine the system type for non-Linux systems.
[jackhill/guix/guix.git] / configure.ac
CommitLineData
af51c820
LC
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.68)
4bc3fcc7
LC
5AC_INIT([GNU Guix], [0.3], [bug-guix@gnu.org], [guix],
6 [http://www.gnu.org/software/guix/])
af51c820
LC
7AC_CONFIG_AUX_DIR([build-aux])
8
8aab64fc 9AM_INIT_AUTOMAKE([1.12 gnu silent-rules subdir-objects \
af51c820
LC
10 color-tests parallel-tests])
11
12AC_CONFIG_SRCDIR([guix.scm])
13AC_CONFIG_MACRO_DIR([m4])
14
c2033df4
LC
15dnl For the C++ code. This must be used early.
16AC_USE_SYSTEM_EXTENSIONS
17
f68b0893 18AM_GNU_GETTEXT([external])
0a042340 19AM_GNU_GETTEXT_VERSION([0.18.1])
f68b0893 20
af51c820
LC
21guilemoduledir="${datarootdir}/guile/site/2.0"
22AC_SUBST([guilemoduledir])
23
c2033df4
LC
24GUIX_SYSTEM_TYPE
25
26AC_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"])
31AC_SUBST(storedir)
73d96596 32
3a61f801 33AC_ARG_ENABLE([daemon],
c9b70836 34 [AS_HELP_STRING([--disable-daemon], [build the Nix daemon (C++)])],
3a61f801 35 [guix_build_daemon="$enableval"],
c9b70836 36 [guix_build_daemon="yes"])
3a61f801 37
d8eea3d2
LC
38# Prepare a version of $localstatedir that does not contain references
39# to shell variables.
40guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|/usr/local|g"`"
41AC_SUBST([guix_localstatedir])
42
56dbcb09 43PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.5])
af51c820
LC
44AC_PATH_PROG([GUILE], [guile])
45AC_PATH_PROG([GUILD], [guild])
73f9a978
CN
46if test "x$GUILD" = "x"; then
47 AC_MSG_ERROR(['guild' binary not found; please check your guile-2.x installation.])
48fi
af51c820 49
9c7dd33a
LC
50dnl Make sure we have a full-fledged Guile.
51GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
52
af51c820
LC
53AC_ARG_WITH([nix-prefix],
54 [AS_HELP_STRING([--with-nix-prefix=DIR], [search for Nix in DIR])],
55 [case "$withval" in
56 yes|no) ;;
437e0729
LC
57 *)
58 NIX_PREFIX="$withval"
59 PATH="$NIX_PREFIX/bin:$PATH"; export PATH
60 AC_SUBST([NIX_PREFIX])
61 ;;
af51c820
LC
62 esac],
63 [])
64
65AC_PATH_PROG([NIX_INSTANTIATE], [nix-instantiate])
66AC_PATH_PROG([NIX_HASH], [nix-hash])
3a61f801 67if test "x$guix_build_daemon$NIX_INSTANTIATE$NIX_HASH" = "xno"; then
af51c820
LC
68 AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.])
69fi
70
c217708f
LC
71if 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"
75fi
76
af51c820
LC
77AC_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
e76bdf8b 85AC_MSG_CHECKING([for Nixpkgs source tree])
af51c820 86if test -f "$NIXPKGS/default.nix"; then
af51c820
LC
87 AC_MSG_RESULT([$NIXPKGS])
88 AC_SUBST([NIXPKGS])
89else
e76bdf8b 90 AC_MSG_RESULT([not found])
af51c820
LC
91fi
92
3a310cc0
LC
93AC_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"
d388c2c4 98 LIBGCRYPT_PREFIX="no"
3a310cc0
LC
99 ;;
100 *)
101 LIBGCRYPT="$withval/lib/libgcrypt"
d388c2c4 102 LIBGCRYPT_PREFIX="$withval"
3a310cc0
LC
103 ;;
104 esac],
105 [LIBGCRYPT="libgcrypt"])
106
107dnl Library name suitable for `dynamic-link'.
108AC_MSG_CHECKING([for libgcrypt shared library name])
109AC_MSG_RESULT([$LIBGCRYPT])
110AC_SUBST([LIBGCRYPT])
d388c2c4
LC
111AC_SUBST([LIBGCRYPT_PREFIX])
112
113GUIX_ASSERT_LIBGCRYPT_USABLE
114
c2033df4
LC
115AC_CACHE_SAVE
116
117m4_include([config-daemon.ac])
3a310cc0 118
14a1c319
LC
119AC_CONFIG_FILES([Makefile
120 po/Makefile.in
8dc2ecfc
LC
121 guix/config.scm])
122
e8b3afeb
LC
123AC_CONFIG_FILES([scripts/guix], [chmod +x scripts/guix])
124AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
125AC_CONFIG_FILES([test-env], [chmod +x test-env])
af51c820
LC
126
127AC_OUTPUT