]>
Commit | Line | Data |
---|---|---|
1720786e | 1 | dnl |
1720786e MS |
2 | dnl Launch-on-demand/startup stuff for CUPS. |
3 | dnl | |
105922ec | 4 | dnl Copyright 2007-2017 by Apple Inc. |
1720786e MS |
5 | dnl Copyright 1997-2005 by Easy Software Products, all rights reserved. |
6 | dnl | |
e3101897 | 7 | dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information. |
1720786e MS |
8 | dnl |
9 | ||
10 | ONDEMANDFLAGS="" | |
11 | ONDEMANDLIBS="" | |
12 | AC_SUBST(ONDEMANDFLAGS) | |
13 | AC_SUBST(ONDEMANDLIBS) | |
14 | ||
8072030b | 15 | dnl Launchd is used on macOS/Darwin... |
1720786e MS |
16 | AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support]) |
17 | LAUNCHD_DIR="" | |
18 | AC_SUBST(LAUNCHD_DIR) | |
19 | ||
20 | if test x$enable_launchd != xno; then | |
1166bf58 MS |
21 | AC_CHECK_FUNC(launch_activate_socket, [ |
22 | AC_DEFINE(HAVE_LAUNCHD) | |
23 | AC_DEFINE(HAVE_ONDEMAND)]) | |
1720786e MS |
24 | AC_CHECK_HEADER(launch.h, AC_DEFINE(HAVE_LAUNCH_H)) |
25 | ||
105922ec MS |
26 | if test "$host_os_name" = darwin; then |
27 | LAUNCHD_DIR="/System/Library/LaunchDaemons" | |
28 | # liblaunch is already part of libSystem | |
29 | fi | |
1720786e MS |
30 | fi |
31 | ||
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="") | |
36 | AC_SUBST(SYSTEMD_DIR) | |
37 | ||
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.) | |
42 | fi | |
43 | else | |
f495e905 | 44 | have_systemd=no |
4bdf6dfa MS |
45 | AC_MSG_CHECKING(for libsystemd) |
46 | if $PKGCONFIG --exists libsystemd; then | |
1720786e | 47 | AC_MSG_RESULT(yes) |
f495e905 | 48 | have_systemd=yes |
4bdf6dfa MS |
49 | ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd` |
50 | ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd` | |
f495e905 MS |
51 | elif $PKGCONFIG --exists libsystemd-daemon; then |
52 | AC_MSG_RESULT(yes - legacy) | |
53 | have_systemd=yes | |
54 | ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd-daemon` | |
55 | ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd-daemon` | |
56 | ||
57 | if $PKGCONFIG --exists libsystemd-journal; then | |
58 | ONDEMANDFLAGS="$ONDEMANDFLAGS `$PKGCONFIG --cflags libsystemd-journal`" | |
59 | ONDEMANDLIBS="$ONDEMANDLIBS `$PKGCONFIG --libs libsystemd-journal`" | |
60 | fi | |
61 | else | |
62 | AC_MSG_RESULT(no) | |
63 | fi | |
64 | ||
65 | if test $have_systemd = yes; then | |
1720786e | 66 | AC_DEFINE(HAVE_SYSTEMD) |
1166bf58 | 67 | AC_DEFINE(HAVE_ONDEMAND) |
4bdf6dfa | 68 | AC_CHECK_HEADER(systemd/sd-journal.h,AC_DEFINE(HAVE_SYSTEMD_SD_JOURNAL_H)) |
1720786e MS |
69 | if test "x$SYSTEMD_DIR" = x; then |
70 | SYSTEMD_DIR="`$PKGCONFIG --variable=systemdsystemunitdir systemd`" | |
71 | fi | |
1720786e MS |
72 | fi |
73 | fi | |
74 | fi | |
75 | ||
441de8b2 | 76 | dnl Upstart is also used on Linux (e.g., Chrome OS) |
6eda776e | 77 | AC_ARG_ENABLE(upstart, [ --enable-upstart enable upstart support]) |
441de8b2 BN |
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.) | |
81 | fi | |
82 | AC_DEFINE(HAVE_UPSTART) | |
1166bf58 | 83 | AC_DEFINE(HAVE_ONDEMAND) |
441de8b2 BN |
84 | fi |
85 | ||
1720786e MS |
86 | dnl Solaris uses smf |
87 | SMFMANIFESTDIR="" | |
88 | AC_SUBST(SMFMANIFESTDIR) | |
89 | AC_ARG_WITH(smfmanifestdir, [ --with-smfmanifestdir set path for Solaris SMF manifest],SMFMANIFESTDIR="$withval") | |
90 | ||
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="") | |
96 | ||
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 | |
101 | # SuSE | |
102 | rcdir="/sbin/init.d" | |
103 | elif test -d /etc/init.d; then | |
104 | # Others | |
105 | rcdir="/etc" | |
106 | else | |
107 | # RedHat, NetBSD | |
108 | rcdir="/etc/rc.d" | |
109 | fi | |
110 | else | |
111 | rcdir="no" | |
112 | fi | |
113 | fi | |
114 | ||
115 | if test "x$rcstart" = x; then | |
105922ec | 116 | case "$host_os_name" in |
827bf9ce | 117 | linux* | gnu*) |
1720786e MS |
118 | # Linux |
119 | rcstart="81" | |
120 | ;; | |
121 | ||
105922ec | 122 | sunos*) |
1720786e MS |
123 | # Solaris |
124 | rcstart="81" | |
125 | ;; | |
126 | ||
127 | *) | |
128 | # Others | |
129 | rcstart="99" | |
130 | ;; | |
131 | esac | |
132 | fi | |
133 | ||
134 | if test "x$rcstop" = x; then | |
105922ec | 135 | case "$host_os_name" in |
827bf9ce | 136 | linux* | gnu*) |
1720786e MS |
137 | # Linux |
138 | rcstop="36" | |
139 | ;; | |
140 | ||
141 | *) | |
142 | # Others | |
143 | rcstop="00" | |
144 | ;; | |
145 | esac | |
146 | fi | |
147 | ||
148 | INITDIR="" | |
149 | INITDDIR="" | |
150 | RCLEVELS="$rclevels" | |
151 | RCSTART="$rcstart" | |
152 | RCSTOP="$rcstop" | |
153 | AC_SUBST(INITDIR) | |
154 | AC_SUBST(INITDDIR) | |
155 | AC_SUBST(RCLEVELS) | |
156 | AC_SUBST(RCSTART) | |
157 | AC_SUBST(RCSTOP) | |
158 | ||
159 | if test "x$rcdir" != xno; then | |
160 | if test "x$rclevels" = x; then | |
161 | INITDDIR="$rcdir" | |
162 | else | |
163 | INITDIR="$rcdir" | |
164 | fi | |
165 | fi | |
166 | ||
167 | dnl Xinetd support... | |
168 | AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],xinetd="$withval",xinetd="") | |
169 | XINETD="" | |
170 | AC_SUBST(XINETD) | |
171 | ||
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 | |
176 | XINETD="$dir" | |
177 | break | |
178 | fi | |
179 | done | |
180 | fi | |
c4a1d4a5 | 181 | elif test "x$xinetd" != xno; then |
1720786e MS |
182 | XINETD="$xinetd" |
183 | fi |