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.
 
 
 
 
 
 

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