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.
 
 
 
 
 
 

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