]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-common.m4
Merge changes from CUPS 1.4svn-r8628.
[thirdparty/cups.git] / config-scripts / cups-common.m4
1 dnl
2 dnl "$Id: cups-common.m4 7900 2008-09-03 13:47:57Z mike $"
3 dnl
4 dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
5 dnl
6 dnl Copyright 2007-2009 by Apple Inc.
7 dnl Copyright 1997-2007 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 dnl We need at least autoconf 2.60...
17 AC_PREREQ(2.60)
18
19 dnl Set the name of the config header file...
20 AC_CONFIG_HEADER(config.h)
21
22 dnl Version number information...
23 CUPS_VERSION="1.4b3"
24 CUPS_REVISION=""
25 #if test -z "$CUPS_REVISION" -a -d .svn; then
26 # CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
27 #fi
28 CUPS_BUILD="cups-$CUPS_VERSION"
29
30 AC_ARG_WITH(cups_build, [ --with-cups-build set "cups-config --build" string ],
31 CUPS_BUILD="$withval")
32
33 AC_SUBST(CUPS_VERSION)
34 AC_SUBST(CUPS_REVISION)
35 AC_SUBST(CUPS_BUILD)
36 AC_DEFINE_UNQUOTED(CUPS_SVERSION, "CUPS v$CUPS_VERSION$CUPS_REVISION")
37 AC_DEFINE_UNQUOTED(CUPS_MINIMAL, "CUPS/$CUPS_VERSION$CUPS_REVISION")
38
39 dnl Default compiler flags...
40 CFLAGS="${CFLAGS:=}"
41 CPPFLAGS="${CPPFLAGS:=}"
42 CXXFLAGS="${CXXFLAGS:=}"
43 LDFLAGS="${LDFLAGS:=}"
44
45 dnl Checks for programs...
46 AC_PROG_AWK
47 AC_PROG_CC
48 AC_PROG_CPP
49 AC_PROG_CXX
50 AC_PROG_RANLIB
51 AC_PATH_PROG(AR,ar)
52 AC_PATH_PROG(HTMLDOC,htmldoc)
53 AC_PATH_PROG(LD,ld)
54 AC_PATH_PROG(LN,ln)
55 AC_PATH_PROG(MV,mv)
56 AC_PATH_PROG(RM,rm)
57 AC_PATH_PROG(RMDIR,rmdir)
58 AC_PATH_PROG(SED,sed)
59 AC_PATH_PROG(XDGOPEN,xdg-open)
60 if test "x$XDGOPEN" = x; then
61 CUPS_HTMLVIEW="htmlview"
62 else
63 CUPS_HTMLVIEW="$XDGOPEN"
64 fi
65 AC_SUBST(CUPS_HTMLVIEW)
66
67 AC_MSG_CHECKING(for install-sh script)
68 INSTALL="`pwd`/install-sh"
69 AC_SUBST(INSTALL)
70 AC_MSG_RESULT(using $INSTALL)
71
72 if test "x$AR" = x; then
73 AC_MSG_ERROR([Unable to find required library archive command.])
74 fi
75 if test "x$CC" = x; then
76 AC_MSG_ERROR([Unable to find required C compiler command.])
77 fi
78
79 dnl Static library option...
80 INSTALLSTATIC=""
81 AC_ARG_ENABLE(static, [ --enable-static install static libraries])
82
83 if test x$enable_static = xyes; then
84 echo Installing static libraries...
85 INSTALLSTATIC="installstatic"
86 fi
87
88 AC_SUBST(INSTALLSTATIC)
89
90 dnl Check for libraries...
91 AC_SEARCH_LIBS(crypt, crypt)
92 AC_SEARCH_LIBS(getspent, sec gen)
93
94 LIBMALLOC=""
95 AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo build with malloc debug logging])
96
97 if test x$enable_mallinfo = xyes; then
98 SAVELIBS="$LIBS"
99 LIBS=""
100 AC_SEARCH_LIBS(mallinfo, malloc, AC_DEFINE(HAVE_MALLINFO))
101 LIBMALLOC="$LIBS"
102 LIBS="$SAVELIBS"
103 fi
104
105 AC_SUBST(LIBMALLOC)
106
107 dnl Check for libpaper support...
108 AC_ARG_ENABLE(libpaper, [ --enable-libpaper build with libpaper support])
109
110 if test x$enable_libpaper = xyes; then
111 AC_CHECK_LIB(paper,systempapername,
112 AC_DEFINE(HAVE_LIBPAPER)
113 LIBPAPER="-lpaper",
114 LIBPAPER="")
115 else
116 LIBPAPER=""
117 fi
118 AC_SUBST(LIBPAPER)
119
120 dnl Checks for header files.
121 AC_HEADER_STDC
122 AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
123 AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
124 AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
125 AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
126 AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
127 AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
128 AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
129 AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
130 AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
131 AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
132 AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
133 AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
134
135 dnl Checks for string functions.
136 AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
137 if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
138 echo Forcing snprintf emulation for HP-UX.
139 else
140 AC_CHECK_FUNCS(snprintf vsnprintf)
141 fi
142
143 dnl Check for random number functions...
144 AC_CHECK_FUNCS(random mrand48 lrand48)
145
146 dnl Checks for mkstemp and mkstemps functions.
147 AC_CHECK_FUNCS(mkstemp mkstemps)
148
149 dnl Check for geteuid function.
150 AC_CHECK_FUNCS(geteuid)
151
152 dnl Check for vsyslog function.
153 AC_CHECK_FUNCS(vsyslog)
154
155 dnl Checks for signal functions.
156 case "$uname" in
157 Linux | GNU)
158 # Do not use sigset on Linux or GNU HURD
159 ;;
160 *)
161 # Use sigset on other platforms, if available
162 AC_CHECK_FUNCS(sigset)
163 ;;
164 esac
165
166 AC_CHECK_FUNCS(sigaction)
167
168 dnl Checks for wait functions.
169 AC_CHECK_FUNCS(waitpid wait3)
170
171 dnl See if the tm structure has the tm_gmtoff member...
172 AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
173 AC_TRY_COMPILE([#include <time.h>],[struct tm t;
174 int o = t.tm_gmtoff;],
175 AC_MSG_RESULT(yes)
176 AC_DEFINE(HAVE_TM_GMTOFF),
177 AC_MSG_RESULT(no))
178
179 dnl See if we have the removefile(3) function for securely removing files
180 AC_CHECK_FUNCS(removefile)
181
182 dnl See if we have libusb...
183 AC_ARG_ENABLE(libusb, [ --enable-libusb use libusb for USB printing])
184
185 LIBUSB=""
186 AC_SUBST(LIBUSB)
187
188 if test x$enable_libusb = xyes; then
189 check_libusb=yes
190 elif test x$enable_libusb != xno -a $uname != Darwin; then
191 check_libusb=yes
192 else
193 check_libusb=no
194 fi
195
196 if test $check_libusb = yes; then
197 AC_CHECK_LIB(usb, usb_init,[
198 AC_CHECK_HEADER(usb.h,
199 AC_DEFINE(HAVE_USB_H)
200 LIBUSB="-lusb")])
201 fi
202
203 dnl See if we have libwrap for TCP wrappers support...
204 AC_ARG_ENABLE(tcp_wrappers, [ --enable-tcp-wrappers use libwrap for TCP wrappers support])
205
206 LIBWRAP=""
207 AC_SUBST(LIBWRAP)
208
209 if test x$enable_tcp_wrappers = xyes; then
210 AC_CHECK_LIB(wrap, hosts_access,[
211 AC_CHECK_HEADER(tcpd.h,
212 AC_DEFINE(HAVE_TCPD_H)
213 LIBWRAP="-lwrap")])
214 fi
215
216 dnl Flags for "ar" command...
217 case $uname in
218 Darwin* | *BSD*)
219 ARFLAGS="-rcv"
220 ;;
221 *)
222 ARFLAGS="crvs"
223 ;;
224 esac
225
226 AC_SUBST(ARFLAGS)
227
228 dnl Prep libraries specifically for cupsd and backends...
229 BACKLIBS=""
230 CUPSDLIBS=""
231 AC_SUBST(BACKLIBS)
232 AC_SUBST(CUPSDLIBS)
233
234 dnl See if we have POSIX ACL support...
235 SAVELIBS="$LIBS"
236 LIBS=""
237 AC_ARG_ENABLE(acl, [ --enable-acl build with POSIX ACL support])
238 if test "x$enable_acl" != xno; then
239 AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
240 CUPSDLIBS="$CUPSDLIBS $LIBS"
241 fi
242 LIBS="$SAVELIBS"
243
244 dnl Check for DBUS support
245 if test -d /etc/dbus-1; then
246 DBUSDIR="/etc/dbus-1"
247 else
248 DBUSDIR=""
249 fi
250
251 AC_ARG_ENABLE(dbus, [ --enable-dbus build with DBUS support])
252 AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
253 DBUSDIR="$withval")
254
255 DBUS_NOTIFIER=""
256 DBUS_NOTIFIERLIBS=""
257
258 if test "x$enable_dbus" != xno; then
259 AC_PATH_PROG(PKGCONFIG, pkg-config)
260 if test "x$PKGCONFIG" != x; then
261 AC_MSG_CHECKING(for DBUS)
262 if $PKGCONFIG --exists dbus-1; then
263 AC_MSG_RESULT(yes)
264 AC_DEFINE(HAVE_DBUS)
265 CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
266 CUPSDLIBS="$CUPSDLIBS `$PKGCONFIG --libs dbus-1`"
267 AC_CHECK_LIB(dbus-1,
268 dbus_message_iter_init_append,
269 AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND),,
270 `$PKGCONFIG --libs dbus-1`)
271 if $PKGCONFIG --exists glib-2.0 && $PKGCONFIG --exists dbus-glib-1; then
272 DBUS_NOTIFIER="dbus"
273 DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs glib-2.0` `$PKGCONFIG --libs dbus-glib-1` `$PKGCONFIG --libs dbus-1`"
274 CFLAGS="$CFLAGS `$PKGCONFIG --cflags glib-2.0`"
275 fi
276 else
277 AC_MSG_RESULT(no)
278 fi
279 fi
280 fi
281
282 AC_SUBST(DBUSDIR)
283 AC_SUBST(DBUS_NOTIFIER)
284 AC_SUBST(DBUS_NOTIFIERLIBS)
285
286 dnl Extra platform-specific libraries...
287 CUPS_DEFAULT_PRINTOPERATOR_AUTH="@SYSTEM"
288 CUPS_SYSTEM_AUTHKEY=""
289 FONTS="fonts"
290 LEGACY_BACKENDS="parallel scsi"
291
292 case $uname in
293 Darwin*)
294 # FONTS=""
295 LEGACY_BACKENDS=""
296 BACKLIBS="$BACKLIBS -framework IOKit"
297 CUPSDLIBS="$CUPSDLIBS -sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration -weak_framework ApplicationServices"
298 LIBS="-framework SystemConfiguration -framework CoreFoundation $LIBS"
299
300 dnl Check for framework headers...
301 AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
302 AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
303 AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
304
305 dnl Check for the new membership functions in MacOSX 10.4...
306 AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
307 AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
308 AC_CHECK_FUNCS(mbr_uid_to_uuid)
309
310 dnl Check for the vproc_transaction_begin/end stuff...
311 AC_CHECK_FUNCS(vproc_transaction_begin)
312
313 dnl Need <dlfcn.h> header...
314 AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
315
316 dnl Check for notify_post support
317 AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
318 AC_CHECK_FUNCS(notify_post)
319
320 dnl Check for Authorization Services support
321 AC_ARG_WITH(adminkey, [ --with-adminkey set the default SystemAuthKey value],
322 default_adminkey="$withval",
323 default_adminkey="default")
324 AC_ARG_WITH(operkey, [ --with-operkey set the default operator @AUTHKEY value],
325 default_operkey="$withval",
326 default_operkey="default")
327
328 AC_CHECK_HEADER(Security/Authorization.h, [
329 AC_DEFINE(HAVE_AUTHORIZATION_H)
330
331 if test "x$default_adminkey" != xdefault; then
332 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
333 elif grep -q system.print.operator /etc/authorization; then
334 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
335 else
336 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
337 fi
338
339 if test "x$default_operkey" != xdefault; then
340 CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
341 elif grep -q system.print.operator /etc/authorization; then
342 CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
343 else
344 CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
345 fi])
346 AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
347
348 dnl Check for sandbox/Seatbelt support
349 AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
350 ;;
351 esac
352
353 AC_SUBST(CUPS_DEFAULT_PRINTOPERATOR_AUTH)
354 AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTOPERATOR_AUTH, "$CUPS_DEFAULT_PRINTOPERATOR_AUTH")
355 AC_SUBST(CUPS_SYSTEM_AUTHKEY)
356 AC_SUBST(FONTS)
357 AC_SUBST(LEGACY_BACKENDS)
358
359 dnl
360 dnl End of "$Id: cups-common.m4 7900 2008-09-03 13:47:57Z mike $".
361 dnl