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.
 
 
 
 
 
 

265 lines
7.7 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'. This macro defines
  61. dnl 'GUILE_EFFECTIVE_VERSION'.
  62. GUILE_PKG([2.2 2.0])
  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. fi
  70. dnl Installation directory for .scm and .go files.
  71. guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
  72. AC_SUBST([guilemoduledir])
  73. dnl The GnuTLS bindings are necessary for substitutes over HTTPS and for 'guix
  74. dnl pull', among other things.
  75. GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)])
  76. if test "x$have_gnutls" != "xyes"; then
  77. AC_MSG_ERROR([The Guile bindings of GnuTLS are missing; please install them.])
  78. fi
  79. dnl Guile-JSON is used in various places.
  80. GUILE_MODULE_AVAILABLE([have_guile_json], [(json)])
  81. AM_CONDITIONAL([HAVE_GUILE_JSON], [test "x$have_guile_json" = "xyes"])
  82. dnl Make sure we have a full-fledged Guile.
  83. GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
  84. dnl Check whether (srfi srfi-37) works, and provide our own if it doesn't.
  85. GUIX_CHECK_SRFI_37
  86. AM_CONDITIONAL([INSTALL_SRFI_37], [test "x$ac_cv_guix_srfi_37_broken" = xyes])
  87. dnl Decompressors, for use by the substituter and other modules.
  88. AC_PATH_PROG([GZIP], [gzip])
  89. AC_PATH_PROG([BZIP2], [bzip2])
  90. AC_PATH_PROG([XZ], [xz])
  91. AC_SUBST([GZIP])
  92. AC_SUBST([BZIP2])
  93. AC_SUBST([XZ])
  94. AC_ARG_WITH([nix-prefix],
  95. [AS_HELP_STRING([--with-nix-prefix=DIR],
  96. [search for Nix in DIR (for testing purposes and '--disable-daemon' builds)])],
  97. [case "$withval" in
  98. yes|no) ;;
  99. *)
  100. NIX_PREFIX="$withval"
  101. PATH="$NIX_PREFIX/bin:$PATH"; export PATH
  102. AC_SUBST([NIX_PREFIX])
  103. ;;
  104. esac],
  105. [])
  106. AC_PATH_PROG([NIX_INSTANTIATE], [nix-instantiate])
  107. AC_PATH_PROG([NIX_HASH], [nix-hash])
  108. if test "x$guix_build_daemon$NIX_INSTANTIATE$NIX_HASH" = "xno"; then
  109. AC_MSG_ERROR([Nix programs not found; please install Nix or use `--with-nix-prefix'.])
  110. fi
  111. if test "x$NIX_INSTANTIATE" = "x"; then
  112. # This program is an optional dependency, so we just want it to be
  113. # taken from $PATH if it's not available right now.
  114. NIX_INSTANTIATE="nix-instantiate"
  115. fi
  116. AC_ARG_WITH([nixpkgs],
  117. [AS_HELP_STRING([--with-nixpkgs=DIR],
  118. [search for Nixpkgs in DIR (for testing purposes only)])],
  119. [case "$withval" in
  120. yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
  121. *) NIXPKGS="$withval";;
  122. esac],
  123. [])
  124. AC_MSG_CHECKING([for Nixpkgs source tree])
  125. if test -f "$NIXPKGS/default.nix"; then
  126. AC_MSG_RESULT([$NIXPKGS])
  127. AC_SUBST([NIXPKGS])
  128. else
  129. AC_MSG_RESULT([not found])
  130. fi
  131. LIBGCRYPT="libgcrypt"
  132. LIBGCRYPT_LIBDIR="no"
  133. LIBGCRYPT_PREFIX="no"
  134. AC_ARG_WITH([libgcrypt-prefix],
  135. [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
  136. [case "$withval" in
  137. yes|no)
  138. ;;
  139. *)
  140. LIBGCRYPT="$withval/lib/libgcrypt"
  141. LIBGCRYPT_PREFIX="$withval"
  142. LIBGCRYPT_LIBDIR="$withval/lib"
  143. ;;
  144. esac])
  145. AC_ARG_WITH([libgcrypt-libdir],
  146. [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
  147. [search for GNU libgcrypt's shared library in DIR])],
  148. [case "$withval" in
  149. yes|no)
  150. LIBGCRYPT="libgcrypt"
  151. LIBGCRYPT_LIBDIR="no"
  152. ;;
  153. *)
  154. LIBGCRYPT="$withval/libgcrypt"
  155. LIBGCRYPT_LIBDIR="$withval"
  156. ;;
  157. esac])
  158. dnl If none of the --with-libgcrypt-* options was used, try to determine the
  159. dnl absolute file name of libgcrypt.so.
  160. case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
  161. xnono)
  162. GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
  163. if test "x$LIBGCRYPT_LIBDIR" != x; then
  164. LIBGCRYPT="$LIBGCRYPT_LIBDIR/libgcrypt"
  165. else
  166. dnl 'config-daemon.ac' expects "no" in this case.
  167. LIBGCRYPT_LIBDIR="no"
  168. fi
  169. ;;
  170. esac
  171. dnl Library name suitable for `dynamic-link'.
  172. AC_MSG_CHECKING([for libgcrypt shared library name])
  173. AC_MSG_RESULT([$LIBGCRYPT])
  174. AC_SUBST([LIBGCRYPT])
  175. AC_SUBST([LIBGCRYPT_PREFIX])
  176. AC_SUBST([LIBGCRYPT_LIBDIR])
  177. GUIX_ASSERT_LIBGCRYPT_USABLE
  178. dnl Library name of zlib suitable for 'dynamic-link'.
  179. GUIX_LIBZ_LIBDIR([libz_libdir])
  180. if test "x$libz_libdir" = "x"; then
  181. LIBZ="libz"
  182. else
  183. LIBZ="$libz_libdir/libz"
  184. fi
  185. AC_MSG_CHECKING([for zlib's shared library name])
  186. AC_MSG_RESULT([$LIBZ])
  187. AC_SUBST([LIBZ])
  188. dnl Check for Guile-SSH, for the (guix ssh) module.
  189. GUIX_CHECK_GUILE_SSH
  190. AM_CONDITIONAL([HAVE_GUILE_SSH],
  191. [test "x$guix_cv_have_recent_guile_ssh" = "xyes"])
  192. AC_CACHE_SAVE
  193. m4_include([config-daemon.ac])
  194. dnl `dot' (from the Graphviz package) is only needed for maintainers.
  195. dnl See `Building from Git' in the manual for more info.
  196. AM_MISSING_PROG([DOT], [dot])
  197. dnl Manual pages.
  198. AM_MISSING_PROG([HELP2MAN], [help2man])
  199. dnl Emacs (optional), for 'etc/indent-package.el'.
  200. AC_PATH_PROG([EMACS], [emacs], [/usr/bin/emacs])
  201. AC_SUBST([EMACS])
  202. case "$storedir" in
  203. /gnu/store)
  204. ;;
  205. *)
  206. AC_MSG_WARN([Using a store directory other than '/gnu/store' will prevent you])
  207. AC_MSG_WARN([from downloading substitutes from gnu.org.])
  208. ;;
  209. esac
  210. AC_CONFIG_FILES([Makefile
  211. po/guix/Makefile.in
  212. po/packages/Makefile.in
  213. guix/config.scm])
  214. AC_CONFIG_FILES([scripts/guix], [chmod +x scripts/guix])
  215. AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
  216. AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
  217. [chmod +x pre-inst-env])
  218. AC_CONFIG_FILES([etc/indent-code.el], [chmod +x etc/indent-code.el])
  219. AC_OUTPUT