2 dnl Launch-on-demand/startup stuff for CUPS.
4 dnl Copyright 2007-2015 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 OS X/Darwin...
20 AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support])
24 if test x$enable_launchd != xno; then
25 AC_CHECK_FUNC(launch_msg, AC_DEFINE(HAVE_LAUNCHD))
26 if test $uversion -ge 140; then
27 AC_CHECK_FUNC(launch_activate_socket, [
28 AC_DEFINE(HAVE_LAUNCHD)
29 AC_DEFINE(HAVE_LAUNCH_ACTIVATE_SOCKET)])
31 AC_CHECK_HEADER(launch.h, AC_DEFINE(HAVE_LAUNCH_H))
36 LAUNCHD_DIR="/System/Library/LaunchDaemons"
37 # liblaunch is already part of libSystem
40 # All others; this test will need to be updated
45 dnl Systemd is used on Linux...
46 AC_ARG_ENABLE(systemd, [ --disable-systemd disable systemd support])
47 AC_ARG_WITH(systemd, [ --with-systemd set directory for systemd service files],
48 SYSTEMD_DIR="$withval", SYSTEMD_DIR="")
51 if test x$enable_systemd != xno; then
52 if test "x$PKGCONFIG" = x; then
53 if test x$enable_systemd = xyes; then
54 AC_MSG_ERROR(Need pkg-config to enable systemd support.)
58 AC_MSG_CHECKING(for libsystemd)
59 if $PKGCONFIG --exists libsystemd; then
62 ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd`
63 ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd`
64 elif $PKGCONFIG --exists libsystemd-daemon; then
65 AC_MSG_RESULT(yes - legacy)
67 ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd-daemon`
68 ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd-daemon`
70 if $PKGCONFIG --exists libsystemd-journal; then
71 ONDEMANDFLAGS="$ONDEMANDFLAGS `$PKGCONFIG --cflags libsystemd-journal`"
72 ONDEMANDLIBS="$ONDEMANDLIBS `$PKGCONFIG --libs libsystemd-journal`"
78 if test $have_systemd = yes; then
79 AC_DEFINE(HAVE_SYSTEMD)
80 AC_CHECK_HEADER(systemd/sd-journal.h,AC_DEFINE(HAVE_SYSTEMD_SD_JOURNAL_H))
81 if test "x$SYSTEMD_DIR" = x; then
82 SYSTEMD_DIR="`$PKGCONFIG --variable=systemdsystemunitdir systemd`"
90 AC_SUBST(SMFMANIFESTDIR)
91 AC_ARG_WITH(smfmanifestdir, [ --with-smfmanifestdir set path for Solaris SMF manifest],SMFMANIFESTDIR="$withval")
93 dnl Use init on other platforms...
94 AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="")
95 AC_ARG_WITH(rclevels, [ --with-rclevels set run levels for rc scripts],rclevels="$withval",rclevels="2 3 5")
96 AC_ARG_WITH(rcstart, [ --with-rcstart set start number for rc scripts],rcstart="$withval",rcstart="")
97 AC_ARG_WITH(rcstop, [ --with-rcstop set stop number for rc scripts],rcstop="$withval",rcstop="")
99 if test x$rcdir = x; then
100 if test x$LAUNCHD_DIR = x -a x$SYSTEMD_DIR = x -a x$SMFMANIFESTDIR = x; then
101 # Fall back on "init", the original service startup interface...
102 if test -d /sbin/init.d; then
105 elif test -d /etc/init.d; then
117 if test "x$rcstart" = x; then
119 Linux | GNU | GNU/k*BSD*)
136 if test "x$rcstop" = x; then
138 Linux | GNU | GNU/k*BSD*)
161 if test "x$rcdir" != xno; then
162 if test "x$rclevels" = x; then
169 dnl Xinetd support...
170 AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],xinetd="$withval",xinetd="")
174 if test "x$xinetd" = x; then
175 if test ! -x /sbin/launchd; then
176 for dir in /etc/xinetd.d /usr/local/etc/xinetd.d; do
177 if test -d $dir; then
183 elif test "x$xinetd" != xno; then