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