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.
 
 
 
 
 
 

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