You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

251 lines
7.3 KiB

  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ(2.68)
  4. AC_INIT([GNU Guix], [0.12.0], [bug-guix@gnu.org], [guix],
  5. [http://www.gnu.org/software/guix/])
  6. AC_CONFIG_AUX_DIR([build-aux])
  7. AM_INIT_AUTOMAKE([1.12 gnu silent-rules subdir-objects \
  8. color-tests parallel-tests -Woverride -Wno-portability])
  9. # Enable silent rules by default.
  10. AM_SILENT_RULES([yes])
  11. AC_CONFIG_SRCDIR([guix.scm])
  12. AC_CONFIG_MACRO_DIR([m4])
  13. dnl For the C++ code. This must be used early.
  14. AC_USE_SYSTEM_EXTENSIONS
  15. AM_GNU_GETTEXT([external])
  16. AM_GNU_GETTEXT_VERSION([0.18.1])
  17. GUIX_SYSTEM_TYPE
  18. GUIX_ASSERT_SUPPORTED_SYSTEM
  19. AC_ARG_WITH(store-dir,
  20. AC_HELP_STRING([--with-store-dir=PATH],
  21. [file name of the store (defaults to /gnu/store)]),
  22. [storedir="$withval"],
  23. [storedir="/gnu/store"])
  24. AC_SUBST(storedir)
  25. AC_ARG_WITH([bash-completion-dir],
  26. AC_HELP_STRING([--with-bash-completion-dir=DIR],
  27. [name of the Bash completion directory]),
  28. [bashcompletiondir="$withval"],
  29. [bashcompletiondir='${sysconfdir}/bash_completion.d'])
  30. AC_SUBST([bashcompletiondir])
  31. AC_ARG_WITH([zsh-completion-dir],
  32. AC_HELP_STRING([--with-zsh-completion-dir=DIR],
  33. [name of the Zsh completion directory]),
  34. [zshcompletiondir="$withval"],
  35. [zshcompletiondir='${datadir}/zsh/site-functions'])
  36. AC_SUBST([zshcompletiondir])
  37. dnl Better be verbose.
  38. AC_MSG_CHECKING([for the store directory])
  39. AC_MSG_RESULT([$storedir])
  40. AC_ARG_ENABLE([daemon],
  41. [AS_HELP_STRING([--disable-daemon], [build the Nix daemon (C++)])],
  42. [guix_build_daemon="$enableval"],
  43. [guix_build_daemon="yes"])
  44. # Prepare a version of $localstatedir & co. that does not contain references
  45. # to shell variables.
  46. guix_prefix="`eval echo $prefix | sed -e"s|NONE|/usr/local|g"`"
  47. guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|$guix_prefix|g"`"
  48. guix_sysconfdir="`eval echo $sysconfdir | sed -e "s|NONE|$guix_prefix|g"`"
  49. guix_sbindir="`eval echo $sbindir | sed -e "s|NONE|$guix_prefix|g"`"
  50. AC_SUBST([guix_localstatedir])
  51. AC_SUBST([guix_sysconfdir])
  52. AC_SUBST([guix_sbindir])
  53. GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests])
  54. AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"])
  55. dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.)
  56. dnl Make sure they are available.
  57. m4_pattern_forbid([PKG_CHECK_MODULES])
  58. m4_pattern_forbid([GUILE_MODULE_AVAILABLE])
  59. m4_pattern_forbid([^GUILE_P$])
  60. dnl Search for 'guile' and 'guild'. Prefer 2.0 until the 2.2 upgrade is
  61. dnl complete. This macro defines 'GUILE_EFFECTIVE_VERSION'.
  62. GUILE_PKG([2.0 2.2])
  63. GUILE_PROGS
  64. if test "x$GUILD" = "x"; then
  65. AC_MSG_ERROR(['guild' binary not found; please check your guile-2.x installation.])
  66. fi
  67. if test "x$GUILE_EFFECTIVE_VERSION" = "x2.0"; then
  68. PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.7])
  69. else
  70. AC_MSG_WARN([Guile $GUILE_EFFECTIVE_VERSION is not fully supported!])
  71. fi
  72. dnl Installation directory for .scm and .go files.
  73. guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
  74. AC_SUBST([guilemoduledir])
  75. dnl guile-json is used for the PyPI package importer
  76. GUILE_MODULE_AVAILABLE([have_guile_json], [(json)])
  77. AM_CONDITIONAL([HAVE_GUILE_JSON], [test "x$have_guile_json" = "xyes"])
  78. dnl Make sure we have a full-fledged Guile.
  79. GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
  80. dnl Check whether (srfi srfi-37) works, and provide our own if it doesn't.
  81. GUIX_CHECK_SRFI_37
  82. AM_CONDITIONAL([INSTALL_SRFI_37], [test "x$ac_cv_guix_srfi_37_broken" = xyes])
  83. dnl Decompressors, for use by the substituter and other modules.
  84. AC_PATH_PROG([GZIP], [gzip])
  85. AC_PATH_PROG([BZIP2], [bzip2])
  86. AC_PATH_PROG([XZ], [xz])
  87. AC_SUBST([GZIP])
  88. AC_SUBST([BZIP2])
  89. AC_SUBST([XZ])
  90. AC_ARG_WITH([nix-prefix],
  91. [AS_HELP_STRING([--with-nix-prefix=DIR],
  92. [search for Nix in DIR (for testing purposes and '--disable-daemon' builds)])],
  93. [case "$withval" in
  94. yes|no) ;;
  95. *)
  96. NIX_PREFIX="$withval"
  97. PATH="$NIX_PREFIX/bin:$PATH"; export PATH
  98. AC_SUBST([NIX_PREFIX])
  99. ;;
  100. esac],
  101. [])
  102. AC_PATH_PROG([NIX_INSTANTIATE], [nix-instantiate])
  103. AC_PATH_PROG([NIX_HASH], [nix-hash])
  104. if test "x$guix_build_daemon$NIX_INSTANTIATE$NIX_HASH" = "xno"; then
  105. AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.])
  106. fi
  107. if test "x$NIX_INSTANTIATE" = "x"; then
  108. # This program is an optional dependency, so we just want it to be
  109. # taken from $PATH if it's not available right now.
  110. NIX_INSTANTIATE="nix-instantiate"
  111. fi
  112. AC_ARG_WITH([nixpkgs],
  113. [AS_HELP_STRING([--with-nixpkgs=DIR],
  114. [search for Nixpkgs in DIR (for testing purposes only)])],
  115. [case "$withval" in
  116. yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
  117. *) NIXPKGS="$withval";;
  118. esac],
  119. [])
  120. AC_MSG_CHECKING([for Nixpkgs source tree])
  121. if test -f "$NIXPKGS/default.nix"; then
  122. AC_MSG_RESULT([$NIXPKGS])
  123. AC_SUBST([NIXPKGS])
  124. else
  125. AC_MSG_RESULT([not found])
  126. fi
  127. LIBGCRYPT="libgcrypt"
  128. LIBGCRYPT_LIBDIR="no"
  129. LIBGCRYPT_PREFIX="no"
  130. AC_ARG_WITH([libgcrypt-prefix],
  131. [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
  132. [case "$withval" in
  133. yes|no)
  134. ;;
  135. *)
  136. LIBGCRYPT="$withval/lib/libgcrypt"
  137. LIBGCRYPT_PREFIX="$withval"
  138. LIBGCRYPT_LIBDIR="$withval/lib"
  139. ;;
  140. esac])
  141. AC_ARG_WITH([libgcrypt-libdir],
  142. [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
  143. [search for GNU libgcrypt's shared library in DIR])],
  144. [case "$withval" in
  145. yes|no)
  146. LIBGCRYPT="libgcrypt"
  147. LIBGCRYPT_LIBDIR="no"
  148. ;;
  149. *)
  150. LIBGCRYPT="$withval/libgcrypt"
  151. LIBGCRYPT_LIBDIR="$withval"
  152. ;;
  153. esac])
  154. dnl If none of the --with-libgcrypt-* options was used, try to determine the
  155. dnl absolute file name of libgcrypt.so.
  156. case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
  157. xnono)
  158. GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
  159. if test "x$LIBGCRYPT_LIBDIR" != x; then
  160. LIBGCRYPT="$LIBGCRYPT_LIBDIR/libgcrypt"
  161. else
  162. dnl 'config-daemon.ac' expects "no" in this case.
  163. LIBGCRYPT_LIBDIR="no"
  164. fi
  165. ;;
  166. esac
  167. dnl Library name suitable for `dynamic-link'.
  168. AC_MSG_CHECKING([for libgcrypt shared library name])
  169. AC_MSG_RESULT([$LIBGCRYPT])
  170. AC_SUBST([LIBGCRYPT])
  171. AC_SUBST([LIBGCRYPT_PREFIX])
  172. AC_SUBST([LIBGCRYPT_LIBDIR])
  173. GUIX_ASSERT_LIBGCRYPT_USABLE
  174. dnl Library name of zlib suitable for 'dynamic-link'.
  175. GUIX_LIBZ_LIBDIR([libz_libdir])
  176. if test "x$libz_libdir" = "x"; then
  177. LIBZ="libz"
  178. else
  179. LIBZ="$libz_libdir/libz"
  180. fi
  181. AC_MSG_CHECKING([for zlib's shared library name])
  182. AC_MSG_RESULT([$LIBZ])
  183. AC_SUBST([LIBZ])
  184. dnl Check for Guile-SSH, for the (guix ssh) module.
  185. GUIX_CHECK_GUILE_SSH
  186. AM_CONDITIONAL([HAVE_GUILE_SSH],
  187. [test "x$guix_cv_have_recent_guile_ssh" = "xyes"])
  188. AC_CACHE_SAVE
  189. m4_include([config-daemon.ac])
  190. dnl `dot' (from the Graphviz package) is only needed for maintainers.
  191. dnl See `Building from Git' in the manual for more info.
  192. AM_MISSING_PROG([DOT], [dot])
  193. dnl Manual pages.
  194. AM_MISSING_PROG([HELP2MAN], [help2man])
  195. dnl Emacs (optional), for 'etc/indent-package.el'.
  196. AC_PATH_PROG([EMACS], [emacs], [/usr/bin/emacs])
  197. AC_SUBST([EMACS])
  198. AC_CONFIG_FILES([Makefile
  199. po/guix/Makefile.in
  200. po/packages/Makefile.in
  201. guix/config.scm])
  202. AC_CONFIG_FILES([scripts/guix], [chmod +x scripts/guix])
  203. AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
  204. AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
  205. [chmod +x pre-inst-env])
  206. AC_CONFIG_FILES([etc/indent-code.el], [chmod +x etc/indent-code.el])
  207. AC_OUTPUT