]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-startup.m4
Import CUPS v2.0.2
[thirdparty/cups.git] / config-scripts / cups-startup.m4
CommitLineData
1a18c85c 1dnl
4ef75dec 2dnl "$Id: cups-startup.m4 12351 2014-12-09 22:18:45Z msweet $"
1a18c85c
MS
3dnl
4dnl Launch-on-demand/startup stuff for CUPS.
5dnl
6dnl Copyright 2007-2014 by Apple Inc.
7dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
8dnl
9dnl These coded instructions, statements, and computer programs are the
10dnl property of Apple Inc. and are protected by Federal copyright
11dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
12dnl which should have been included with this file. If this file is
13dnl file is missing or damaged, see the license at "http://www.cups.org/".
14dnl
15
16ONDEMANDFLAGS=""
17ONDEMANDLIBS=""
18AC_SUBST(ONDEMANDFLAGS)
19AC_SUBST(ONDEMANDLIBS)
20
21dnl Launchd is used on OS X/Darwin...
22AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support])
23LAUNCHD_DIR=""
24AC_SUBST(LAUNCHD_DIR)
25
26if 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
45fi
46
47dnl Systemd is used on Linux...
48AC_ARG_ENABLE(systemd, [ --disable-systemd disable systemd support])
49AC_ARG_WITH(systemd, [ --with-systemd set directory for systemd service files],
50 SYSTEMD_DIR="$withval", SYSTEMD_DIR="")
51AC_SUBST(SYSTEMD_DIR)
52
53if 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
72fi
73
74dnl Solaris uses smf
75SMFMANIFESTDIR=""
76AC_SUBST(SMFMANIFESTDIR)
77AC_ARG_WITH(smfmanifestdir, [ --with-smfmanifestdir set path for Solaris SMF manifest],SMFMANIFESTDIR="$withval")
78
79dnl Use init on other platforms...
80AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="")
81AC_ARG_WITH(rclevels, [ --with-rclevels set run levels for rc scripts],rclevels="$withval",rclevels="2 3 5")
82AC_ARG_WITH(rcstart, [ --with-rcstart set start number for rc scripts],rcstart="$withval",rcstart="")
83AC_ARG_WITH(rcstop, [ --with-rcstop set stop number for rc scripts],rcstop="$withval",rcstop="")
84
85if 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
101fi
102
103if 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
120fi
121
122if 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
134fi
135
136INITDIR=""
137INITDDIR=""
138RCLEVELS="$rclevels"
139RCSTART="$rcstart"
140RCSTOP="$rcstop"
141AC_SUBST(INITDIR)
142AC_SUBST(INITDDIR)
143AC_SUBST(RCLEVELS)
144AC_SUBST(RCSTART)
145AC_SUBST(RCSTOP)
146
147if test "x$rcdir" != xno; then
148 if test "x$rclevels" = x; then
149 INITDDIR="$rcdir"
150 else
151 INITDIR="$rcdir"
152 fi
153fi
154
155dnl Xinetd support...
156AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],xinetd="$withval",xinetd="")
157XINETD=""
158AC_SUBST(XINETD)
159
160if 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 169elif test "x$xinetd" != xno; then
1a18c85c
MS
170 XINETD="$xinetd"
171fi
172
173
174dnl
4ef75dec 175dnl End of "$Id: cups-startup.m4 12351 2014-12-09 22:18:45Z msweet $".
1a18c85c 176dnl