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.
 
 
 
 
 
 

142 lines
4.4 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])
  61. dnl lutimes and lchown: used when canonicalizing store items.
  62. dnl posix_fallocate: used when extracting archives.
  63. dnl vfork: to speed up spawning of helper programs.
  64. dnl sched_setaffinity: to improve RPC locality.
  65. dnl statvfs: to detect disk-full conditions.
  66. dnl strsignal: for error reporting.
  67. AC_CHECK_FUNCS([lutimes lchown posix_fallocate vfork sched_setaffinity \
  68. statvfs nanosleep strsignal])
  69. dnl Check whether the store optimiser can optimise symlinks.
  70. AC_MSG_CHECKING([whether it is possible to create a link to a symlink])
  71. ln -s bla tmp_link
  72. if ln tmp_link tmp_link2 2> /dev/null; then
  73. AC_MSG_RESULT(yes)
  74. AC_DEFINE(CAN_LINK_SYMLINK, 1, [Whether link() works on symlinks.])
  75. else
  76. AC_MSG_RESULT(no)
  77. fi
  78. rm -f tmp_link tmp_link2
  79. dnl Check for <locale>.
  80. AC_LANG_PUSH(C++)
  81. AC_CHECK_HEADERS([locale])
  82. AC_LANG_POP(C++)
  83. dnl Check whether we have the `personality' syscall, which allows us
  84. dnl to do i686-linux builds on x86_64-linux machines.
  85. AC_CHECK_HEADERS([sys/personality.h])
  86. dnl Check for <linux/fs.h> (for immutable file support).
  87. AC_CHECK_HEADERS([linux/fs.h])
  88. dnl Check whether the 'offload' build hook can be built (uses
  89. dnl 'restore-file-set', which requires unbuffered custom binary input
  90. dnl ports from Guile >= 2.0.10.)
  91. GUIX_CHECK_UNBUFFERED_CBIP
  92. guix_build_daemon_offload="$ac_cv_guix_cbips_support_setvbuf"
  93. if test "x$guix_build_daemon_offload" = "xyes"; then
  94. AC_DEFINE([HAVE_DAEMON_OFFLOAD_HOOK], [1],
  95. [Define if the daemon's 'offload' build hook is being built.])
  96. fi
  97. dnl Temporary directory used to store the daemon's data.
  98. AC_MSG_CHECKING([for unit test root])
  99. GUIX_TEST_ROOT="`pwd`/test-tmp"
  100. AC_MSG_RESULT([$GUIX_TEST_ROOT])
  101. AC_SUBST([GUIX_TEST_ROOT])
  102. AC_CONFIG_FILES([nix/scripts/list-runtime-roots],
  103. [chmod +x nix/scripts/list-runtime-roots])
  104. AC_CONFIG_FILES([nix/scripts/substitute-binary],
  105. [chmod +x nix/scripts/substitute-binary])
  106. AC_CONFIG_FILES([nix/scripts/guix-authenticate],
  107. [chmod +x nix/scripts/guix-authenticate])
  108. AC_CONFIG_FILES([nix/scripts/offload],
  109. [chmod +x nix/scripts/offload])
  110. fi
  111. AM_CONDITIONAL([BUILD_DAEMON], [test "x$guix_build_daemon" = "xyes"])
  112. AM_CONDITIONAL([BUILD_DAEMON_OFFLOAD], \
  113. [test "x$guix_build_daemon" = "xyes" \
  114. && test "x$guix_build_daemon_offload" = "xyes"])