2 dnl "$Id: cups-common.m4 7900 2008-09-03 13:47:57Z mike $"
4 dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
6 dnl Copyright 2007-2008 by Apple Inc.
7 dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
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/".
16 dnl We need at least autoconf 2.60...
19 dnl Set the name of the config header file...
20 AC_CONFIG_HEADER(config.h)
22 dnl Version number information...
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'`"
29 AC_SUBST(CUPS_VERSION)
30 AC_SUBST(CUPS_REVISION)
31 AC_DEFINE_UNQUOTED(CUPS_SVERSION, "CUPS v$CUPS_VERSION$CUPS_REVISION")
32 AC_DEFINE_UNQUOTED(CUPS_MINIMAL, "CUPS/$CUPS_VERSION$CUPS_REVISION")
34 dnl Default compiler flags...
36 CPPFLAGS="${CPPFLAGS:=}"
37 CXXFLAGS="${CXXFLAGS:=}"
38 LDFLAGS="${LDFLAGS:=}"
40 dnl Checks for programs...
47 AC_PATH_PROG(HTMLDOC,htmldoc)
52 AC_PATH_PROG(RMDIR,rmdir)
54 AC_PATH_PROG(XDGOPEN,xdg-open)
55 if test "x$XDGOPEN" = x; then
56 CUPS_HTMLVIEW="htmlview"
58 CUPS_HTMLVIEW="$XDGOPEN"
60 AC_SUBST(CUPS_HTMLVIEW)
62 AC_MSG_CHECKING(for install-sh script)
63 INSTALL="`pwd`/install-sh -c"
65 AC_MSG_RESULT(using $INSTALL)
67 if test "x$AR" = x; then
68 AC_MSG_ERROR([Unable to find required library archive command.])
70 if test "x$CC" = x; then
71 AC_MSG_ERROR([Unable to find required C compiler command.])
74 dnl Static library option...
76 AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])
78 if test x$enable_static = xyes; then
79 echo Installing static libraries...
80 INSTALLSTATIC="installstatic"
83 AC_SUBST(INSTALLSTATIC)
85 dnl Check for libraries...
86 AC_SEARCH_LIBS(crypt, crypt)
87 AC_SEARCH_LIBS(getspent, sec gen)
90 AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo turn on malloc debug information, default=no])
92 if test x$enable_mallinfo = xyes; then
95 AC_SEARCH_LIBS(mallinfo, malloc, AC_DEFINE(HAVE_MALLINFO))
102 dnl Check for libpaper support...
103 AC_ARG_ENABLE(libpaper, [ --enable-libpaper turn on libpaper support, default=no])
105 if test x$enable_libpaper = xyes; then
106 AC_CHECK_LIB(paper,systempapername,
107 AC_DEFINE(HAVE_LIBPAPER)
115 dnl Checks for header files.
117 AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
118 AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
119 AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
120 AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
121 AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
122 AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
123 AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
124 AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
125 AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
126 AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
127 AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
128 AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
130 dnl Checks for string functions.
131 AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
132 if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
133 echo Forcing snprintf emulation for HP-UX.
135 AC_CHECK_FUNCS(snprintf vsnprintf)
138 dnl Check for random number functions...
139 AC_CHECK_FUNCS(random mrand48 lrand48)
141 dnl Checks for mkstemp and mkstemps functions.
142 AC_CHECK_FUNCS(mkstemp mkstemps)
144 dnl Check for geteuid function.
145 AC_CHECK_FUNCS(geteuid)
147 dnl Check for vsyslog function.
148 AC_CHECK_FUNCS(vsyslog)
150 dnl Checks for signal functions.
153 # Do not use sigset on Linux or GNU HURD
156 # Use sigset on other platforms, if available
157 AC_CHECK_FUNCS(sigset)
161 AC_CHECK_FUNCS(sigaction)
163 dnl Checks for wait functions.
164 AC_CHECK_FUNCS(waitpid wait3)
166 dnl See if the tm structure has the tm_gmtoff member...
167 AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
168 AC_TRY_COMPILE([#include <time.h>],[struct tm t;
169 int o = t.tm_gmtoff;],
171 AC_DEFINE(HAVE_TM_GMTOFF),
174 dnl See if we have the removefile(3) function for securely removing files
175 AC_CHECK_FUNCS(removefile)
177 dnl See if we have libusb...
178 AC_ARG_ENABLE(libusb, [ --enable-libusb use libusb for USB printing, default=auto])
183 if test x$enable_libusb = xyes; then
185 elif test x$enable_libusb != xno -a $uname != Darwin; then
191 if test $check_libusb = yes; then
192 AC_CHECK_LIB(usb, usb_init,[
193 AC_CHECK_HEADER(usb.h,
194 AC_DEFINE(HAVE_USB_H)
198 dnl See if we have libwrap for TCP wrappers support...
199 AC_ARG_ENABLE(tcp_wrappers, [ --enable-tcp-wrappers use libwrap for TCP wrappers support, default=no])
204 if test x$enable_tcp_wrappers = xyes; then
205 AC_CHECK_LIB(wrap, hosts_access,[
206 AC_CHECK_HEADER(tcpd.h,
207 AC_DEFINE(HAVE_TCPD_H)
211 dnl Flags for "ar" command...
223 dnl Prep libraries specifically for cupsd and backends...
229 dnl See if we have POSIX ACL support...
232 AC_ARG_ENABLE(acl, [ --enable-acl enable POSIX ACL support, default=auto])
233 if test "x$enable_acl" != xno; then
234 AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
235 CUPSDLIBS="$CUPSDLIBS $LIBS"
239 dnl Check for DBUS support
240 if test -d /etc/dbus-1; then
241 DBUSDIR="/etc/dbus-1"
246 AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
247 AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
253 if test "x$enable_dbus" != xno; then
254 AC_PATH_PROG(PKGCONFIG, pkg-config)
255 if test "x$PKGCONFIG" != x; then
256 AC_MSG_CHECKING(for DBUS)
257 if $PKGCONFIG --exists dbus-1; then
260 CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
261 CUPSDLIBS="$CUPSDLIBS `$PKGCONFIG --libs dbus-1`"
263 dbus_message_iter_init_append,
264 AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND),,
265 `$PKGCONFIG --libs dbus-1`)
266 if $PKGCONFIG --exists glib-2.0 && $PKGCONFIG --exists dbus-glib-1; then
268 DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs glib-2.0` `$PKGCONFIG --libs dbus-glib-1` `$PKGCONFIG --libs dbus-1`"
269 CFLAGS="$CFLAGS `$PKGCONFIG --cflags glib-2.0`"
278 AC_SUBST(DBUS_NOTIFIER)
279 AC_SUBST(DBUS_NOTIFIERLIBS)
281 dnl Extra platform-specific libraries...
282 CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
283 CUPS_SYSTEM_AUTHKEY=""
285 LEGACY_BACKENDS="parallel scsi"
291 BACKLIBS="$BACKLIBS -framework IOKit"
292 CUPSDLIBS="$CUPSDLIBS -sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration -weak_framework ApplicationServices"
293 LIBS="-framework SystemConfiguration -framework CoreFoundation $LIBS"
295 dnl Check for framework headers...
296 AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
297 AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
298 AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
300 dnl Check for the new membership functions in MacOSX 10.4...
301 AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
302 AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
303 AC_CHECK_FUNCS(mbr_uid_to_uuid)
305 dnl Need <dlfcn.h> header...
306 AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
308 dnl Check for notify_post support
309 AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
310 AC_CHECK_FUNCS(notify_post)
312 dnl Check for Authorization Services support
313 AC_ARG_WITH(adminkey, [ --with-adminkey set the default SystemAuthKey value],
314 default_adminkey="$withval",
315 default_adminkey="default")
316 AC_ARG_WITH(operkey, [ --with-operkey set the default operator @AUTHKEY value],
317 default_operkey="$withval",
318 default_operkey="default")
320 AC_CHECK_HEADER(Security/Authorization.h, [
321 AC_DEFINE(HAVE_AUTHORIZATION_H)
323 if test "x$default_adminkey" != xdefault; then
324 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
325 elif grep -q system.print.operator /etc/authorization; then
326 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
328 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
331 if test "x$default_operkey" != xdefault; then
332 CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
333 elif grep -q system.print.operator /etc/authorization; then
334 CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
336 CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
338 AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
340 dnl Check for sandbox/Seatbelt support
341 AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
345 AC_SUBST(CUPS_DEFAULT_PRINTADMIN_AUTH)
346 AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTADMIN_AUTH, "$CUPS_DEFAULT_PRINTADMIN_AUTH")
347 AC_SUBST(CUPS_SYSTEM_AUTHKEY)
349 AC_SUBST(LEGACY_BACKENDS)
352 dnl End of "$Id: cups-common.m4 7900 2008-09-03 13:47:57Z mike $".