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