]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-common.m4
Update documentation and dependencies for 1.5b1.
[thirdparty/cups.git] / config-scripts / cups-common.m4
CommitLineData
74456259 1dnl
c9d3f842 2dnl "$Id$"
74456259 3dnl
fa7e8544 4dnl Common configuration stuff for CUPS.
74456259 5dnl
7713cfe1 6dnl Copyright 2007-2011 by Apple Inc.
a10618de 7dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
74456259 8dnl
9dnl These coded instructions, statements, and computer programs are the
4e8d321f 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/".
74456259 14dnl
15
3b5f686d 16dnl We need at least autoconf 2.60...
17AC_PREREQ(2.60)
9aa1f763 18
19dnl Set the name of the config header file...
74456259 20AC_CONFIG_HEADER(config.h)
21
fbe66f19 22dnl Version number information...
a1a2e89a 23CUPS_VERSION="1.5b1"
c6881512 24CUPS_REVISION=""
a1a2e89a 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
7ab3a94b 28CUPS_BUILD="cups-$CUPS_VERSION"
29
30AC_ARG_WITH(cups_build, [ --with-cups-build set "cups-config --build" string ],
31 CUPS_BUILD="$withval")
c6881512 32
18dcf583 33AC_SUBST(CUPS_VERSION)
c6881512 34AC_SUBST(CUPS_REVISION)
7ab3a94b 35AC_SUBST(CUPS_BUILD)
c6881512 36AC_DEFINE_UNQUOTED(CUPS_SVERSION, "CUPS v$CUPS_VERSION$CUPS_REVISION")
37AC_DEFINE_UNQUOTED(CUPS_MINIMAL, "CUPS/$CUPS_VERSION$CUPS_REVISION")
18dcf583 38
74456259 39dnl Default compiler flags...
40CFLAGS="${CFLAGS:=}"
9aa1f763 41CPPFLAGS="${CPPFLAGS:=}"
4bc98872 42CXXFLAGS="${CXXFLAGS:=}"
74456259 43LDFLAGS="${LDFLAGS:=}"
44
45dnl Checks for programs...
46AC_PROG_AWK
47AC_PROG_CC
74456259 48AC_PROG_CPP
4bc98872 49AC_PROG_CXX
74456259 50AC_PROG_RANLIB
51AC_PATH_PROG(AR,ar)
0ea4fbcc 52AC_PATH_PROG(CHMOD,chmod)
74456259 53AC_PATH_PROG(HTMLDOC,htmldoc)
cd18b026 54AC_PATH_PROG(LD,ld)
2abcdcaa 55AC_PATH_PROG(LN,ln)
74456259 56AC_PATH_PROG(MV,mv)
74456259 57AC_PATH_PROG(RM,rm)
1e90d5a2 58AC_PATH_PROG(RMDIR,rmdir)
74456259 59AC_PATH_PROG(SED,sed)
ea101cc4 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)
74456259 67
e545002d 68AC_MSG_CHECKING(for install-sh script)
7bbfe47b 69INSTALL="`pwd`/install-sh"
e545002d 70AC_SUBST(INSTALL)
71AC_MSG_RESULT(using $INSTALL)
72
89e75dbd 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
89e75dbd 79
be72435b 80dnl Static library option...
81INSTALLSTATIC=""
275bcb9b 82AC_ARG_ENABLE(static, [ --enable-static install static libraries])
be72435b 83
6dacf3fc 84if test x$enable_static = xyes; then
85 echo Installing static libraries...
be72435b 86 INSTALLSTATIC="installstatic"
87fi
88
89AC_SUBST(INSTALLSTATIC)
359774f6 90
7713cfe1 91dnl Check for pkg-config, which is used for some other tests later on...
92AC_PATH_PROG(PKGCONFIG, pkg-config)
93
74456259 94dnl Check for libraries...
359774f6 95AC_SEARCH_LIBS(crypt, crypt)
96AC_SEARCH_LIBS(getspent, sec gen)
74456259 97
98LIBMALLOC=""
275bcb9b 99AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo build with malloc debug logging])
1fc6b5c4 100
101if test x$enable_mallinfo = xyes; then
bdb5a5c3 102 SAVELIBS="$LIBS"
103 LIBS=""
104 AC_SEARCH_LIBS(mallinfo, malloc, AC_DEFINE(HAVE_MALLINFO))
105 LIBMALLOC="$LIBS"
106 LIBS="$SAVELIBS"
74456259 107fi
1fc6b5c4 108
74456259 109AC_SUBST(LIBMALLOC)
110
b4f2ed46 111dnl Check for libpaper support...
275bcb9b 112AC_ARG_ENABLE(libpaper, [ --enable-libpaper build with libpaper support])
b4f2ed46 113
114if test x$enable_libpaper = xyes; then
115 AC_CHECK_LIB(paper,systempapername,
116 AC_DEFINE(HAVE_LIBPAPER)
117 LIBPAPER="-lpaper",
118 LIBPAPER="")
119else
120 LIBPAPER=""
121fi
122AC_SUBST(LIBPAPER)
123
74456259 124dnl Checks for header files.
125AC_HEADER_STDC
74456259 126AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
9e55d0dc 127AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
74456259 128AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
129AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
130AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
131AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
7ed5d5f2 132AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
74456259 133AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
134AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
75cd763e 135AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
21cc7184 136AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
fc50bd87 137AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
74456259 138
b74d8197 139dnl Checks for iconv.h and iconv_open
140AC_CHECK_HEADER(iconv.h,
141 SAVELIBS="$LIBS"
142 LIBS=""
143 AC_SEARCH_LIBS(iconv_open,iconv,
144 AC_DEFINE(HAVE_ICONV_H)
145 SAVELIBS="$SAVELIBS $LIBS")
146 LIBS="$SAVELIBS")
147
b9738d7c 148dnl Checks for statfs and its many headers...
149AC_CHECK_HEADER(sys/mount.h,AC_DEFINE(HAVE_SYS_MOUNT_H))
150AC_CHECK_HEADER(sys/statfs.h,AC_DEFINE(HAVE_SYS_STATFS_H))
151AC_CHECK_HEADER(sys/statvfs.h,AC_DEFINE(HAVE_SYS_STATVFS_H))
152AC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H))
153AC_CHECK_FUNCS(statfs statvfs)
154
74456259 155dnl Checks for string functions.
def978d5 156AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
74456259 157if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
158 echo Forcing snprintf emulation for HP-UX.
159else
160 AC_CHECK_FUNCS(snprintf vsnprintf)
161fi
162
7cd15c56 163dnl Check for random number functions...
0d34d098 164AC_CHECK_FUNCS(random lrand48 arc4random)
7cd15c56 165
6bb5a528 166dnl Check for geteuid function.
167AC_CHECK_FUNCS(geteuid)
168
169dnl Check for vsyslog function.
74456259 170AC_CHECK_FUNCS(vsyslog)
171
172dnl Checks for signal functions.
5443b906 173case "$uname" in
174 Linux | GNU)
175 # Do not use sigset on Linux or GNU HURD
176 ;;
177 *)
178 # Use sigset on other platforms, if available
179 AC_CHECK_FUNCS(sigset)
180 ;;
181esac
74456259 182
183AC_CHECK_FUNCS(sigaction)
184
185dnl Checks for wait functions.
a3e95b7e 186AC_CHECK_FUNCS(waitpid wait3)
74456259 187
188dnl See if the tm structure has the tm_gmtoff member...
189AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
190AC_TRY_COMPILE([#include <time.h>],[struct tm t;
191 int o = t.tm_gmtoff;],
192 AC_MSG_RESULT(yes)
193 AC_DEFINE(HAVE_TM_GMTOFF),
194 AC_MSG_RESULT(no))
195
4c7343ab 196dnl See if the stat structure has the st_gen member...
197AC_MSG_CHECKING(for st_gen member in stat structure)
198AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat t;
199 int o = t.st_gen;],
200 AC_MSG_RESULT(yes)
201 AC_DEFINE(HAVE_ST_GEN),
202 AC_MSG_RESULT(no))
203
a3e95b7e 204dnl See if we have the removefile(3) function for securely removing files
205AC_CHECK_FUNCS(removefile)
206
bdb5a5c3 207dnl See if we have libusb...
275bcb9b 208AC_ARG_ENABLE(libusb, [ --enable-libusb use libusb for USB printing])
bdb5a5c3 209
210LIBUSB=""
211AC_SUBST(LIBUSB)
212
d11f579d 213if test x$enable_libusb = xyes; then
214 check_libusb=yes
215elif test x$enable_libusb != xno -a $uname != Darwin; then
216 check_libusb=yes
217else
218 check_libusb=no
219fi
220
221if test $check_libusb = yes; then
2101ba5e 222 AC_CHECK_LIB(usb, usb_get_string_simple,[
bdb5a5c3 223 AC_CHECK_HEADER(usb.h,
224 AC_DEFINE(HAVE_USB_H)
225 LIBUSB="-lusb")])
226fi
227
5faeb470 228dnl See if we have libwrap for TCP wrappers support...
275bcb9b 229AC_ARG_ENABLE(tcp_wrappers, [ --enable-tcp-wrappers use libwrap for TCP wrappers support])
5faeb470 230
231LIBWRAP=""
232AC_SUBST(LIBWRAP)
233
234if test x$enable_tcp_wrappers = xyes; then
235 AC_CHECK_LIB(wrap, hosts_access,[
236 AC_CHECK_HEADER(tcpd.h,
237 AC_DEFINE(HAVE_TCPD_H)
238 LIBWRAP="-lwrap")])
239fi
240
74456259 241dnl Flags for "ar" command...
242case $uname in
243 Darwin* | *BSD*)
244 ARFLAGS="-rcv"
245 ;;
246 *)
247 ARFLAGS="crvs"
248 ;;
249esac
250
251AC_SUBST(ARFLAGS)
252
fbe66f19 253dnl Prep libraries specifically for cupsd and backends...
8081be77 254BACKLIBS=""
6875feac 255SERVERLIBS=""
fbe66f19 256AC_SUBST(BACKLIBS)
6875feac 257AC_SUBST(SERVERLIBS)
fbe66f19 258
259dnl See if we have POSIX ACL support...
260SAVELIBS="$LIBS"
261LIBS=""
275bcb9b 262AC_ARG_ENABLE(acl, [ --enable-acl build with POSIX ACL support])
8f033131 263if test "x$enable_acl" != xno; then
264 AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
6875feac 265 SERVERLIBS="$SERVERLIBS $LIBS"
8f033131 266fi
fbe66f19 267LIBS="$SAVELIBS"
8081be77 268
fbe66f19 269dnl Check for DBUS support
16a649cd 270if test -d /etc/dbus-1; then
271 DBUSDIR="/etc/dbus-1"
272else
273 DBUSDIR=""
274fi
275
275bcb9b 276AC_ARG_ENABLE(dbus, [ --enable-dbus build with DBUS support])
fbe66f19 277AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
16a649cd 278 DBUSDIR="$withval")
fbe66f19 279
445c9aae 280DBUS_NOTIFIER=""
281DBUS_NOTIFIERLIBS=""
282
7713cfe1 283if test "x$enable_dbus" != xno -a "x$PKGCONFIG" != x; then
284 AC_MSG_CHECKING(for DBUS)
285 if $PKGCONFIG --exists dbus-1; then
286 AC_MSG_RESULT(yes)
287 AC_DEFINE(HAVE_DBUS)
288 CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
289 SERVERLIBS="$SERVERLIBS `$PKGCONFIG --libs dbus-1`"
290 DBUS_NOTIFIER="dbus"
291 DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs dbus-1`"
a69ec225 292 SAVELIBS="$LIBS"
293 LIBS="$LIBS $DBUS_NOTIFIERLIBS"
294 AC_CHECK_FUNC(dbus_message_iter_init_append,
295 AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
296 LIBS="$SAVELIBS"
7713cfe1 297 else
298 AC_MSG_RESULT(no)
fbe66f19 299 fi
300fi
046285fd 301
fbe66f19 302AC_SUBST(DBUSDIR)
445c9aae 303AC_SUBST(DBUS_NOTIFIER)
304AC_SUBST(DBUS_NOTIFIERLIBS)
fbe66f19 305
306dnl Extra platform-specific libraries...
b07da210 307CUPS_DEFAULT_PRINTOPERATOR_AUTH="@SYSTEM"
fbe66f19 308CUPS_SYSTEM_AUTHKEY=""
959a6a28 309INSTALLXPC=""
a28dbbb0 310LEGACY_BACKENDS="parallel"
a65afd8b 311
a5108c0c 312case $uname in
313 Darwin*)
a65afd8b 314 LEGACY_BACKENDS=""
fbe66f19 315 BACKLIBS="$BACKLIBS -framework IOKit"
6875feac 316 SERVERLIBS="$SERVERLIBS -framework IOKit -weak_framework ApplicationServices"
2256cc12 317 LIBS="-framework SystemConfiguration -framework CoreFoundation -framework Security $LIBS"
42f22b2f 318
42f22b2f 319 dnl Check for framework headers...
fa7e8544 320 AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h,AC_DEFINE(HAVE_APPLICATIONSERVICES_H))
42f22b2f 321 AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
322 AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
323 AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
aa74279d 324 AC_CHECK_HEADER(IOKit/pwr_mgt/IOPMLibPrivate.h,AC_DEFINE(HAVE_IOKIT_PWR_MGT_IOPMLIBPRIVATE_H))
42f22b2f 325
fa7e8544 326 dnl Check for dynamic store function...
327 AC_CHECK_FUNCS(SCDynamicStoreCopyComputerName)
328
86db36e4 329 dnl Check for new ColorSync APIs...
330 SAVELIBS="$LIBS"
331 LIBS="$LIBS -framework ApplicationServices"
332 AC_CHECK_FUNCS(ColorSyncRegisterDevice)
333 LIBS="$SAVELIBS"
334
68651a00 335 dnl Check for the new membership functions in MacOSX 10.4...
42f22b2f 336 AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
68651a00 337 AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
42f22b2f 338 AC_CHECK_FUNCS(mbr_uid_to_uuid)
b89216d0 339
6e052688 340 dnl Check for the vproc_transaction_begin/end stuff...
341 AC_CHECK_FUNCS(vproc_transaction_begin)
342
bb3ff448 343 dnl Need <dlfcn.h> header...
344 AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
345
b89216d0 346 dnl Check for notify_post support
347 AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
348 AC_CHECK_FUNCS(notify_post)
753db4fd 349
350 dnl Check for Authorization Services support
acf88fef 351 AC_ARG_WITH(adminkey, [ --with-adminkey set the default SystemAuthKey value],
352 default_adminkey="$withval",
353 default_adminkey="default")
354 AC_ARG_WITH(operkey, [ --with-operkey set the default operator @AUTHKEY value],
355 default_operkey="$withval",
356 default_operkey="default")
959a6a28 357
753db4fd 358 AC_CHECK_HEADER(Security/Authorization.h, [
359 AC_DEFINE(HAVE_AUTHORIZATION_H)
acf88fef 360
361 if test "x$default_adminkey" != xdefault; then
362 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
363 elif grep -q system.print.operator /etc/authorization; then
364 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
7908f39f 365 else
acf88fef 366 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
367 fi
368
369 if test "x$default_operkey" != xdefault; then
b07da210 370 CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
acf88fef 371 elif grep -q system.print.operator /etc/authorization; then
b07da210 372 CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
acf88fef 373 else
b07da210 374 CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
7908f39f 375 fi])
753db4fd 376 AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
fc988006 377
378 dnl Check for sandbox/Seatbelt support
aceca83f 379 if test $uversion -ge 100; then
380 AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
381 fi
959a6a28 382
383 dnl Check for XPC support
384 AC_CHECK_HEADER(xpc/xpc.h,
385 AC_DEFINE(HAVE_XPC)
386 INSTALLXPC="install-xpc")
a5108c0c 387 ;;
a5108c0c 388esac
389
b07da210 390AC_SUBST(CUPS_DEFAULT_PRINTOPERATOR_AUTH)
391AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTOPERATOR_AUTH, "$CUPS_DEFAULT_PRINTOPERATOR_AUTH")
753db4fd 392AC_SUBST(CUPS_SYSTEM_AUTHKEY)
959a6a28 393AC_SUBST(INSTALLXPC)
fbe66f19 394AC_SUBST(LEGACY_BACKENDS)
1d9595ab 395
fa7e8544 396dnl Check for build components
397COMPONENTS="all"
398
399AC_ARG_WITH(components, [ --with-components set components to build:
400 - "all" (default) builds everything
401 - "core" builds libcups and ipptool],
402 COMPONENTS="$withval")
403
404case "$COMPONENTS" in
405 all)
406 BUILDDIRS="filter backend berkeley cgi-bin driver monitor notifier ppdc scheduler systemv conf data locale man doc examples templates"
407 ;;
408
409 core)
410 BUILDDIRS="data locale"
411 ;;
412
413 *)
414 AC_MSG_ERROR([Bad build component "$COMPONENT" specified!])
415 ;;
416esac
417
418AC_SUBST(BUILDDIRS)
419
74456259 420dnl
c9d3f842 421dnl End of "$Id$".
74456259 422dnl