| 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.4], [[email protected]], [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 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 | dnl Check whether (srfi srfi-37) works, and provide our own if it doesn't. |
| 55 | GUIX_CHECK_SRFI_37 |
| 56 | AM_CONDITIONAL([INSTALL_SRFI_37], [test "x$ac_cv_guix_srfi_37_broken" = xyes]) |
| 57 | |
| 58 | AC_ARG_WITH([nix-prefix], |
| 59 | [AS_HELP_STRING([--with-nix-prefix=DIR], [search for Nix in DIR])], |
| 60 | [case "$withval" in |
| 61 | yes|no) ;; |
| 62 | *) |
| 63 | NIX_PREFIX="$withval" |
| 64 | PATH="$NIX_PREFIX/bin:$PATH"; export PATH |
| 65 | AC_SUBST([NIX_PREFIX]) |
| 66 | ;; |
| 67 | esac], |
| 68 | []) |
| 69 | |
| 70 | AC_PATH_PROG([NIX_INSTANTIATE], [nix-instantiate]) |
| 71 | AC_PATH_PROG([NIX_HASH], [nix-hash]) |
| 72 | if test "x$guix_build_daemon$NIX_INSTANTIATE$NIX_HASH" = "xno"; then |
| 73 | AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.]) |
| 74 | fi |
| 75 | |
| 76 | if test "x$NIX_INSTANTIATE" = "x"; then |
| 77 | # This program is an optional dependency, so we just want it to be |
| 78 | # taken from $PATH if it's not available right now. |
| 79 | NIX_INSTANTIATE="nix-instantiate" |
| 80 | fi |
| 81 | |
| 82 | AC_ARG_WITH([nixpkgs], |
| 83 | [AS_HELP_STRING([--with-nixpkgs=DIR], [search for Nixpkgs in DIR])], |
| 84 | [case "$withval" in |
| 85 | yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);; |
| 86 | *) NIXPKGS="$withval";; |
| 87 | esac], |
| 88 | []) |
| 89 | |
| 90 | AC_MSG_CHECKING([for Nixpkgs source tree]) |
| 91 | if test -f "$NIXPKGS/default.nix"; then |
| 92 | AC_MSG_RESULT([$NIXPKGS]) |
| 93 | AC_SUBST([NIXPKGS]) |
| 94 | else |
| 95 | AC_MSG_RESULT([not found]) |
| 96 | fi |
| 97 | |
| 98 | AC_ARG_WITH([libgcrypt-prefix], |
| 99 | [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])], |
| 100 | [case "$withval" in |
| 101 | yes|no) |
| 102 | LIBGCRYPT="libgcrypt" |
| 103 | LIBGCRYPT_PREFIX="no" |
| 104 | ;; |
| 105 | *) |
| 106 | LIBGCRYPT="$withval/lib/libgcrypt" |
| 107 | LIBGCRYPT_PREFIX="$withval" |
| 108 | ;; |
| 109 | esac], |
| 110 | [LIBGCRYPT="libgcrypt"]) |
| 111 | |
| 112 | dnl Library name suitable for `dynamic-link'. |
| 113 | AC_MSG_CHECKING([for libgcrypt shared library name]) |
| 114 | AC_MSG_RESULT([$LIBGCRYPT]) |
| 115 | AC_SUBST([LIBGCRYPT]) |
| 116 | AC_SUBST([LIBGCRYPT_PREFIX]) |
| 117 | |
| 118 | GUIX_ASSERT_LIBGCRYPT_USABLE |
| 119 | |
| 120 | AC_CACHE_SAVE |
| 121 | |
| 122 | m4_include([config-daemon.ac]) |
| 123 | |
| 124 | dnl `dot' (from the Graphviz package) is only needed for maintainers. |
| 125 | dnl See `HACKING' for more info. |
| 126 | AM_MISSING_PROG([DOT], [dot]) |
| 127 | |
| 128 | AC_CONFIG_FILES([Makefile |
| 129 | po/Makefile.in |
| 130 | guix/config.scm]) |
| 131 | |
| 132 | AC_CONFIG_FILES([scripts/guix], [chmod +x scripts/guix]) |
| 133 | AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env]) |
| 134 | AC_CONFIG_FILES([test-env], [chmod +x test-env]) |
| 135 | |
| 136 | AC_OUTPUT |