25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

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