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.
 
 
 
 
 
 

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