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 These coded instructions, statements, and computer programs are the
8 dnl property of Apple Inc. and are protected by Federal copyright
9 dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 dnl which should have been included with this file. If this file is
11 dnl missing or damaged, see the license at "http://www.cups.org/".
16 AC_SUBST(ONDEMANDFLAGS)
17 AC_SUBST(ONDEMANDLIBS)
19 dnl Launchd is used on macOS/Darwin...
20 AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support])
24 if test x$enable_launchd != xno; then
25 AC_CHECK_FUNC(launch_activate_socket, [
26 AC_DEFINE(HAVE_LAUNCHD)
27 AC_DEFINE(HAVE_ONDEMAND)])
28 AC_CHECK_HEADER(launch.h, AC_DEFINE(HAVE_LAUNCH_H))
30 if test "$host_os_name" = darwin; then
31 LAUNCHD_DIR="/System/Library/LaunchDaemons"
32 # liblaunch is already part of libSystem
36 dnl Systemd is used on Linux...
37 AC_ARG_ENABLE(systemd, [ --disable-systemd disable systemd support])
38 AC_ARG_WITH(systemd, [ --with-systemd set directory for systemd service files],
39 SYSTEMD_DIR="$withval", SYSTEMD_DIR="")
42 if test x$enable_systemd != xno; then
43 if test "x$PKGCONFIG" = x; then
44 if test x$enable_systemd = xyes; then
45 AC_MSG_ERROR(Need pkg-config to enable systemd support.)
49 AC_MSG_CHECKING(for libsystemd)
50 if $PKGCONFIG --exists libsystemd; then
53 ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd`
54 ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd`
55 elif $PKGCONFIG --exists libsystemd-daemon; then
56 AC_MSG_RESULT(yes - legacy)
58 ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd-daemon`
59 ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd-daemon`
61 if $PKGCONFIG --exists libsystemd-journal; then
62 ONDEMANDFLAGS="$ONDEMANDFLAGS `$PKGCONFIG --cflags libsystemd-journal`"
63 ONDEMANDLIBS="$ONDEMANDLIBS `$PKGCONFIG --libs libsystemd-journal`"
69 if test $have_systemd = yes; then
70 AC_DEFINE(HAVE_SYSTEMD)
71 AC_DEFINE(HAVE_ONDEMAND)
72 AC_CHECK_HEADER(systemd/sd-journal.h,AC_DEFINE(HAVE_SYSTEMD_SD_JOURNAL_H))
73 if test "x$SYSTEMD_DIR" = x; then
74 SYSTEMD_DIR="`$PKGCONFIG --variable=systemdsystemunitdir systemd`"
80 dnl Upstart is also used on Linux (e.g., Chrome OS)
81 AC_ARG_ENABLE(upstart, [ --enable-upstart enable upstart support])
82 if test "x$enable_upstart" = "xyes"; then
83 if test "x$have_systemd" = "xyes"; then
84 AC_MSG_ERROR(Cannot support both systemd and upstart.)
86 AC_DEFINE(HAVE_UPSTART)
87 AC_DEFINE(HAVE_ONDEMAND)
92 AC_SUBST(SMFMANIFESTDIR)
93 AC_ARG_WITH(smfmanifestdir, [ --with-smfmanifestdir set path for Solaris SMF manifest],SMFMANIFESTDIR="$withval")
95 dnl Use init on other platforms...
96 AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="")
97 AC_ARG_WITH(rclevels, [ --with-rclevels set run levels for rc scripts],rclevels="$withval",rclevels="2 3 5")
98 AC_ARG_WITH(rcstart, [ --with-rcstart set start number for rc scripts],rcstart="$withval",rcstart="")
99 AC_ARG_WITH(rcstop, [ --with-rcstop set stop number for rc scripts],rcstop="$withval",rcstop="")
101 if test x$rcdir = x; then
102 if test x$LAUNCHD_DIR = x -a x$SYSTEMD_DIR = x -a x$SMFMANIFESTDIR = x; then
103 # Fall back on "init", the original service startup interface...
104 if test -d /sbin/init.d; then
107 elif test -d /etc/init.d; then
119 if test "x$rcstart" = x; then
120 case "$host_os_name" in
138 if test "x$rcstop" = x; then
139 case "$host_os_name" in
163 if test "x$rcdir" != xno; then
164 if test "x$rclevels" = x; then
171 dnl Xinetd support...
172 AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],xinetd="$withval",xinetd="")
176 if test "x$xinetd" = x; then
177 if test ! -x /sbin/launchd; then
178 for dir in /etc/xinetd.d /usr/local/etc/xinetd.d; do
179 if test -d $dir; then
185 elif test "x$xinetd" != xno; then