configure.ac 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ(2.69)
  3. dnl Initialization
  4. AC_INIT([GNU Shepherd], [0.8.1], [bug-guix@gnu.org])
  5. AC_CONFIG_SRCDIR([modules/shepherd.scm])
  6. AC_CONFIG_AUX_DIR([build-aux])
  7. dnl We're fine with GNU make constructs, hence '-Wno-portability'.
  8. AM_INIT_AUTOMAKE([1.11 gnu silent-rules -Wall -Wno-portability
  9. std-options color-tests])
  10. dnl Enable silent rules by default.
  11. AM_SILENT_RULES([yes])
  12. AM_GNU_GETTEXT([external])
  13. AM_GNU_GETTEXT_VERSION([0.19])
  14. AC_CANONICAL_HOST
  15. AC_PROG_MKDIR_P
  16. AC_PROG_SED
  17. dnl Check for Guile 2.x+.
  18. m4_pattern_forbid([^GUILE_PKG$])
  19. GUILE_PKG([3.0 2.2 2.0])
  20. dnl Checks for programs.
  21. GUILE_PROGS
  22. if test "x$GUILE_EFFECTIVE_VERSION" = "x2.0"; then
  23. PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.13])
  24. fi
  25. guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
  26. guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
  27. AC_SUBST([guilemoduledir])
  28. AC_SUBST([guileobjectdir])
  29. dnl
  30. dnl Low-level operating system interface.
  31. dnl
  32. AC_PROG_CC
  33. dnl In practice that value is fixed for all platforms in glibc, but better
  34. dnl check it.
  35. AC_MSG_CHECKING([the '_SC_OPEN_MAX' value])
  36. AC_COMPUTE_INT([_SC_OPEN_MAX], [_SC_OPEN_MAX], [#include <unistd.h>])
  37. AC_MSG_RESULT([$_SC_OPEN_MAX])
  38. AC_SUBST([_SC_OPEN_MAX])
  39. AC_MSG_CHECKING([<sys/reboot.h> constants])
  40. AC_COMPUTE_INT([RB_AUTOBOOT], [RB_AUTOBOOT], [#include <sys/reboot.h>])
  41. case "$host_os" in
  42. linux-gnu*)
  43. AC_COMPUTE_INT([RB_HALT_SYSTEM], [RB_HALT_SYSTEM], [#include <sys/reboot.h>])
  44. AC_COMPUTE_INT([RB_ENABLE_CAD], [RB_ENABLE_CAD], [#include <sys/reboot.h>])
  45. AC_COMPUTE_INT([RB_DISABLE_CAD], [RB_DISABLE_CAD], [#include <sys/reboot.h>])
  46. AC_COMPUTE_INT([RB_POWER_OFF], [RB_POWER_OFF], [#include <sys/reboot.h>])
  47. AC_COMPUTE_INT([RB_SW_SUSPEND], [RB_SW_SUSPEND], [#include <sys/reboot.h>])
  48. ;;
  49. gnu*)
  50. # On GNU/Hurd, the Mach-derived reboot.h uses different names, and
  51. # has a different set of features and flags.
  52. AC_COMPUTE_INT([RB_HALT_SYSTEM], [RB_HALT], [#include <sys/reboot.h>])
  53. AC_COMPUTE_INT([RB_POWER_OFF], [RB_HALT], [#include <sys/reboot.h>])
  54. RB_DISABLE_CAD="#f"
  55. ;;
  56. *)
  57. # What is this? GNU/kFreeBSD?
  58. AC_MSG_WARN([not sure how to halt the system on '$host_os'])
  59. AC_COMPUTE_INT([RB_HALT_SYSTEM], [RB_HALT_SYSTEM], [#include <sys/reboot.h>])
  60. AC_COMPUTE_INT([RB_POWER_OFF], [RB_HALT_SYSTEM], [#include <sys/reboot.h>])
  61. RB_DISABLE_CAD="#f"
  62. ;;
  63. esac
  64. AC_SUBST([RB_DISABLE_CAD])
  65. AC_SUBST([RB_AUTOBOOT])
  66. AC_SUBST([RB_HALT_SYSTEM])
  67. AC_SUBST([RB_POWER_OFF])
  68. AC_MSG_RESULT([done])
  69. AC_MSG_CHECKING([<sys/prctl.h> constants])
  70. AC_COMPUTE_INT([PR_SET_CHILD_SUBREAPER], [PR_SET_CHILD_SUBREAPER], [#include <sys/prctl.h>])
  71. AC_SUBST([PR_SET_CHILD_SUBREAPER])
  72. AC_MSG_RESULT([done])
  73. dnl Check the size of 'signalfd_siginfo'. If it's undefined, returns zero.
  74. AC_CHECK_SIZEOF([struct signalfd_siginfo], [], [#include <sys/signalfd.h>])
  75. AC_CHECK_SIZEOF([sigset_t], [], [#include <signal.h>])
  76. AC_MSG_CHECKING([<sys/signalfd.h> and <sys/signal.h> constants])
  77. AC_COMPUTE_INT([SFD_CLOEXEC], [SFD_CLOEXEC], [#include <sys/signalfd.h>])
  78. AC_COMPUTE_INT([SIG_BLOCK], [SIG_BLOCK], [#include <sys/signal.h>])
  79. AC_COMPUTE_INT([SIG_UNBLOCK], [SIG_UNBLOCK], [#include <sys/signal.h>])
  80. AC_COMPUTE_INT([SIG_SETMASK], [SIG_SETMASK], [#include <sys/signal.h>])
  81. AC_MSG_RESULT([done])
  82. SIZEOF_STRUCT_SIGNALFD_SIGINFO="$ac_cv_sizeof_struct_signalfd_siginfo"
  83. SIZEOF_SIGSET_T="$ac_cv_sizeof_sigset_t"
  84. AC_SUBST([SIZEOF_STRUCT_SIGNALFD_SIGINFO])
  85. AC_SUBST([SIZEOF_SIGSET_T])
  86. AC_SUBST([SFD_CLOEXEC])
  87. AC_SUBST([SIG_BLOCK])
  88. AC_SUBST([SIG_UNBLOCK])
  89. AC_SUBST([SIG_SETMASK])
  90. AC_MSG_CHECKING([whether to build crash handler])
  91. case "$host_os" in
  92. linux-gnu*) build_crash_handler=yes;;
  93. *) build_crash_handler=no;;
  94. esac
  95. AC_MSG_RESULT([$build_crash_handler])
  96. AC_MSG_CHECKING([which mechanism to use for detecting the open file descriptors])
  97. case "$host_os" in
  98. linux-gnu*) open_fdes_mechanism=proc;;
  99. gnu*) open_fdes_mechanism=hurd;;
  100. *)
  101. AC_MSG_WARN([not sure how to discover open file descriptors on '$host_os', assuming /proc])
  102. open_fdes_mechanism=proc;;
  103. esac
  104. AC_MSG_RESULT([$open_fdes_mechanism])
  105. AM_CONDITIONAL([BUILD_CRASH_HANDLER], [test "x$build_crash_handler" = "xyes"])
  106. AM_CONDITIONAL([BUILD_OPEN_FDES], [test "$open_fdes_mechanism" = "hurd"])
  107. dnl Manual pages.
  108. AM_MISSING_PROG([HELP2MAN], [help2man])
  109. dnl Finish.
  110. AC_CONFIG_FILES([Makefile po/Makefile.in
  111. modules/shepherd/system.scm])
  112. AC_OUTPUT