]>
Commit | Line | Data |
---|---|---|
1720786e MS |
1 | dnl |
2 | dnl "$Id$" | |
3 | dnl | |
4 | dnl Launch-on-demand/startup stuff for CUPS. | |
5 | dnl | |
4bdf6dfa | 6 | dnl Copyright 2007-2015 by Apple Inc. |
1720786e MS |
7 | dnl Copyright 1997-2005 by Easy Software Products, all rights reserved. |
8 | dnl | |
9 | dnl These coded instructions, statements, and computer programs are the | |
10 | dnl property of Apple Inc. and are protected by Federal copyright | |
11 | dnl law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
12 | dnl which should have been included with this file. If this file is | |
13 | dnl file is missing or damaged, see the license at "http://www.cups.org/". | |
14 | dnl | |
15 | ||
16 | ONDEMANDFLAGS="" | |
17 | ONDEMANDLIBS="" | |
18 | AC_SUBST(ONDEMANDFLAGS) | |
19 | AC_SUBST(ONDEMANDLIBS) | |
20 | ||
21 | dnl Launchd is used on OS X/Darwin... | |
22 | AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support]) | |
23 | LAUNCHD_DIR="" | |
24 | AC_SUBST(LAUNCHD_DIR) | |
25 | ||
26 | if test x$enable_launchd != xno; then | |
27 | AC_CHECK_FUNC(launch_msg, AC_DEFINE(HAVE_LAUNCHD)) | |
28 | if test $uversion -ge 140; then | |
29 | AC_CHECK_FUNC(launch_activate_socket, [ | |
30 | AC_DEFINE(HAVE_LAUNCHD) | |
31 | AC_DEFINE(HAVE_LAUNCH_ACTIVATE_SOCKET)]) | |
32 | fi | |
33 | AC_CHECK_HEADER(launch.h, AC_DEFINE(HAVE_LAUNCH_H)) | |
34 | ||
35 | case "$uname" in | |
36 | Darwin*) | |
37 | # Darwin, MacOS X | |
6347efdf | 38 | LAUNCHD_DIR="/System/Library/LaunchDaemons" |
1720786e MS |
39 | # liblaunch is already part of libSystem |
40 | ;; | |
41 | *) | |
42 | # All others; this test will need to be updated | |
43 | ;; | |
44 | esac | |
45 | fi | |
46 | ||
47 | dnl Systemd is used on Linux... | |
48 | AC_ARG_ENABLE(systemd, [ --disable-systemd disable systemd support]) | |
49 | AC_ARG_WITH(systemd, [ --with-systemd set directory for systemd service files], | |
50 | SYSTEMD_DIR="$withval", SYSTEMD_DIR="") | |
51 | AC_SUBST(SYSTEMD_DIR) | |
52 | ||
53 | if test x$enable_systemd != xno; then | |
54 | if test "x$PKGCONFIG" = x; then | |
55 | if test x$enable_systemd = xyes; then | |
56 | AC_MSG_ERROR(Need pkg-config to enable systemd support.) | |
57 | fi | |
58 | else | |
4bdf6dfa MS |
59 | AC_MSG_CHECKING(for libsystemd) |
60 | if $PKGCONFIG --exists libsystemd; then | |
1720786e | 61 | AC_MSG_RESULT(yes) |
4bdf6dfa MS |
62 | ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd` |
63 | ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd` | |
1720786e | 64 | AC_DEFINE(HAVE_SYSTEMD) |
4bdf6dfa | 65 | AC_CHECK_HEADER(systemd/sd-journal.h,AC_DEFINE(HAVE_SYSTEMD_SD_JOURNAL_H)) |
1720786e MS |
66 | if test "x$SYSTEMD_DIR" = x; then |
67 | SYSTEMD_DIR="`$PKGCONFIG --variable=systemdsystemunitdir systemd`" | |
68 | fi | |
69 | else | |
70 | AC_MSG_RESULT(no) | |
71 | fi | |
72 | fi | |
73 | fi | |
74 | ||
75 | dnl Solaris uses smf | |
76 | SMFMANIFESTDIR="" | |
77 | AC_SUBST(SMFMANIFESTDIR) | |
78 | AC_ARG_WITH(smfmanifestdir, [ --with-smfmanifestdir set path for Solaris SMF manifest],SMFMANIFESTDIR="$withval") | |
79 | ||
80 | dnl Use init on other platforms... | |
81 | AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="") | |
82 | AC_ARG_WITH(rclevels, [ --with-rclevels set run levels for rc scripts],rclevels="$withval",rclevels="2 3 5") | |
83 | AC_ARG_WITH(rcstart, [ --with-rcstart set start number for rc scripts],rcstart="$withval",rcstart="") | |
84 | AC_ARG_WITH(rcstop, [ --with-rcstop set stop number for rc scripts],rcstop="$withval",rcstop="") | |
85 | ||
86 | if test x$rcdir = x; then | |
87 | if test x$LAUNCHD_DIR = x -a x$SYSTEMD_DIR = x -a x$SMFMANIFESTDIR = x; then | |
88 | # Fall back on "init", the original service startup interface... | |
89 | if test -d /sbin/init.d; then | |
90 | # SuSE | |
91 | rcdir="/sbin/init.d" | |
92 | elif test -d /etc/init.d; then | |
93 | # Others | |
94 | rcdir="/etc" | |
95 | else | |
96 | # RedHat, NetBSD | |
97 | rcdir="/etc/rc.d" | |
98 | fi | |
99 | else | |
100 | rcdir="no" | |
101 | fi | |
102 | fi | |
103 | ||
104 | if test "x$rcstart" = x; then | |
105 | case "$uname" in | |
106 | Linux | GNU | GNU/k*BSD*) | |
107 | # Linux | |
108 | rcstart="81" | |
109 | ;; | |
110 | ||
111 | SunOS*) | |
112 | # Solaris | |
113 | rcstart="81" | |
114 | ;; | |
115 | ||
116 | *) | |
117 | # Others | |
118 | rcstart="99" | |
119 | ;; | |
120 | esac | |
121 | fi | |
122 | ||
123 | if test "x$rcstop" = x; then | |
124 | case "$uname" in | |
125 | Linux | GNU | GNU/k*BSD*) | |
126 | # Linux | |
127 | rcstop="36" | |
128 | ;; | |
129 | ||
130 | *) | |
131 | # Others | |
132 | rcstop="00" | |
133 | ;; | |
134 | esac | |
135 | fi | |
136 | ||
137 | INITDIR="" | |
138 | INITDDIR="" | |
139 | RCLEVELS="$rclevels" | |
140 | RCSTART="$rcstart" | |
141 | RCSTOP="$rcstop" | |
142 | AC_SUBST(INITDIR) | |
143 | AC_SUBST(INITDDIR) | |
144 | AC_SUBST(RCLEVELS) | |
145 | AC_SUBST(RCSTART) | |
146 | AC_SUBST(RCSTOP) | |
147 | ||
148 | if test "x$rcdir" != xno; then | |
149 | if test "x$rclevels" = x; then | |
150 | INITDDIR="$rcdir" | |
151 | else | |
152 | INITDIR="$rcdir" | |
153 | fi | |
154 | fi | |
155 | ||
156 | dnl Xinetd support... | |
157 | AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],xinetd="$withval",xinetd="") | |
158 | XINETD="" | |
159 | AC_SUBST(XINETD) | |
160 | ||
161 | if test "x$xinetd" = x; then | |
162 | if test ! -x /sbin/launchd; then | |
163 | for dir in /etc/xinetd.d /usr/local/etc/xinetd.d; do | |
164 | if test -d $dir; then | |
165 | XINETD="$dir" | |
166 | break | |
167 | fi | |
168 | done | |
169 | fi | |
c4a1d4a5 | 170 | elif test "x$xinetd" != xno; then |
1720786e MS |
171 | XINETD="$xinetd" |
172 | fi | |
173 | ||
174 | ||
175 | dnl | |
176 | dnl End of "$Id$". | |
177 | dnl |