| 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.2], [bug-guix@gnu.org], [guix], |
| 6 | [http://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]) |
| 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 | AC_ARG_WITH([nix-prefix], |
| 51 | [AS_HELP_STRING([--with-nix-prefix=DIR], [search for Nix in DIR])], |
| 52 | [case "$withval" in |
| 53 | yes|no) ;; |
| 54 | *) |
| 55 | NIX_PREFIX="$withval" |
| 56 | PATH="$NIX_PREFIX/bin:$PATH"; export PATH |
| 57 | AC_SUBST([NIX_PREFIX]) |
| 58 | ;; |
| 59 | esac], |
| 60 | []) |
| 61 | |
| 62 | AC_PATH_PROG([NIX_INSTANTIATE], [nix-instantiate]) |
| 63 | AC_PATH_PROG([NIX_HASH], [nix-hash]) |
| 64 | if test "x$guix_build_daemon$NIX_INSTANTIATE$NIX_HASH" = "xno"; then |
| 65 | AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.]) |
| 66 | fi |
| 67 | |
| 68 | if test "x$NIX_INSTANTIATE" = "x"; then |
| 69 | # This program is an optional dependency, so we just want it to be |
| 70 | # taken from $PATH if it's not available right now. |
| 71 | NIX_INSTANTIATE="nix-instantiate" |
| 72 | fi |
| 73 | |
| 74 | AC_ARG_WITH([nixpkgs], |
| 75 | [AS_HELP_STRING([--with-nixpkgs=DIR], [search for Nixpkgs in DIR])], |
| 76 | [case "$withval" in |
| 77 | yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);; |
| 78 | *) NIXPKGS="$withval";; |
| 79 | esac], |
| 80 | []) |
| 81 | |
| 82 | AC_MSG_CHECKING([for Nixpkgs source tree]) |
| 83 | if test -f "$NIXPKGS/default.nix"; then |
| 84 | AC_MSG_RESULT([$NIXPKGS]) |
| 85 | AC_SUBST([NIXPKGS]) |
| 86 | else |
| 87 | AC_MSG_RESULT([not found]) |
| 88 | fi |
| 89 | |
| 90 | AC_ARG_WITH([libgcrypt-prefix], |
| 91 | [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])], |
| 92 | [case "$withval" in |
| 93 | yes|no) |
| 94 | LIBGCRYPT="libgcrypt" |
| 95 | LIBGCRYPT_PREFIX="no" |
| 96 | ;; |
| 97 | *) |
| 98 | LIBGCRYPT="$withval/lib/libgcrypt" |
| 99 | LIBGCRYPT_PREFIX="$withval" |
| 100 | ;; |
| 101 | esac], |
| 102 | [LIBGCRYPT="libgcrypt"]) |
| 103 | |
| 104 | dnl Library name suitable for `dynamic-link'. |
| 105 | AC_MSG_CHECKING([for libgcrypt shared library name]) |
| 106 | AC_MSG_RESULT([$LIBGCRYPT]) |
| 107 | AC_SUBST([LIBGCRYPT]) |
| 108 | AC_SUBST([LIBGCRYPT_PREFIX]) |
| 109 | |
| 110 | GUIX_ASSERT_LIBGCRYPT_USABLE |
| 111 | |
| 112 | AC_CACHE_SAVE |
| 113 | |
| 114 | m4_include([config-daemon.ac]) |
| 115 | |
| 116 | AC_CONFIG_FILES([Makefile |
| 117 | po/Makefile.in |
| 118 | guix/config.scm]) |
| 119 | |
| 120 | AC_CONFIG_FILES([guix-build |
| 121 | guix-download |
| 122 | guix-import |
| 123 | guix-package |
| 124 | guix-gc |
| 125 | pre-inst-env |
| 126 | test-env], |
| 127 | [chmod +x guix-build guix-download guix-import guix-package guix-gc \ |
| 128 | pre-inst-env test-env]) |
| 129 | |
| 130 | AC_OUTPUT |