]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-startup.m4
Next release will be CUPS 2.1rc1...
[thirdparty/cups.git] / config-scripts / cups-startup.m4
CommitLineData
1720786e
MS
1dnl
2dnl "$Id$"
3dnl
4dnl Launch-on-demand/startup stuff for CUPS.
5dnl
4bdf6dfa 6dnl Copyright 2007-2015 by Apple Inc.
1720786e
MS
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
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
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
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
73fi
74
75dnl Solaris uses smf
76SMFMANIFESTDIR=""
77AC_SUBST(SMFMANIFESTDIR)
78AC_ARG_WITH(smfmanifestdir, [ --with-smfmanifestdir set path for Solaris SMF manifest],SMFMANIFESTDIR="$withval")
79
80dnl Use init on other platforms...
81AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="")
82AC_ARG_WITH(rclevels, [ --with-rclevels set run levels for rc scripts],rclevels="$withval",rclevels="2 3 5")
83AC_ARG_WITH(rcstart, [ --with-rcstart set start number for rc scripts],rcstart="$withval",rcstart="")
84AC_ARG_WITH(rcstop, [ --with-rcstop set stop number for rc scripts],rcstop="$withval",rcstop="")
85
86if 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
102fi
103
104if 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
121fi
122
123if 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
135fi
136
137INITDIR=""
138INITDDIR=""
139RCLEVELS="$rclevels"
140RCSTART="$rcstart"
141RCSTOP="$rcstop"
142AC_SUBST(INITDIR)
143AC_SUBST(INITDDIR)
144AC_SUBST(RCLEVELS)
145AC_SUBST(RCSTART)
146AC_SUBST(RCSTOP)
147
148if test "x$rcdir" != xno; then
149 if test "x$rclevels" = x; then
150 INITDDIR="$rcdir"
151 else
152 INITDIR="$rcdir"
153 fi
154fi
155
156dnl Xinetd support...
157AC_ARG_WITH(xinetd, [ --with-xinetd set path for xinetd config files],xinetd="$withval",xinetd="")
158XINETD=""
159AC_SUBST(XINETD)
160
161if 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 170elif test "x$xinetd" != xno; then
1720786e
MS
171 XINETD="$xinetd"
172fi
173
174
175dnl
176dnl End of "$Id$".
177dnl