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