1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
|
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.69)
dnl Initialization
AC_INIT([GNU Shepherd], [1.0.9],
[https://codeberg.org/shepherd/shepherd/issues],
[shepherd], [https://shepherding.services])
AC_CONFIG_SRCDIR([modules/shepherd.scm])
AC_CONFIG_AUX_DIR([build-aux])
dnl We're fine with GNU make constructs, hence '-Wno-portability'.
AM_INIT_AUTOMAKE([1.11 gnu silent-rules -Wall -Wno-portability
std-options color-tests])
dnl Enable silent rules by default.
AM_SILENT_RULES([yes])
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19])
AC_CANONICAL_HOST
AC_PROG_MKDIR_P
AC_PROG_SED
dnl Compression programs.
AC_ARG_WITH([gzip],
AS_HELP_STRING([--with-gzip=PROGRAM],
[gzip program to use for log file compression]),
[GZIP="$withval"])
if test -z "$GZIP"; then
AC_PATH_PROG([GZIP], [gzip], [gzip])
else
AC_MSG_CHECKING([for gzip])
AC_MSG_RESULT([$GZIP])
fi
AC_SUBST([GZIP])
AC_ARG_WITH([zstd],
AS_HELP_STRING([--with-zstd=PROGRAM],
[zstd program to use for log file compression]),
[ZSTD="$withval"])
if test -z "$ZSTD"; then
AC_PATH_PROG([ZSTD], [zstd], [zstd])
else
AC_MSG_CHECKING([for zstd])
AC_MSG_RESULT([$ZSTD])
fi
AC_SUBST([ZSTD])
dnl The 'timeout' program, introduced in GNU Coreutils 7.0 (2008).
AC_PATH_PROG([TIMEOUT], [timeout], [not-found])
AM_CONDITIONAL([HAVE_TIMEOUT], [test "x$TIMEOUT" != "xnot-found"])
AC_SUBST([TIMEOUT])
dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.)
dnl Make sure they are available.
m4_pattern_forbid([PKG_CHECK_MODULES])
m4_pattern_forbid([GUILE_MODULE_AVAILABLE])
m4_pattern_forbid([GUILE_PKG$])
dnl Check for Guile.
GUILE_PKG([3.0])
dnl Checks for programs.
GUILE_PROGS
dnl The system log uses 'bytevector-slice', which appeared in 3.0.9.
PKG_CHECK_MODULES([GUILE], [guile-3.0 >= 3.0.9])
guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
AC_SUBST([guilemoduledir])
AC_SUBST([guileobjectdir])
dnl Check for extra dependencies.
GUILE_MODULE_AVAILABLE([have_fibers], [(fibers)])
if test "x$have_fibers" != "xyes"; then
AC_MSG_ERROR([Fibers is missing; please install it.])
fi
GUILE_MODULE_AVAILABLE([have_recent_fibers], [(fibers scheduler)])
if test "x$have_recent_fibers" != "xyes"; then
AC_MSG_ERROR([Fibers appears to be too old; please install version 1.1.0 or later.])
fi
dnl Make sure Fibers does not create POSIX threads: since shepherd
dnl forks, it must be single-threaded.
AC_CACHE_CHECK([whether Fibers might create POSIX threads],
[ac_cv_fibers_creates_pthreads],
[GUILE_CHECK([retval],
[(use-modules (fibers))
(set! (@ (ice-9 threads) call-with-new-thread)
(lambda _ (throw 'new-thread!)))
(run-fibers (lambda () (spawn-fiber (lambda () 1)))
#:parallelism 1 #:hz 0)])
if test "$retval" = 0; then
ac_cv_fibers_creates_pthreads="no"
else
ac_cv_fibers_creates_pthreads="yes"
fi])
if test "x$ac_cv_fibers_creates_pthreads" = "xyes"; then
AC_MSG_ERROR([Fibers creates POSIX threads behind our back; aborting.])
fi
dnl Capture the location of Fibers' modules.
FIBERS_SOURCE_DIRECTORY="`\
"$GUILE" -c '(display (dirname (search-path %load-path "fibers.scm")))'`"
FIBERS_OBJECT_DIRECTORY="`\
"$GUILE" -c '(display (dirname (search-path %load-compiled-path "fibers.go")))'`"
AC_SUBST([FIBERS_SOURCE_DIRECTORY])
AC_SUBST([FIBERS_OBJECT_DIRECTORY])
dnl
dnl Low-level operating system interface.
dnl
AC_PROG_CC
dnl In practice that value is fixed for all platforms in glibc, but better
dnl check it.
AC_MSG_CHECKING([the '_SC_OPEN_MAX' value])
AC_COMPUTE_INT([_SC_OPEN_MAX], [_SC_OPEN_MAX], [#include <unistd.h>])
AC_MSG_RESULT([$_SC_OPEN_MAX])
AC_SUBST([_SC_OPEN_MAX])
AC_MSG_CHECKING([<sys/reboot.h> constants])
AC_COMPUTE_INT([RB_AUTOBOOT], [RB_AUTOBOOT], [#include <sys/reboot.h>])
case "$host_os" in
linux-gnu*)
AC_COMPUTE_INT([RB_HALT_SYSTEM], [RB_HALT_SYSTEM], [#include <sys/reboot.h>])
AC_COMPUTE_INT([RB_ENABLE_CAD], [RB_ENABLE_CAD], [#include <sys/reboot.h>])
AC_COMPUTE_INT([RB_DISABLE_CAD], [RB_DISABLE_CAD], [#include <sys/reboot.h>])
AC_COMPUTE_INT([RB_POWER_OFF], [RB_POWER_OFF], [#include <sys/reboot.h>])
AC_COMPUTE_INT([RB_SW_SUSPEND], [RB_SW_SUSPEND], [#include <sys/reboot.h>])
AC_COMPUTE_INT([RB_KEXEC], [RB_KEXEC], [#include <sys/reboot.h>])
;;
gnu*)
# On GNU/Hurd, the Mach-derived reboot.h uses different names, and
# has a different set of features and flags.
AC_COMPUTE_INT([RB_HALT_SYSTEM], [RB_HALT], [#include <sys/reboot.h>])
AC_COMPUTE_INT([RB_POWER_OFF], [RB_HALT], [#include <sys/reboot.h>])
RB_DISABLE_CAD="#f"
RB_KEXEC="#f"
;;
*)
# What is this? GNU/kFreeBSD?
AC_MSG_WARN([not sure how to halt the system on '$host_os'])
AC_COMPUTE_INT([RB_HALT_SYSTEM], [RB_HALT], [#include <sys/reboot.h>])
AC_COMPUTE_INT([RB_POWER_OFF], [RB_POWEROFF], [#include <sys/reboot.h>])
if test -z "$RB_POWER_OFF"; then
AC_COMPUTE_INT([RB_POWER_OFF], [RB_HALT], [#include <sys/reboot.h>])
fi
RB_DISABLE_CAD="#f"
RB_KEXEC="#f"
;;
esac
AC_SUBST([RB_DISABLE_CAD])
AC_SUBST([RB_AUTOBOOT])
AC_SUBST([RB_HALT_SYSTEM])
AC_SUBST([RB_POWER_OFF])
AC_SUBST([RB_KEXEC])
AC_MSG_RESULT([done])
AC_MSG_CHECKING([<sys/prctl.h> constants])
AC_COMPUTE_INT([PR_SET_CHILD_SUBREAPER], [PR_SET_CHILD_SUBREAPER], [#include <sys/prctl.h>])
AC_SUBST([PR_SET_CHILD_SUBREAPER])
AC_MSG_RESULT([done])
dnl Check the size of 'signalfd_siginfo'. If it's undefined, returns zero.
AC_CHECK_SIZEOF([struct signalfd_siginfo], [], [#include <sys/signalfd.h>])
AC_CHECK_SIZEOF([sigset_t], [], [#include <signal.h>])
AC_MSG_CHECKING([<sys/signalfd.h> and <sys/signal.h> constants])
AC_COMPUTE_INT([SFD_CLOEXEC], [SFD_CLOEXEC], [#include <sys/signalfd.h>])
AC_COMPUTE_INT([SFD_NONBLOCK], [SFD_NONBLOCK], [#include <sys/signalfd.h>])
AC_COMPUTE_INT([SIG_BLOCK], [SIG_BLOCK], [#include <sys/signal.h>])
AC_COMPUTE_INT([SIG_UNBLOCK], [SIG_UNBLOCK], [#include <sys/signal.h>])
AC_COMPUTE_INT([SIG_SETMASK], [SIG_SETMASK], [#include <sys/signal.h>])
AC_MSG_RESULT([done])
dnl These constants are undefined on non-Linux systems; set them to zero
dnl instead of the empty string.
if test -z "$SFD_CLOEXEC"; then
SFD_CLOEXEC=0
fi
if test -z "$SFD_NONBLOCK"; then
SFD_NONBLOCK=0
fi
SIZEOF_STRUCT_SIGNALFD_SIGINFO="$ac_cv_sizeof_struct_signalfd_siginfo"
SIZEOF_SIGSET_T="$ac_cv_sizeof_sigset_t"
AC_SUBST([SIZEOF_STRUCT_SIGNALFD_SIGINFO])
AC_SUBST([SIZEOF_SIGSET_T])
AC_SUBST([SFD_CLOEXEC])
AC_SUBST([SFD_NONBLOCK])
AC_SUBST([SIG_BLOCK])
AC_SUBST([SIG_UNBLOCK])
AC_SUBST([SIG_SETMASK])
AC_MSG_CHECKING([<sys/inotify.h> constants])
AC_COMPUTE_INT([IN_NONBLOCK], [IN_NONBLOCK], [#include <sys/inotify.h>])
AC_COMPUTE_INT([IN_CLOEXEC], [IN_CLOEXEC], [#include <sys/inotify.h>])
AC_COMPUTE_INT([IN_DELETE_SELF], [IN_DELETE_SELF], [#include <sys/inotify.h>])
AC_COMPUTE_INT([IN_ATTRIB], [IN_ATTRIB], [#include <sys/inotify.h>])
dnl The inotify interface is a Linux feature; set these variables to a
dnl non-empty string on other systems.
test -z "$IN_NONBLOCK" && IN_NONBLOCK=0
test -z "$IN_CLOEXEC" && IN_CLOEXEC=0
test -z "$IN_DELETE_SELF" && IN_DELETE_SELF=0
test -z "$IN_ATTRIB" && IN_ATTRIB=0
AC_SUBST([IN_NONBLOCK])
AC_SUBST([IN_CLOEXEC])
AC_SUBST([IN_DELETE_SELF])
AC_SUBST([IN_ATTRIB])
AC_MSG_RESULT([done])
dnl The GNU libc declares 'close_range' and its constants in <unistd.h>, both
dnl for Linux and for the Hurd, provided '_GNU_SOURCE' is defined.
AC_MSG_CHECKING(['close_range' constants])
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
AC_COMPUTE_INT([CLOSE_RANGE_CLOEXEC], [CLOSE_RANGE_CLOEXEC],
[#include <unistd.h>])
CPPFLAGS="$old_CPPFLAGS"
test -z "$CLOSE_RANGE_CLOEXEC" && CLOSE_RANGE_CLOEXEC=0
AC_SUBST([CLOSE_RANGE_CLOEXEC])
AC_MSG_RESULT([done])
AC_MSG_CHECKING([whether to build crash handler])
case "$host_os" in
linux-gnu*) build_crash_handler=yes;;
*) build_crash_handler=no;;
esac
AC_MSG_RESULT([$build_crash_handler])
AM_CONDITIONAL([BUILD_CRASH_HANDLER], [test "x$build_crash_handler" = "xyes"])
dnl Shell completions.
AC_ARG_WITH([bash-completion-dir],
AS_HELP_STRING([--with-bash-completion-dir=DIR],
[name of the Bash completion directory]),
[bashcompletiondir="$withval"],
[bashcompletiondir='${sysconfdir}/bash_completion.d'])
AC_SUBST([bashcompletiondir])
AC_ARG_WITH([fish-completion-dir],
AS_HELP_STRING([--with-fish-completion-dir=DIR],
[name of the Fish completion directory]),
[fishcompletiondir="$withval"],
[fishcompletiondir='${datadir}/fish/vendor_completions.d'])
AC_SUBST([fishcompletiondir])
dnl Manual pages.
AM_MISSING_PROG([HELP2MAN], [help2man])
dnl Finish.
AC_CONFIG_FILES([Makefile po/Makefile.in
modules/shepherd/system.scm])
AC_OUTPUT
|