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