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