config-daemon.ac 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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_HEADERS([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_UNQUOTED([SYSTEM], ["$guix_system"],
  28. [Guix host system type--i.e., platform and OS kernel tuple.])
  29. case "$LIBGCRYPT_PREFIX" in
  30. no)
  31. LIBGCRYPT_CFLAGS=""
  32. ;;
  33. *)
  34. LIBGCRYPT_CFLAGS="-I$LIBGCRYPT_PREFIX/include"
  35. ;;
  36. esac
  37. case "$LIBGCRYPT_LIBDIR" in
  38. no | "")
  39. LIBGCRYPT_LIBS="-lgcrypt"
  40. ;;
  41. *)
  42. LIBGCRYPT_LIBS="-L$LIBGCRYPT_LIBDIR -lgcrypt"
  43. ;;
  44. esac
  45. AC_SUBST([LIBGCRYPT_CFLAGS])
  46. AC_SUBST([LIBGCRYPT_LIBS])
  47. save_CFLAGS="$CFLAGS"
  48. save_LDFLAGS="$LDFLAGS"
  49. CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
  50. LDFLAGS="$LDFLAGS $LIBGCRYPT_LDFLAGS"
  51. have_gcrypt=yes
  52. AC_CHECK_LIB([gcrypt], [gcry_md_open], [:], [have_gcrypt=no])
  53. AC_CHECK_HEADER([gcrypt.h], [:], [have_gcrypt=no])
  54. if test "x$have_gcrypt" != "xyes"; then
  55. AC_MSG_ERROR([GNU libgcrypt not found; please install it.])
  56. fi
  57. CFLAGS="$save_CFLAGS"
  58. LDFLAGS="$save_LDFLAGS"
  59. dnl Chroot support.
  60. AC_CHECK_FUNCS([chroot unshare])
  61. AC_CHECK_HEADERS([sched.h sys/param.h sys/mount.h sys/syscall.h])
  62. if test "x$ac_cv_func_chroot" != "xyes"; then
  63. AC_MSG_ERROR(['chroot' function missing, bailing out])
  64. fi
  65. dnl lutimes and lchown: used when canonicalizing store items.
  66. dnl posix_fallocate: used when extracting archives.
  67. dnl vfork: to speed up spawning of helper programs.
  68. dnl `--> now disabled because of unpredictable behavior:
  69. dnl see <http://lists.gnu.org/archive/html/guix-devel/2014-05/msg00036.html>
  70. dnl and Nix commit f794465c (Nov. 2012).
  71. dnl sched_setaffinity: to improve RPC locality.
  72. dnl statvfs: to detect disk-full conditions.
  73. dnl strsignal: for error reporting.
  74. dnl statx: fine-grain 'stat' call, new in glibc 2.28.
  75. AC_CHECK_FUNCS([lutimes lchown posix_fallocate sched_setaffinity \
  76. statvfs nanosleep strsignal statx])
  77. dnl Check for <locale>.
  78. AC_LANG_PUSH(C++)
  79. AC_CHECK_HEADERS([locale])
  80. AC_LANG_POP(C++)
  81. dnl Check whether we have the `personality' syscall, which allows us
  82. dnl to do i686-linux builds on x86_64-linux machines.
  83. AC_CHECK_HEADERS([sys/personality.h])
  84. dnl Determine the appropriate default list of substitute URLs (GnuTLS
  85. dnl is required so we can default to 'https'.)
  86. guix_substitute_urls="https://ci.guix.gnu.org https://bordeaux.guix.gnu.org"
  87. AC_MSG_CHECKING([for default substitute URLs])
  88. AC_MSG_RESULT([$guix_substitute_urls])
  89. AC_DEFINE_UNQUOTED([GUIX_SUBSTITUTE_URLS], ["$guix_substitute_urls"],
  90. [Default list of substitute URLs used by 'guix-daemon'.])
  91. dnl Check for Guile-SSH, which is required by 'guix offload'.
  92. GUIX_CHECK_GUILE_SSH
  93. case "x$guix_cv_have_recent_guile_ssh" in
  94. xyes)
  95. guix_build_daemon_offload="yes"
  96. AC_DEFINE([HAVE_DAEMON_OFFLOAD_HOOK], [1],
  97. [Define if the daemon's 'offload' build hook is being built (requires Guile-SSH).])
  98. ;;
  99. *)
  100. guix_build_daemon_offload="no"
  101. ;;
  102. esac
  103. dnl Temporary directory used to store the daemon's data.
  104. GUIX_TEST_ROOT_DIRECTORY
  105. GUIX_TEST_ROOT="$ac_cv_guix_test_root"
  106. AC_SUBST([GUIX_TEST_ROOT])
  107. GUIX_CHECK_LOCALSTATEDIR
  108. fi
  109. AM_CONDITIONAL([HAVE_LIBBZ2], [test "x$HAVE_LIBBZ2" = "xyes"])
  110. AM_CONDITIONAL([BUILD_DAEMON], [test "x$guix_build_daemon" = "xyes"])
  111. AM_CONDITIONAL([BUILD_DAEMON_OFFLOAD], \
  112. [test "x$guix_build_daemon" = "xyes" \
  113. && test "x$guix_build_daemon_offload" = "xyes"])