]>
Commit | Line | Data |
---|---|---|
1720786e | 1 | dnl |
1720786e MS |
2 | dnl Launch-on-demand/startup stuff for CUPS. |
3 | dnl | |
d4874933 | 4 | dnl Copyright 2007-2016 by Apple Inc. |
1720786e MS |
5 | dnl Copyright 1997-2005 by Easy Software Products, all rights reserved. |
6 | dnl | |
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/". | |
12 | dnl | |
13 | ||
14 | ONDEMANDFLAGS="" | |
15 | ONDEMANDLIBS="" | |
16 | AC_SUBST(ONDEMANDFLAGS) | |
17 | AC_SUBST(ONDEMANDLIBS) | |
18 | ||
8072030b | 19 | dnl Launchd is used on macOS/Darwin... |
1720786e MS |
20 | AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support]) |
21 | LAUNCHD_DIR="" | |
22 | AC_SUBST(LAUNCHD_DIR) | |
23 | ||
24 | if test x$enable_launchd != xno; then | |
1166bf58 MS |
25 | AC_CHECK_FUNC(launch_activate_socket, [ |
26 | AC_DEFINE(HAVE_LAUNCHD) | |
27 | AC_DEFINE(HAVE_ONDEMAND)]) | |
1720786e MS |
28 | AC_CHECK_HEADER(launch.h, AC_DEFINE(HAVE_LAUNCH_H)) |
29 | ||
30 | case "$uname" in | |
31 | Darwin*) | |
d4874933 | 32 | # Darwin, macOS |
6347efdf | 33 | LAUNCHD_DIR="/System/Library/LaunchDaemons" |
1720786e MS |
34 | # liblaunch is already part of libSystem |
35 | ;; | |
36 | *) | |
37 | # All others; this test will need to be updated | |
38 | ;; | |
39 | esac | |
40 | fi | |
41 | ||
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="") | |
46 | AC_SUBST(SYSTEMD_DIR) | |
47 | ||
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.) | |
52 | fi | |
53 | else | |
f495e905 | 54 | have_systemd=no |
4bdf6dfa MS |
55 | AC_MSG_CHECKING(for libsystemd) |
56 | if $PKGCONFIG --exists libsystemd; then | |
1720786e | 57 | AC_MSG_RESULT(yes) |
f495e905 | 58 | have_systemd=yes |
4bdf6dfa MS |
59 | ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd` |
60 | ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd` | |
f495e905 MS |
61 | elif $PKGCONFIG --exists libsystemd-daemon; then |
62 | AC_MSG_RESULT(yes - legacy) | |
63 | have_systemd=yes | |
64 | ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd-daemon` | |
65 | ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd-daemon` | |
66 | ||
67 | if $PKGCONFIG --exists libsystemd-journal; then | |
68 | ONDEMANDFLAGS="$ONDEMANDFLAGS `$PKGCONFIG --cflags libsystemd-journal`" | |
69 | ONDEMANDLIBS="$ONDEMANDLIBS `$PKGCONFIG --libs libsystemd-journal`" | |
70 | fi | |
71 | else | |
72 | AC_MSG_RESULT(no) | |
73 | fi | |
74 | ||
75 | if test $have_systemd = yes; then | |
1720786e | 76 | AC_DEFINE(HAVE_SYSTEMD) |
1166bf58 | 77 | AC_DEFINE(HAVE_ONDEMAND) |
4bdf6dfa | 78 | AC_CHECK_HEADER(systemd/sd-journal.h,AC_DEFINE(HAVE_SYSTEMD_SD_JOURNAL_H)) |
1720786e MS |
79 | if test "x$SYSTEMD_DIR" = x; then |
80 | SYSTEMD_DIR="`$PKGCONFIG --variable=systemdsystemunitdir systemd`" | |
81 | fi | |
1720786e MS |
82 | fi |
83 | fi | |
84 | fi | |
85 | ||
441de8b2 BN |
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.) | |
91 | fi | |
92 | AC_DEFINE(HAVE_UPSTART) | |
1166bf58 | 93 | AC_DEFINE(HAVE_ONDEMAND) |
441de8b2 BN |
94 | fi |
95 | ||
1720786e MS |
96 | dnl Solaris uses smf |
97 | SMFMANIFESTDIR="" | |
98 | AC_SUBST(SMFMANIFESTDIR) | |
99 | AC_ARG_WITH(smfmanifestdir, [ --with-smfmanifestdir set path for Solaris SMF manifest],SMFMANIFESTDIR="$withval") | |
100 | ||
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="") | |
106 | ||
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 | |
111 | # SuSE | |
112 | rcdir="/sbin/init.d" | |
113 | elif test -d /etc/init.d; then | |
114 | # Others | |
115 | rcdir="/etc" | |
116 | else | |
117 | # RedHat, NetBSD | |
118 | rcdir="/etc/rc.d" | |
119 | fi | |
120 | else | |
121 | rcdir="no" | |
122 | fi | |
123 | fi | |
124 | ||
125 | if test "x$rcstart" = x; then | |
126 | case "$uname" in | |
127 | Linux | GNU | GNU/k*BSD*) | |
128 | # Linux | |
129 | rcstart="81" | |
130 | ;; | |
131 | ||
132 | SunOS*) | |
133 | # Solaris | |
134 | rcstart="81" | |
135 | ;; | |
136 | ||
137 | *) | |
138 | # Others | |
139 | rcstart="99" | |
140 | ;; | |
141 | esac | |
142 | fi | |
143 | ||
144 | if test "x$rcstop" = x; then | |
145 | case "$uname" in | |
146 | Linux | GNU | GNU/k*BSD*) | |
147 | # Linux | |
148 | rcstop="36" | |
149 | ;; | |
150 | ||
151 | *) | |
152 | # Others | |
153 | rcstop="00" | |
154 | ;; | |
155 | esac | |
156 | fi | |
157 | ||
158 | INITDIR="" | |
159 | INITDDIR="" | |
160 | RCLEVELS="$rclevels" | |
161 | RCSTART="$rcstart" | |
162 | RCSTOP="$rcstop" | |
163 | AC_SUBST(INITDIR) | |
164 | AC_SUBST(INITDDIR) | |
165 | AC_SUBST(RCLEVELS) | |
166 | AC_SUBST(RCSTART) | |
167 | AC_SUBST(RCSTOP) | |
168 | ||
169 | if test "x$rcdir" != xno; then | |
170 | if test "x$rclevels" = x; then | |
171 | INITDDIR="$rcdir" | |
172 | else | |
173 | INITDIR="$rcdir" | |
174 | fi | |
175 | fi | |
176 | ||
177 | dnl Xinetd support... | |
178 | AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],xinetd="$withval",xinetd="") | |
179 | XINETD="" | |
180 | AC_SUBST(XINETD) | |
181 | ||
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 | |
186 | XINETD="$dir" | |
187 | break | |
188 | fi | |
189 | done | |
190 | fi | |
c4a1d4a5 | 191 | elif test "x$xinetd" != xno; then |
1720786e MS |
192 | XINETD="$xinetd" |
193 | fi |