2 dnl Launch-on-demand/startup stuff for CUPS.
4 dnl Copyright 2007-2017 by Apple Inc.
5 dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
7 dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
12 AC_SUBST(ONDEMANDFLAGS)
13 AC_SUBST(ONDEMANDLIBS)
15 dnl Launchd is used on macOS/Darwin...
16 AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support])
20 if test x$enable_launchd != xno; then
21 AC_CHECK_FUNC(launch_activate_socket, [
22 AC_DEFINE(HAVE_LAUNCHD)
23 AC_DEFINE(HAVE_ONDEMAND)])
24 AC_CHECK_HEADER(launch.h, AC_DEFINE(HAVE_LAUNCH_H))
26 if test "$host_os_name" = darwin; then
27 LAUNCHD_DIR="/System/Library/LaunchDaemons"
28 # liblaunch is already part of libSystem
32 dnl Systemd is used on Linux...
33 AC_ARG_ENABLE(systemd, [ --disable-systemd disable systemd support])
34 AC_ARG_WITH(systemd, [ --with-systemd set directory for systemd service files],
35 SYSTEMD_DIR="$withval", SYSTEMD_DIR="")
38 if test x$enable_systemd != xno; then
39 if test "x$PKGCONFIG" = x; then
40 if test x$enable_systemd = xyes; then
41 AC_MSG_ERROR(Need pkg-config to enable systemd support.)
45 AC_MSG_CHECKING(for libsystemd)
46 if $PKGCONFIG --exists libsystemd; then
49 ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd`
50 ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd`
51 elif $PKGCONFIG --exists libsystemd-daemon; then
52 AC_MSG_RESULT(yes - legacy)
54 ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd-daemon`
55 ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd-daemon`
57 if $PKGCONFIG --exists libsystemd-journal; then
58 ONDEMANDFLAGS="$ONDEMANDFLAGS `$PKGCONFIG --cflags libsystemd-journal`"
59 ONDEMANDLIBS="$ONDEMANDLIBS `$PKGCONFIG --libs libsystemd-journal`"
65 if test $have_systemd = yes; then
66 AC_DEFINE(HAVE_SYSTEMD)
67 AC_DEFINE(HAVE_ONDEMAND)
68 AC_CHECK_HEADER(systemd/sd-journal.h,AC_DEFINE(HAVE_SYSTEMD_SD_JOURNAL_H))
69 if test "x$SYSTEMD_DIR" = x; then
70 SYSTEMD_DIR="`$PKGCONFIG --variable=systemdsystemunitdir systemd`"
76 dnl Upstart is also used on Linux (e.g., Chrome OS)
77 AC_ARG_ENABLE(upstart, [ --enable-upstart enable upstart support])
78 if test "x$enable_upstart" = "xyes"; then
79 if test "x$have_systemd" = "xyes"; then
80 AC_MSG_ERROR(Cannot support both systemd and upstart.)
82 AC_DEFINE(HAVE_UPSTART)
83 AC_DEFINE(HAVE_ONDEMAND)
88 AC_SUBST(SMFMANIFESTDIR)
89 AC_ARG_WITH(smfmanifestdir, [ --with-smfmanifestdir set path for Solaris SMF manifest],SMFMANIFESTDIR="$withval")
91 dnl Use init on other platforms...
92 AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="")
93 AC_ARG_WITH(rclevels, [ --with-rclevels set run levels for rc scripts],rclevels="$withval",rclevels="2 3 5")
94 AC_ARG_WITH(rcstart, [ --with-rcstart set start number for rc scripts],rcstart="$withval",rcstart="")
95 AC_ARG_WITH(rcstop, [ --with-rcstop set stop number for rc scripts],rcstop="$withval",rcstop="")
97 if test x$rcdir = x; then
98 if test x$LAUNCHD_DIR = x -a x$SYSTEMD_DIR = x -a x$SMFMANIFESTDIR = x; then
99 # Fall back on "init", the original service startup interface...
100 if test -d /sbin/init.d; then
103 elif test -d /etc/init.d; then
115 if test "x$rcstart" = x; then
116 case "$host_os_name" in
134 if test "x$rcstop" = x; then
135 case "$host_os_name" in
159 if test "x$rcdir" != xno; then
160 if test "x$rclevels" = x; then
167 dnl Xinetd support...
168 AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],xinetd="$withval",xinetd="")
172 if test "x$xinetd" = x; then
173 if test ! -x /sbin/launchd; then
174 for dir in /etc/xinetd.d /usr/local/etc/xinetd.d; do
175 if test -d $dir; then
181 elif test "x$xinetd" != xno; then