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.
 
 
 
 
 
 

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