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