2 dnl "$Id: cups-common.m4 6964 2007-09-17 21:33: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...
46 if test "$INSTALL" = "$ac_install_sh"; then
47 # Use full path to install-sh script...
48 INSTALL="`pwd`/install-sh -c"
52 AC_PATH_PROG(HTMLDOC,htmldoc)
57 AC_PATH_PROG(RMDIR,rmdir)
59 AC_PATH_PROG(STRIP,strip)
61 if test "x$AR" = x; then
62 AC_MSG_ERROR([Unable to find required library archive command.])
64 if test "x$CC" = x; then
65 AC_MSG_ERROR([Unable to find required C compiler command.])
68 dnl Static library option...
70 AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])
72 if test x$enable_static = xyes; then
73 echo Installing static libraries...
74 INSTALLSTATIC="installstatic"
77 AC_SUBST(INSTALLSTATIC)
79 dnl Check for libraries...
80 AC_SEARCH_LIBS(crypt, crypt)
81 AC_SEARCH_LIBS(getspent, sec gen)
84 AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo turn on malloc debug information, default=no])
86 if test x$enable_mallinfo = xyes; then
87 AC_CHECK_LIB(c,mallinfo,LIBS="$LIBS"; AC_DEFINE(HAVE_MALLINFO),LIBS="$LIBS")
88 if test "$ac_cv_lib_c_mallinfo" = "no"; then
89 AC_CHECK_LIB(malloc,mallinfo,
92 AC_DEFINE(HAVE_MALLINFO),
99 dnl Check for libpaper support...
100 AC_ARG_ENABLE(libpaper, [ --enable-libpaper turn on libpaper support, default=no])
102 if test x$enable_libpaper = xyes; then
103 AC_CHECK_LIB(paper,systempapername,
104 AC_DEFINE(HAVE_LIBPAPER)
112 dnl Checks for header files.
114 AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
115 AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
116 AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
117 AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
118 AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
119 AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
120 AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
121 AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
122 AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
123 AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
124 AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
125 AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
127 dnl Checks for string functions.
128 AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
129 if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
130 echo Forcing snprintf emulation for HP-UX.
132 AC_CHECK_FUNCS(snprintf vsnprintf)
135 dnl Check for random number functions...
136 AC_CHECK_FUNCS(random mrand48 lrand48)
138 dnl Checks for mkstemp and mkstemps functions.
139 AC_CHECK_FUNCS(mkstemp mkstemps)
141 dnl Check for geteuid function.
142 AC_CHECK_FUNCS(geteuid)
144 dnl Check for vsyslog function.
145 AC_CHECK_FUNCS(vsyslog)
147 dnl Checks for signal functions.
150 # Do not use sigset on Linux or GNU HURD
153 # Use sigset on other platforms, if available
154 AC_CHECK_FUNCS(sigset)
158 AC_CHECK_FUNCS(sigaction)
160 dnl Checks for wait functions.
161 AC_CHECK_FUNCS(waitpid wait3)
163 dnl See if the tm structure has the tm_gmtoff member...
164 AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
165 AC_TRY_COMPILE([#include <time.h>],[struct tm t;
166 int o = t.tm_gmtoff;],
168 AC_DEFINE(HAVE_TM_GMTOFF),
171 dnl See if we have the removefile(3) function for securely removing files
172 AC_CHECK_FUNCS(removefile)
174 dnl Flags for "ar" command...
186 dnl Prep libraries specifically for cupsd and backends...
192 dnl See if we have POSIX ACL support...
195 AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
196 CUPSDLIBS="$CUPSDLIBS $LIBS"
199 dnl Check for DBUS support
200 if test -d /etc/dbus-1; then
201 DBUSDIR="/etc/dbus-1"
206 AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
207 AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
210 if test "x$enable_dbus" != xno; then
211 AC_PATH_PROG(PKGCONFIG, pkg-config)
212 if test "x$PKGCONFIG" != x; then
213 AC_MSG_CHECKING(for DBUS)
214 if $PKGCONFIG --exists dbus-1; then
217 CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
218 CUPSDLIBS="$CUPSDLIBS `$PKGCONFIG --libs dbus-1`"
220 dbus_message_iter_init_append,
221 AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
230 dnl Extra platform-specific libraries...
231 CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
232 CUPS_SYSTEM_AUTHKEY=""
234 LEGACY_BACKENDS="parallel scsi"
240 BACKLIBS="$BACKLIBS -framework IOKit"
241 CUPSDLIBS="$CUPSDLIBS -sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration"
242 LIBS="-framework SystemConfiguration -framework CoreFoundation $LIBS"
244 dnl Check for framework headers...
245 AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
246 AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
247 AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
249 dnl Check for the new membership functions in MacOSX 10.4...
250 AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
251 AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
252 AC_CHECK_FUNCS(mbr_uid_to_uuid)
254 dnl Need <dlfcn.h> header...
255 AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
257 dnl Check for notify_post support
258 AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
259 AC_CHECK_FUNCS(notify_post)
261 dnl Check for Authorization Services support
262 AC_CHECK_HEADER(Security/Authorization.h, [
263 AC_DEFINE(HAVE_AUTHORIZATION_H)
264 CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
265 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"])
266 AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
268 dnl Check for sandbox/Seatbelt support
269 AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
273 AC_SUBST(CUPS_DEFAULT_PRINTADMIN_AUTH)
274 AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTADMIN_AUTH, "$CUPS_DEFAULT_PRINTADMIN_AUTH")
275 AC_SUBST(CUPS_SYSTEM_AUTHKEY)
277 AC_SUBST(LEGACY_BACKENDS)
280 dnl End of "$Id: cups-common.m4 6964 2007-09-17 21:33:57Z mike $".