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.
 
 
 
 
 
 

161 lines
5.1 KiB

  1. dnl -*- Autoconf -*- fragment for the C++ daemon.
  2. AC_MSG_CHECKING([whether to build daemon])
  3. AC_MSG_RESULT([$guix_build_daemon])
  4. dnl C++ environment. This macro must be used unconditionnaly.
  5. AC_PROG_CXX
  6. AC_LANG([C++])
  7. if test "x$guix_build_daemon" = "xyes"; then
  8. GUIX_ASSERT_CXX11
  9. AC_PROG_RANLIB
  10. AC_CONFIG_HEADER([nix/config.h])
  11. dnl Use 64-bit file system calls so that we can support files > 2 GiB.
  12. AC_SYS_LARGEFILE
  13. dnl Look for libbz2, a required dependency.
  14. AC_CHECK_LIB([bz2], [BZ2_bzWriteOpen], [true],
  15. [AC_MSG_ERROR([Guix requires libbz2, which is part of bzip2. See http://www.bzip.org/.])])
  16. AC_CHECK_HEADERS([bzlib.h], [true],
  17. [AC_MSG_ERROR([Guix requires libbz2, which is part of bzip2. See http://www.bzip.org/.])])
  18. dnl Look for SQLite, a required dependency.
  19. PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.6.19])
  20. AC_DEFINE([NIX_VERSION], ["0.0.0"], [Fake Nix version number.])
  21. AC_DEFINE_UNQUOTED([SYSTEM], ["$guix_system"],
  22. [Guix host system type--i.e., platform and OS kernel tuple.])
  23. case "$LIBGCRYPT_PREFIX" in
  24. no)
  25. LIBGCRYPT_CFLAGS=""
  26. ;;
  27. *)
  28. LIBGCRYPT_CFLAGS="-I$LIBGCRYPT_PREFIX/include"
  29. ;;
  30. esac
  31. case "$LIBGCRYPT_LIBDIR" in
  32. no)
  33. LIBGCRYPT_LIBS="-lgcrypt"
  34. ;;
  35. *)
  36. LIBGCRYPT_LIBS="-L$LIBGCRYPT_LIBDIR -lgcrypt"
  37. ;;
  38. esac
  39. AC_SUBST([LIBGCRYPT_CFLAGS])
  40. AC_SUBST([LIBGCRYPT_LIBS])
  41. save_CFLAGS="$CFLAGS"
  42. save_LDFLAGS="$LDFLAGS"
  43. CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
  44. LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS"
  45. have_gcrypt=yes
  46. AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no])
  47. AC_CHECK_HEADER([gcrypt.h], [:], [have_gcrypt=no])
  48. if test "x$have_gcrypt" != "xyes"; then
  49. AC_MSG_ERROR([GNU libgcrypt not found; please install it.])
  50. fi
  51. CFLAGS="$save_CFLAGS"
  52. LDFLAGS="$save_LDFLAGS"
  53. dnl Chroot support.
  54. AC_CHECK_FUNCS([chroot unshare])
  55. AC_CHECK_HEADERS([sched.h sys/param.h sys/mount.h sys/syscall.h])
  56. if test "x$ac_cv_func_chroot" != "xyes"; then
  57. AC_MSG_ERROR(['chroot' function missing, bailing out])
  58. fi
  59. dnl lutimes and lchown: used when canonicalizing store items.
  60. dnl posix_fallocate: used when extracting archives.
  61. dnl vfork: to speed up spawning of helper programs.
  62. dnl `--> now disabled because of unpredictable behavior:
  63. dnl see <http://lists.gnu.org/archive/html/guix-devel/2014-05/msg00036.html>
  64. dnl and Nix commit f794465c (Nov. 2012).
  65. dnl sched_setaffinity: to improve RPC locality.
  66. dnl statvfs: to detect disk-full conditions.
  67. dnl strsignal: for error reporting.
  68. AC_CHECK_FUNCS([lutimes lchown posix_fallocate sched_setaffinity \
  69. statvfs nanosleep strsignal])
  70. dnl Check whether the store optimiser can optimise symlinks.
  71. AC_MSG_CHECKING([whether it is possible to create a link to a symlink])
  72. ln -s bla tmp_link
  73. if ln tmp_link tmp_link2 2> /dev/null; then
  74. AC_MSG_RESULT(yes)
  75. AC_DEFINE(CAN_LINK_SYMLINK, 1, [Whether link() works on symlinks.])
  76. else
  77. AC_MSG_RESULT(no)
  78. fi
  79. rm -f tmp_link tmp_link2
  80. dnl Check for <locale>.
  81. AC_LANG_PUSH(C++)
  82. AC_CHECK_HEADERS([locale])
  83. AC_LANG_POP(C++)
  84. dnl Check whether we have the `personality' syscall, which allows us
  85. dnl to do i686-linux builds on x86_64-linux machines.
  86. AC_CHECK_HEADERS([sys/personality.h])
  87. dnl Check for <linux/fs.h> (for immutable file support).
  88. AC_CHECK_HEADERS([linux/fs.h])
  89. dnl Determine the appropriate default list of substitute URLs.
  90. GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)])
  91. if test "x$have_gnutls" = "xyes"; then
  92. guix_substitute_urls="https://mirror.hydra.gnu.org"
  93. else
  94. AC_MSG_WARN([GnuTLS is missing, substitutes will be downloaded in the clear])
  95. guix_substitute_urls="http://mirror.hydra.gnu.org"
  96. fi
  97. AC_MSG_CHECKING([for default substitute URLs])
  98. AC_MSG_RESULT([$guix_substitute_urls])
  99. AC_DEFINE_UNQUOTED([GUIX_SUBSTITUTE_URLS], ["$guix_substitute_urls"],
  100. [Default list of substitute URLs used by 'guix-daemon'.])
  101. dnl Check whether the 'offload' build hook can be built (uses
  102. dnl 'restore-file-set', which requires unbuffered custom binary input
  103. dnl ports from Guile >= 2.0.10.)
  104. GUIX_CHECK_UNBUFFERED_CBIP
  105. guix_build_daemon_offload="$ac_cv_guix_cbips_support_setvbuf"
  106. if test "x$guix_build_daemon_offload" = "xyes"; then
  107. AC_DEFINE([HAVE_DAEMON_OFFLOAD_HOOK], [1],
  108. [Define if the daemon's 'offload' build hook is being built.])
  109. fi
  110. dnl Temporary directory used to store the daemon's data.
  111. GUIX_TEST_ROOT_DIRECTORY
  112. GUIX_TEST_ROOT="$ac_cv_guix_test_root"
  113. AC_SUBST([GUIX_TEST_ROOT])
  114. GUIX_CHECK_LOCALSTATEDIR
  115. AC_CONFIG_FILES([nix/scripts/list-runtime-roots],
  116. [chmod +x nix/scripts/list-runtime-roots])
  117. AC_CONFIG_FILES([nix/scripts/download],
  118. [chmod +x nix/scripts/download])
  119. AC_CONFIG_FILES([nix/scripts/substitute],
  120. [chmod +x nix/scripts/substitute])
  121. AC_CONFIG_FILES([nix/scripts/guix-authenticate],
  122. [chmod +x nix/scripts/guix-authenticate])
  123. AC_CONFIG_FILES([nix/scripts/offload],
  124. [chmod +x nix/scripts/offload])
  125. fi
  126. AM_CONDITIONAL([BUILD_DAEMON], [test "x$guix_build_daemon" = "xyes"])
  127. AM_CONDITIONAL([BUILD_DAEMON_OFFLOAD], \
  128. [test "x$guix_build_daemon" = "xyes" \
  129. && test "x$guix_build_daemon_offload" = "xyes"])