]>
Commit | Line | Data |
---|---|---|
1a18c85c | 1 | dnl |
4ef75dec | 2 | dnl "$Id: cups-startup.m4 12351 2014-12-09 22:18:45Z msweet $" |
1a18c85c MS |
3 | dnl |
4 | dnl Launch-on-demand/startup stuff for CUPS. | |
5 | dnl | |
6 | dnl Copyright 2007-2014 by Apple Inc. | |
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 | |
38 | LAUNCHD_DIR="/System/Library/LaunchDaemons" | |
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 | |
59 | AC_MSG_CHECKING(for libsystemd-daemon) | |
60 | if $PKGCONFIG --exists libsystemd-daemon; then | |
61 | AC_MSG_RESULT(yes) | |
62 | ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd-daemon` | |
63 | ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd-daemon` | |
64 | AC_DEFINE(HAVE_SYSTEMD) | |
65 | if test "x$SYSTEMD_DIR" = x; then | |
66 | SYSTEMD_DIR="`$PKGCONFIG --variable=systemdsystemunitdir systemd`" | |
67 | fi | |
68 | else | |
69 | AC_MSG_RESULT(no) | |
70 | fi | |
71 | fi | |
72 | fi | |
73 | ||
74 | dnl Solaris uses smf | |
75 | SMFMANIFESTDIR="" | |
76 | AC_SUBST(SMFMANIFESTDIR) | |
77 | AC_ARG_WITH(smfmanifestdir, [ --with-smfmanifestdir set path for Solaris SMF manifest],SMFMANIFESTDIR="$withval") | |
78 | ||
79 | dnl Use init on other platforms... | |
80 | AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="") | |
81 | AC_ARG_WITH(rclevels, [ --with-rclevels set run levels for rc scripts],rclevels="$withval",rclevels="2 3 5") | |
82 | AC_ARG_WITH(rcstart, [ --with-rcstart set start number for rc scripts],rcstart="$withval",rcstart="") | |
83 | AC_ARG_WITH(rcstop, [ --with-rcstop set stop number for rc scripts],rcstop="$withval",rcstop="") | |
84 | ||
85 | if test x$rcdir = x; then | |
86 | if test x$LAUNCHD_DIR = x -a x$SYSTEMD_DIR = x -a x$SMFMANIFESTDIR = x; then | |
87 | # Fall back on "init", the original service startup interface... | |
88 | if test -d /sbin/init.d; then | |
89 | # SuSE | |
90 | rcdir="/sbin/init.d" | |
91 | elif test -d /etc/init.d; then | |
92 | # Others | |
93 | rcdir="/etc" | |
94 | else | |
95 | # RedHat, NetBSD | |
96 | rcdir="/etc/rc.d" | |
97 | fi | |
98 | else | |
99 | rcdir="no" | |
100 | fi | |
101 | fi | |
102 | ||
103 | if test "x$rcstart" = x; then | |
104 | case "$uname" in | |
105 | Linux | GNU | GNU/k*BSD*) | |
106 | # Linux | |
107 | rcstart="81" | |
108 | ;; | |
109 | ||
110 | SunOS*) | |
111 | # Solaris | |
112 | rcstart="81" | |
113 | ;; | |
114 | ||
115 | *) | |
116 | # Others | |
117 | rcstart="99" | |
118 | ;; | |
119 | esac | |
120 | fi | |
121 | ||
122 | if test "x$rcstop" = x; then | |
123 | case "$uname" in | |
124 | Linux | GNU | GNU/k*BSD*) | |
125 | # Linux | |
126 | rcstop="36" | |
127 | ;; | |
128 | ||
129 | *) | |
130 | # Others | |
131 | rcstop="00" | |
132 | ;; | |
133 | esac | |
134 | fi | |
135 | ||
136 | INITDIR="" | |
137 | INITDDIR="" | |
138 | RCLEVELS="$rclevels" | |
139 | RCSTART="$rcstart" | |
140 | RCSTOP="$rcstop" | |
141 | AC_SUBST(INITDIR) | |
142 | AC_SUBST(INITDDIR) | |
143 | AC_SUBST(RCLEVELS) | |
144 | AC_SUBST(RCSTART) | |
145 | AC_SUBST(RCSTOP) | |
146 | ||
147 | if test "x$rcdir" != xno; then | |
148 | if test "x$rclevels" = x; then | |
149 | INITDDIR="$rcdir" | |
150 | else | |
151 | INITDIR="$rcdir" | |
152 | fi | |
153 | fi | |
154 | ||
155 | dnl Xinetd support... | |
156 | AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],xinetd="$withval",xinetd="") | |
157 | XINETD="" | |
158 | AC_SUBST(XINETD) | |
159 | ||
160 | if test "x$xinetd" = x; then | |
161 | if test ! -x /sbin/launchd; then | |
162 | for dir in /etc/xinetd.d /usr/local/etc/xinetd.d; do | |
163 | if test -d $dir; then | |
164 | XINETD="$dir" | |
165 | break | |
166 | fi | |
167 | done | |
168 | fi | |
4ef75dec | 169 | elif test "x$xinetd" != xno; then |
1a18c85c MS |
170 | XINETD="$xinetd" |
171 | fi | |
172 | ||
173 | ||
174 | dnl | |
4ef75dec | 175 | dnl End of "$Id: cups-startup.m4 12351 2014-12-09 22:18:45Z msweet $". |
1a18c85c | 176 | dnl |