configure.ac 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ([2.69])
  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. GUIX_CHANNEL_METADATA
  22. AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"])
  23. AC_ARG_WITH(store-dir,
  24. AS_HELP_STRING([--with-store-dir=PATH],
  25. [file name of the store (defaults to /gnu/store)]),
  26. [storedir="$withval"],
  27. [storedir="/gnu/store"])
  28. AC_SUBST(storedir)
  29. AC_ARG_WITH([bash-completion-dir],
  30. AS_HELP_STRING([--with-bash-completion-dir=DIR],
  31. [name of the Bash completion directory]),
  32. [bashcompletiondir="$withval"],
  33. [bashcompletiondir='${sysconfdir}/bash_completion.d'])
  34. AC_SUBST([bashcompletiondir])
  35. AC_ARG_WITH([zsh-completion-dir],
  36. AS_HELP_STRING([--with-zsh-completion-dir=DIR],
  37. [name of the Zsh completion directory]),
  38. [zshcompletiondir="$withval"],
  39. [zshcompletiondir='${datadir}/zsh/site-functions'])
  40. AC_SUBST([zshcompletiondir])
  41. AC_ARG_WITH([fish-completion-dir],
  42. AS_HELP_STRING([--with-fish-completion-dir=DIR],
  43. [name of the Fish completion directory]),
  44. [fishcompletiondir="$withval"],
  45. [fishcompletiondir='${datadir}/fish/vendor_completions.d'])
  46. AC_SUBST([fishcompletiondir])
  47. AC_ARG_WITH([selinux-policy-dir],
  48. AS_HELP_STRING([--with-selinux-policy-dir=DIR],
  49. [name of the SELinux policy directory]),
  50. [selinux_policydir="$withval"],
  51. [selinux_policydir='${datadir}/selinux/'])
  52. AC_SUBST([selinux_policydir])
  53. dnl Better be verbose.
  54. AC_MSG_CHECKING([for the store directory])
  55. AC_MSG_RESULT([$storedir])
  56. AC_ARG_ENABLE([daemon],
  57. [AS_HELP_STRING([--disable-daemon], [do not build the Nix daemon (C++)])],
  58. [guix_build_daemon="$enableval"],
  59. [guix_build_daemon="yes"])
  60. # Prepare a version of $localstatedir & co. that does not contain references
  61. # to shell variables.
  62. guix_prefix="`eval echo $prefix | sed -e"s|NONE|/usr/local|g"`"
  63. guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|$guix_prefix|g"`"
  64. guix_sysconfdir="`eval echo $sysconfdir | sed -e "s|NONE|$guix_prefix|g"`"
  65. guix_sbindir="`eval echo $sbindir | sed -e "s|NONE|$guix_prefix|g"`"
  66. AC_SUBST([guix_localstatedir])
  67. AC_SUBST([guix_sysconfdir])
  68. AC_SUBST([guix_sbindir])
  69. GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests])
  70. AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"])
  71. dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.)
  72. dnl Make sure they are available.
  73. m4_pattern_forbid([PKG_CHECK_MODULES])
  74. m4_pattern_forbid([GUILE_MODULE_AVAILABLE])
  75. m4_pattern_forbid([^GUILE_P])
  76. m4_pattern_allow([^GUILE_PKG_ERRORS])
  77. m4_pattern_forbid([^GUIX_])
  78. dnl Search for 'guile' and 'guild'. This macro defines
  79. dnl 'GUILE_EFFECTIVE_VERSION'.
  80. GUILE_PKG([3.0 2.2])
  81. GUILE_PROGS
  82. if test "x$GUILD" = "x"; then
  83. AC_MSG_ERROR(['guild' binary not found; please check your Guile installation.])
  84. fi
  85. if test "x$GUILE_EFFECTIVE_VERSION" = "x2.2"; then
  86. PKG_CHECK_MODULES([GUILE], [guile-2.2 >= 2.2.6])
  87. fi
  88. dnl Get CFLAGS and LDFLAGS for libguile.
  89. GUILE_FLAGS
  90. dnl Installation directories for .scm and .go files.
  91. guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
  92. guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
  93. AC_SUBST([guilemoduledir])
  94. AC_SUBST([guileobjectdir])
  95. dnl The GnuTLS bindings are necessary for substitutes over HTTPS and for 'guix
  96. dnl pull', among other things.
  97. GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)])
  98. if test "x$have_gnutls" != "xyes"; then
  99. AC_MSG_ERROR([The Guile bindings of GnuTLS are missing; please install them.])
  100. fi
  101. dnl Check for Guile-Git.
  102. GUILE_MODULE_AVAILABLE([have_guile_git], [(git)])
  103. if test "x$have_guile_git" != "xyes"; then
  104. AC_MSG_ERROR([Guile-Git is missing; please install it.])
  105. fi
  106. dnl Check for Guile-JSON.
  107. GUIX_CHECK_GUILE_JSON
  108. if test "x$guix_cv_have_recent_guile_json" != "xyes"; then
  109. AC_MSG_ERROR([Guile-JSON is missing; please install it.])
  110. fi
  111. dnl Guile-Sqlite3 is used by the (guix store ...) modules.
  112. GUIX_CHECK_GUILE_SQLITE3
  113. if test "x$guix_cv_have_recent_guile_sqlite3" != "xyes"; then
  114. AC_MSG_ERROR([A recent Guile-SQLite3 could not be found; please install it.])
  115. fi
  116. GUIX_CHECK_GUILE_GCRYPT
  117. if test "x$guix_cv_have_recent_guile_gcrypt" != "xyes"; then
  118. AC_MSG_ERROR([A recent Guile-Gcrypt could not be found; please install it.])
  119. fi
  120. GUIX_CHECK_GUILE_GIT
  121. if test "x$guix_cv_have_recent_guile_git" != "xyes"; then
  122. AC_MSG_ERROR([A recent Guile-Git could not be found; please install it.])
  123. fi
  124. dnl Check for Guile-zlib.
  125. GUILE_MODULE_AVAILABLE([have_guile_zlib], [(zlib)])
  126. if test "x$have_guile_zlib" != "xyes"; then
  127. AC_MSG_ERROR([Guile-zlib is missing; please install it.])
  128. fi
  129. dnl Check for Guile-lzlib.
  130. GUILE_MODULE_AVAILABLE([have_guile_lzlib], [(lzlib)])
  131. if test "x$have_guile_lzlib" != "xyes"; then
  132. AC_MSG_ERROR([Guile-lzlib is missing; please install it.])
  133. fi
  134. dnl Check for Guile-Avahi.
  135. GUILE_MODULE_AVAILABLE([have_guile_avahi], [(avahi)])
  136. AM_CONDITIONAL([HAVE_GUILE_AVAHI],
  137. [test "x$have_guile_avahi" = "xyes"])
  138. dnl Guile-newt is used by the graphical installer.
  139. GUILE_MODULE_AVAILABLE([have_guile_newt], [(newt)])
  140. AC_ARG_ENABLE([installer],
  141. AS_HELP_STRING([--enable-installer], [Build the graphical installer sources.]))
  142. AS_IF([test "x$enable_installer" = "xyes"], [
  143. if test "x$have_guile_newt" != "xyes"; then
  144. AC_MSG_ERROR([Guile-newt could not be found; please install it.])
  145. fi
  146. ])
  147. AM_CONDITIONAL([ENABLE_INSTALLER],
  148. [test "x$enable_installer" = "xyes"])
  149. dnl Make sure we have a full-fledged Guile.
  150. GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads])
  151. AC_PROG_SED
  152. dnl Decompressors, for use by the substituter and other modules.
  153. AC_PATH_PROG([GZIP], [gzip])
  154. AC_PATH_PROG([BZIP2], [bzip2])
  155. AC_PATH_PROG([XZ], [xz])
  156. AC_SUBST([GZIP])
  157. AC_SUBST([BZIP2])
  158. AC_SUBST([XZ])
  159. AC_ARG_WITH([nixpkgs],
  160. [AS_HELP_STRING([--with-nixpkgs=DIR],
  161. [search for Nixpkgs in DIR (for testing purposes only)])],
  162. [case "$withval" in
  163. yes|no) AC_MSG_ERROR([Please use `--with-nixpkgs=DIR'.]);;
  164. *) NIXPKGS="$withval";;
  165. esac],
  166. [])
  167. AC_MSG_CHECKING([for Nixpkgs source tree])
  168. if test -f "$NIXPKGS/default.nix"; then
  169. AC_MSG_RESULT([$NIXPKGS])
  170. AC_SUBST([NIXPKGS])
  171. else
  172. AC_MSG_RESULT([not found])
  173. fi
  174. LIBGCRYPT_LIBDIR="no"
  175. LIBGCRYPT_PREFIX="no"
  176. AC_ARG_WITH([libgcrypt-prefix],
  177. [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])],
  178. [case "$withval" in
  179. yes|no)
  180. ;;
  181. *)
  182. LIBGCRYPT_PREFIX="$withval"
  183. LIBGCRYPT_LIBDIR="$withval/lib"
  184. ;;
  185. esac])
  186. AC_ARG_WITH([libgcrypt-libdir],
  187. [AS_HELP_STRING([--with-libgcrypt-libdir=DIR],
  188. [search for GNU libgcrypt's shared library in DIR])],
  189. [case "$withval" in
  190. yes|no)
  191. LIBGCRYPT_LIBDIR="no"
  192. ;;
  193. *)
  194. LIBGCRYPT_LIBDIR="$withval"
  195. ;;
  196. esac])
  197. dnl If none of the --with-libgcrypt-* options was used, try to determine the
  198. dnl the library directory.
  199. case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in
  200. xnono)
  201. GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR])
  202. ;;
  203. esac
  204. AC_SUBST([LIBGCRYPT_PREFIX])
  205. AC_SUBST([LIBGCRYPT_LIBDIR])
  206. dnl Check for Guile-SSH, for the (guix ssh) module.
  207. GUIX_CHECK_GUILE_SSH
  208. AM_CONDITIONAL([HAVE_GUILE_SSH],
  209. [test "x$guix_cv_have_recent_guile_ssh" = "xyes"])
  210. AC_CACHE_SAVE
  211. m4_include([config-daemon.ac])
  212. dnl `dot' (from the Graphviz package) is only needed for maintainers.
  213. dnl See `Building from Git' in the manual for more info.
  214. AM_MISSING_PROG([DOT], [dot])
  215. dnl Manual pages.
  216. AM_MISSING_PROG([HELP2MAN], [help2man])
  217. dnl Documentation translation.
  218. AM_MISSING_PROG([PO4A_TRANSLATE], [po4a-translate])
  219. AM_MISSING_PROG([PO4A_UPDATEPO], [po4a-updatepo])
  220. case "$storedir" in
  221. /gnu/store)
  222. ;;
  223. *)
  224. AC_MSG_WARN([Using a store directory other than '/gnu/store' will prevent you])
  225. AC_MSG_WARN([from downloading substitutes from gnu.org.])
  226. ;;
  227. esac
  228. AC_CONFIG_FILES([Makefile
  229. po/guix/Makefile.in
  230. po/packages/Makefile.in
  231. etc/guix-daemon.cil
  232. guix/config.scm])
  233. AC_CONFIG_FILES([etc/committer.scm], [chmod +x etc/committer.scm])
  234. AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
  235. AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
  236. [chmod +x pre-inst-env])
  237. AC_OUTPUT