]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-common.m4
Remove ".orig" files that somehow got into the repo.
[thirdparty/cups.git] / config-scripts / cups-common.m4
CommitLineData
ef416fc2 1dnl
18ecb428 2dnl "$Id: cups-common.m4 8781 2009-08-28 17:34:54Z mike $"
ef416fc2 3dnl
6d2f911b 4dnl Common configuration stuff for CUPS.
ef416fc2 5dnl
82cc1f9a 6dnl Copyright 2007-2012 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...
a4845881 23CUPS_VERSION="1.6svn"
ecdc0628 24CUPS_REVISION=""
a4845881
MS
25if 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'`"
27fi
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)
82cc1f9a 53AC_PATH_PROG(GZIP,gzip)
ef416fc2 54AC_PATH_PROG(HTMLDOC,htmldoc)
bd7854cb 55AC_PATH_PROG(LD,ld)
ef416fc2 56AC_PATH_PROG(LN,ln)
57AC_PATH_PROG(MV,mv)
58AC_PATH_PROG(RM,rm)
e1d6a774 59AC_PATH_PROG(RMDIR,rmdir)
ef416fc2 60AC_PATH_PROG(SED,sed)
ee571f26
MS
61AC_PATH_PROG(XDGOPEN,xdg-open)
62if test "x$XDGOPEN" = x; then
63 CUPS_HTMLVIEW="htmlview"
64else
65 CUPS_HTMLVIEW="$XDGOPEN"
66fi
67AC_SUBST(CUPS_HTMLVIEW)
839a51c8
MS
68
69AC_MSG_CHECKING(for install-sh script)
e07d4801 70INSTALL="`pwd`/install-sh"
839a51c8
MS
71AC_SUBST(INSTALL)
72AC_MSG_RESULT(using $INSTALL)
ef416fc2 73
74if test "x$AR" = x; then
75 AC_MSG_ERROR([Unable to find required library archive command.])
76fi
77if test "x$CC" = x; then
78 AC_MSG_ERROR([Unable to find required C compiler command.])
79fi
ef416fc2 80
923edb68 81dnl Static library option...
82INSTALLSTATIC=""
bf3816c7 83AC_ARG_ENABLE(static, [ --enable-static install static libraries])
923edb68 84
d6ae789d 85if test x$enable_static = xyes; then
86 echo Installing static libraries...
923edb68 87 INSTALLSTATIC="installstatic"
88fi
89
90AC_SUBST(INSTALLSTATIC)
ef416fc2 91
0268488e
MS
92dnl Check for pkg-config, which is used for some other tests later on...
93AC_PATH_PROG(PKGCONFIG, pkg-config)
94
ef416fc2 95dnl Check for libraries...
83e08001 96AC_SEARCH_LIBS(fmod, m)
ef416fc2 97AC_SEARCH_LIBS(crypt, crypt)
98AC_SEARCH_LIBS(getspent, sec gen)
99
100LIBMALLOC=""
bf3816c7 101AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo build with malloc debug logging])
ef416fc2 102
103if test x$enable_mallinfo = xyes; then
75bd9771
MS
104 SAVELIBS="$LIBS"
105 LIBS=""
106 AC_SEARCH_LIBS(mallinfo, malloc, AC_DEFINE(HAVE_MALLINFO))
107 LIBMALLOC="$LIBS"
108 LIBS="$SAVELIBS"
ef416fc2 109fi
110
111AC_SUBST(LIBMALLOC)
112
113dnl Check for libpaper support...
bf3816c7 114AC_ARG_ENABLE(libpaper, [ --enable-libpaper build with libpaper support])
ef416fc2 115
116if test x$enable_libpaper = xyes; then
117 AC_CHECK_LIB(paper,systempapername,
118 AC_DEFINE(HAVE_LIBPAPER)
119 LIBPAPER="-lpaper",
120 LIBPAPER="")
121else
122 LIBPAPER=""
123fi
124AC_SUBST(LIBPAPER)
125
126dnl Checks for header files.
127AC_HEADER_STDC
a4845881 128AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
ef416fc2 129AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
130AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
131AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
132AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
133AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
134AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
135AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
136AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
137AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
db1f069b 138AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
bc44d920 139AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
2abf387c 140AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
ef416fc2 141
cc754834
MS
142dnl Checks for iconv.h and iconv_open
143AC_CHECK_HEADER(iconv.h,
144 SAVELIBS="$LIBS"
145 LIBS=""
146 AC_SEARCH_LIBS(iconv_open,iconv,
147 AC_DEFINE(HAVE_ICONV_H)
148 SAVELIBS="$SAVELIBS $LIBS")
149 LIBS="$SAVELIBS")
150
12f89d24
MS
151dnl Checks for Mini-XML (www.minixml.org)...
152LIBMXML=""
153AC_CHECK_HEADER(mxml.h,
154 SAVELIBS="$LIBS"
155 AC_SEARCH_LIBS(mmxlNewElement,mxml,
156 AC_DEFINE(HAVE_MXML_H)
157 LIBMXML="-lmxml")
158 LIBS="$SAVELIBS")
159AC_SUBST(LIBMXML)
160
7cf5915e
MS
161dnl Checks for statfs and its many headers...
162AC_CHECK_HEADER(sys/mount.h,AC_DEFINE(HAVE_SYS_MOUNT_H))
163AC_CHECK_HEADER(sys/statfs.h,AC_DEFINE(HAVE_SYS_STATFS_H))
164AC_CHECK_HEADER(sys/statvfs.h,AC_DEFINE(HAVE_SYS_STATVFS_H))
165AC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H))
166AC_CHECK_FUNCS(statfs statvfs)
167
ef416fc2 168dnl Checks for string functions.
88f9aafc 169AC_CHECK_FUNCS(strdup strlcat strlcpy)
ef416fc2 170if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
171 echo Forcing snprintf emulation for HP-UX.
172else
173 AC_CHECK_FUNCS(snprintf vsnprintf)
174fi
175
ac884b6a 176dnl Check for random number functions...
41681883 177AC_CHECK_FUNCS(random lrand48 arc4random)
ac884b6a 178
ef416fc2 179dnl Check for geteuid function.
180AC_CHECK_FUNCS(geteuid)
181
88f9aafc
MS
182dnl Check for setpgid function.
183AC_CHECK_FUNCS(setpgid)
184
ef416fc2 185dnl Check for vsyslog function.
186AC_CHECK_FUNCS(vsyslog)
187
188dnl Checks for signal functions.
189case "$uname" in
190 Linux | GNU)
191 # Do not use sigset on Linux or GNU HURD
192 ;;
193 *)
194 # Use sigset on other platforms, if available
195 AC_CHECK_FUNCS(sigset)
196 ;;
197esac
198
199AC_CHECK_FUNCS(sigaction)
200
201dnl Checks for wait functions.
cc0d019f 202AC_CHECK_FUNCS(waitpid wait3)
ef416fc2 203
204dnl See if the tm structure has the tm_gmtoff member...
205AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
206AC_TRY_COMPILE([#include <time.h>],[struct tm t;
207 int o = t.tm_gmtoff;],
208 AC_MSG_RESULT(yes)
209 AC_DEFINE(HAVE_TM_GMTOFF),
210 AC_MSG_RESULT(no))
211
c7017ecc
MS
212dnl See if the stat structure has the st_gen member...
213AC_MSG_CHECKING(for st_gen member in stat structure)
214AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat t;
215 int o = t.st_gen;],
216 AC_MSG_RESULT(yes)
217 AC_DEFINE(HAVE_ST_GEN),
218 AC_MSG_RESULT(no))
219
cc0d019f
MS
220dnl See if we have the removefile(3) function for securely removing files
221AC_CHECK_FUNCS(removefile)
222
75bd9771 223dnl See if we have libusb...
bf3816c7 224AC_ARG_ENABLE(libusb, [ --enable-libusb use libusb for USB printing])
75bd9771
MS
225
226LIBUSB=""
227AC_SUBST(LIBUSB)
228
3e7fe0ca
MS
229if test "x$PKGCONFIG" != x; then
230 if test x$enable_libusb = xyes -o $uname != Darwin; then
231 AC_MSG_CHECKING(for libusb-1.0)
232 if $PKGCONFIG --exists libusb-1.0; then
233 AC_MSG_RESULT(yes)
234 AC_DEFINE(HAVE_LIBUSB)
235 CFLAGS="$CFLAGS `$PKGCONFIG --cflags libusb-1.0`"
236 LIBUSB="`$PKGCONFIG --libs libusb-1.0`"
237 else
238 AC_MSG_RESULT(no)
239 fi
12f89d24 240 fi
82cc1f9a 241elif test x$enable_libusb = xyes; then
3e7fe0ca 242 AC_MSG_ERROR(Need pkg-config to enable libusb support.)
75bd9771
MS
243fi
244
749b1e90 245dnl See if we have libwrap for TCP wrappers support...
bf3816c7 246AC_ARG_ENABLE(tcp_wrappers, [ --enable-tcp-wrappers use libwrap for TCP wrappers support])
749b1e90
MS
247
248LIBWRAP=""
249AC_SUBST(LIBWRAP)
250
251if test x$enable_tcp_wrappers = xyes; then
252 AC_CHECK_LIB(wrap, hosts_access,[
253 AC_CHECK_HEADER(tcpd.h,
254 AC_DEFINE(HAVE_TCPD_H)
255 LIBWRAP="-lwrap")])
256fi
257
a4845881 258dnl ZLIB
82cc1f9a 259INSTALL_GZIP=""
a4845881
MS
260LIBZ=""
261AC_CHECK_HEADER(zlib.h,
262 AC_CHECK_LIB(z, gzgets,
263 AC_DEFINE(HAVE_LIBZ)
264 LIBZ="-lz"
82cc1f9a
MS
265 LIBS="$LIBS -lz"
266 if test "x$GZIP" != z; then
267 INSTALL_GZIP="-z"
268 fi))
269AC_SUBST(INSTALL_GZIP)
a4845881
MS
270AC_SUBST(LIBZ)
271
ef416fc2 272dnl Flags for "ar" command...
273case $uname in
274 Darwin* | *BSD*)
275 ARFLAGS="-rcv"
276 ;;
277 *)
278 ARFLAGS="crvs"
279 ;;
280esac
281
282AC_SUBST(ARFLAGS)
283
ac884b6a 284dnl Prep libraries specifically for cupsd and backends...
bd7854cb 285BACKLIBS=""
cc754834 286SERVERLIBS=""
ac884b6a 287AC_SUBST(BACKLIBS)
cc754834 288AC_SUBST(SERVERLIBS)
ac884b6a
MS
289
290dnl See if we have POSIX ACL support...
291SAVELIBS="$LIBS"
292LIBS=""
bf3816c7 293AC_ARG_ENABLE(acl, [ --enable-acl build with POSIX ACL support])
ee571f26
MS
294if test "x$enable_acl" != xno; then
295 AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
cc754834 296 SERVERLIBS="$SERVERLIBS $LIBS"
ee571f26 297fi
ac884b6a
MS
298LIBS="$SAVELIBS"
299
300dnl Check for DBUS support
301if test -d /etc/dbus-1; then
302 DBUSDIR="/etc/dbus-1"
303else
304 DBUSDIR=""
305fi
bd7854cb 306
bf3816c7 307AC_ARG_ENABLE(dbus, [ --enable-dbus build with DBUS support])
ac884b6a
MS
308AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ],
309 DBUSDIR="$withval")
310
c5571a1d
MS
311DBUS_NOTIFIER=""
312DBUS_NOTIFIERLIBS=""
313
0268488e
MS
314if test "x$enable_dbus" != xno -a "x$PKGCONFIG" != x; then
315 AC_MSG_CHECKING(for DBUS)
316 if $PKGCONFIG --exists dbus-1; then
317 AC_MSG_RESULT(yes)
318 AC_DEFINE(HAVE_DBUS)
319 CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
320 SERVERLIBS="$SERVERLIBS `$PKGCONFIG --libs dbus-1`"
321 DBUS_NOTIFIER="dbus"
322 DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs dbus-1`"
323 SAVELIBS="$LIBS"
324 LIBS="$LIBS $DBUS_NOTIFIERLIBS"
325 AC_CHECK_FUNC(dbus_message_iter_init_append,
326 AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
327 LIBS="$SAVELIBS"
328 else
329 AC_MSG_RESULT(no)
ac884b6a
MS
330 fi
331fi
ecdc0628 332
ac884b6a 333AC_SUBST(DBUSDIR)
c5571a1d
MS
334AC_SUBST(DBUS_NOTIFIER)
335AC_SUBST(DBUS_NOTIFIERLIBS)
ac884b6a
MS
336
337dnl Extra platform-specific libraries...
b9faaae1 338CUPS_DEFAULT_PRINTOPERATOR_AUTH="@SYSTEM"
ac884b6a 339CUPS_SYSTEM_AUTHKEY=""
eac3a0a0 340INSTALLXPC=""
09a101d6 341
ef416fc2 342case $uname in
343 Darwin*)
ac884b6a 344 BACKLIBS="$BACKLIBS -framework IOKit"
cc754834 345 SERVERLIBS="$SERVERLIBS -framework IOKit -weak_framework ApplicationServices"
f8b3a85b 346 LIBS="-framework SystemConfiguration -framework CoreFoundation -framework Security $LIBS"
fa73b229 347
348 dnl Check for framework headers...
6d2f911b 349 AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h,AC_DEFINE(HAVE_APPLICATIONSERVICES_H))
fa73b229 350 AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
351 AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
352 AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
84315f46 353 AC_CHECK_HEADER(IOKit/pwr_mgt/IOPMLibPrivate.h,AC_DEFINE(HAVE_IOKIT_PWR_MGT_IOPMLIBPRIVATE_H))
fa73b229 354
6d2f911b
MS
355 dnl Check for dynamic store function...
356 AC_CHECK_FUNCS(SCDynamicStoreCopyComputerName)
357
7594b224 358 dnl Check for the new membership functions in MacOSX 10.4...
fa73b229 359 AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
7594b224 360 AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
fa73b229 361 AC_CHECK_FUNCS(mbr_uid_to_uuid)
362
178cb736
MS
363 dnl Check for the vproc_transaction_begin/end stuff...
364 AC_CHECK_FUNCS(vproc_transaction_begin)
365
7594b224 366 dnl Need <dlfcn.h> header...
367 AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
368
fa73b229 369 dnl Check for notify_post support
370 AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
371 AC_CHECK_FUNCS(notify_post)
f7deaa1a 372
373 dnl Check for Authorization Services support
1f0275e3
MS
374 AC_ARG_WITH(adminkey, [ --with-adminkey set the default SystemAuthKey value],
375 default_adminkey="$withval",
376 default_adminkey="default")
377 AC_ARG_WITH(operkey, [ --with-operkey set the default operator @AUTHKEY value],
378 default_operkey="$withval",
379 default_operkey="default")
eac3a0a0 380
f7deaa1a 381 AC_CHECK_HEADER(Security/Authorization.h, [
382 AC_DEFINE(HAVE_AUTHORIZATION_H)
1f0275e3
MS
383
384 if test "x$default_adminkey" != xdefault; then
385 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
386 elif grep -q system.print.operator /etc/authorization; then
387 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
01ce6322 388 else
1f0275e3
MS
389 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
390 fi
391
392 if test "x$default_operkey" != xdefault; then
b9faaae1 393 CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
1f0275e3 394 elif grep -q system.print.operator /etc/authorization; then
b9faaae1 395 CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
1f0275e3 396 else
b9faaae1 397 CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
01ce6322 398 fi])
f7deaa1a 399 AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
a4924f6c
MS
400
401 dnl Check for sandbox/Seatbelt support
82f97232 402 if test $uversion -ge 100; then
a2326b5b
MS
403 AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
404 fi
405 if test $uversion -ge 110; then
406 # Broken public headers in 10.7...
407 AC_MSG_CHECKING(for sandbox/private.h presence)
408 if test -f /usr/local/include/sandbox/private.h; then
409 AC_MSG_RESULT(yes)
410 else
411 AC_MSG_RESULT(no)
412 AC_MSG_ERROR(Run 'sudo mkdir -p /usr/local/include/sandbox' and 'sudo touch /usr/local/include/sandbox/private.h' to build CUPS.)
413 fi
82f97232 414 fi
eac3a0a0
MS
415
416 dnl Check for XPC support
417 AC_CHECK_HEADER(xpc/xpc.h,
418 AC_DEFINE(HAVE_XPC)
419 INSTALLXPC="install-xpc")
82cc1f9a
MS
420 AC_CHECK_HEADER(xpc/private.h,
421 AC_DEFINE(HAVE_XPC_PRIVATE_H))
ef416fc2 422 ;;
ef416fc2 423esac
424
b9faaae1
MS
425AC_SUBST(CUPS_DEFAULT_PRINTOPERATOR_AUTH)
426AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTOPERATOR_AUTH, "$CUPS_DEFAULT_PRINTOPERATOR_AUTH")
f7deaa1a 427AC_SUBST(CUPS_SYSTEM_AUTHKEY)
eac3a0a0 428AC_SUBST(INSTALLXPC)
ef416fc2 429
6d2f911b
MS
430dnl Check for build components
431COMPONENTS="all"
432
433AC_ARG_WITH(components, [ --with-components set components to build:
434 - "all" (default) builds everything
435 - "core" builds libcups and ipptool],
436 COMPONENTS="$withval")
437
438case "$COMPONENTS" in
439 all)
a4845881 440 BUILDDIRS="filter backend berkeley cgi-bin monitor notifier ppdc scheduler systemv conf data desktop locale man doc examples templates"
6d2f911b
MS
441 ;;
442
443 core)
444 BUILDDIRS="data locale"
445 ;;
446
447 *)
448 AC_MSG_ERROR([Bad build component "$COMPONENT" specified!])
449 ;;
450esac
451
452AC_SUBST(BUILDDIRS)
453
ef416fc2 454dnl
18ecb428 455dnl End of "$Id: cups-common.m4 8781 2009-08-28 17:34:54Z mike $".
ef416fc2 456dnl