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