2 dnl Launch-on-demand/startup stuff for CUPS.
4 dnl Copyright 2007-2016 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 file is 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))
33 LAUNCHD_DIR="/System/Library/LaunchDaemons"
34 # liblaunch is already part of libSystem
37 # All others; this test will need to be updated
42 dnl Systemd is used on Linux...
43 AC_ARG_ENABLE(systemd, [ --disable-systemd disable systemd support])
44 AC_ARG_WITH(systemd, [ --with-systemd set directory for systemd service files],
45 SYSTEMD_DIR="$withval", SYSTEMD_DIR="")
48 if test x$enable_systemd != xno; then
49 if test "x$PKGCONFIG" = x; then
50 if test x$enable_systemd = xyes; then
51 AC_MSG_ERROR(Need pkg-config to enable systemd support.)
55 AC_MSG_CHECKING(for libsystemd)
56 if $PKGCONFIG --exists libsystemd; then
59 ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd`
60 ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd`
61 elif $PKGCONFIG --exists libsystemd-daemon; then
62 AC_MSG_RESULT(yes - legacy)
64 ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd-daemon`
65 ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd-daemon`
67 if $PKGCONFIG --exists libsystemd-journal; then
68 ONDEMANDFLAGS="$ONDEMANDFLAGS `$PKGCONFIG --cflags libsystemd-journal`"
69 ONDEMANDLIBS="$ONDEMANDLIBS `$PKGCONFIG --libs libsystemd-journal`"
75 if test $have_systemd = yes; then
76 AC_DEFINE(HAVE_SYSTEMD)
77 AC_DEFINE(HAVE_ONDEMAND)
78 AC_CHECK_HEADER(systemd/sd-journal.h,AC_DEFINE(HAVE_SYSTEMD_SD_JOURNAL_H))
79 if test "x$SYSTEMD_DIR" = x; then
80 SYSTEMD_DIR="`$PKGCONFIG --variable=systemdsystemunitdir systemd`"
86 dnl Upstart is also used on Linux (e.g., Chrome OS)
87 AC_ARG_ENABLE(upstart, [ --enable-upstart enable upstart support])
88 if test "x$enable_upstart" = "xyes"; then
89 if test "x$have_systemd" = "xyes"; then
90 AC_MSG_ERROR(Cannot support both systemd and upstart.)
92 AC_DEFINE(HAVE_UPSTART)
93 AC_DEFINE(HAVE_ONDEMAND)
98 AC_SUBST(SMFMANIFESTDIR)
99 AC_ARG_WITH(smfmanifestdir, [ --with-smfmanifestdir set path for Solaris SMF manifest],SMFMANIFESTDIR="$withval")
101 dnl Use init on other platforms...
102 AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="")
103 AC_ARG_WITH(rclevels, [ --with-rclevels set run levels for rc scripts],rclevels="$withval",rclevels="2 3 5")
104 AC_ARG_WITH(rcstart, [ --with-rcstart set start number for rc scripts],rcstart="$withval",rcstart="")
105 AC_ARG_WITH(rcstop, [ --with-rcstop set stop number for rc scripts],rcstop="$withval",rcstop="")
107 if test x$rcdir = x; then
108 if test x$LAUNCHD_DIR = x -a x$SYSTEMD_DIR = x -a x$SMFMANIFESTDIR = x; then
109 # Fall back on "init", the original service startup interface...
110 if test -d /sbin/init.d; then
113 elif test -d /etc/init.d; then
125 if test "x$rcstart" = x; then
127 Linux | GNU | GNU/k*BSD*)
144 if test "x$rcstop" = x; then
146 Linux | GNU | GNU/k*BSD*)
169 if test "x$rcdir" != xno; then
170 if test "x$rclevels" = x; then
177 dnl Xinetd support...
178 AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],xinetd="$withval",xinetd="")
182 if test "x$xinetd" = x; then
183 if test ! -x /sbin/launchd; then
184 for dir in /etc/xinetd.d /usr/local/etc/xinetd.d; do
185 if test -d $dir; then
191 elif test "x$xinetd" != xno; then