configure.ac 8.3 KB

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