xref: /aosp_15_r20/external/libcups/config-scripts/cups-common.m4 (revision 5e7646d21f1134fb0638875d812ef646c12ab91e)
1*5e7646d2SAndroid Build Coastguard Workerdnl
2*5e7646d2SAndroid Build Coastguard Workerdnl Common configuration stuff for CUPS.
3*5e7646d2SAndroid Build Coastguard Workerdnl
4*5e7646d2SAndroid Build Coastguard Workerdnl Copyright © 2007-2019 by Apple Inc.
5*5e7646d2SAndroid Build Coastguard Workerdnl Copyright © 1997-2007 by Easy Software Products, all rights reserved.
6*5e7646d2SAndroid Build Coastguard Workerdnl
7*5e7646d2SAndroid Build Coastguard Workerdnl Licensed under Apache License v2.0.  See the file "LICENSE" for more
8*5e7646d2SAndroid Build Coastguard Workerdnl information.
9*5e7646d2SAndroid Build Coastguard Workerdnl
10*5e7646d2SAndroid Build Coastguard Worker
11*5e7646d2SAndroid Build Coastguard Workerdnl Set the name of the config header file...
12*5e7646d2SAndroid Build Coastguard WorkerAC_CONFIG_HEADER(config.h)
13*5e7646d2SAndroid Build Coastguard Worker
14*5e7646d2SAndroid Build Coastguard Workerdnl Version number information...
15*5e7646d2SAndroid Build Coastguard WorkerCUPS_VERSION="AC_PACKAGE_VERSION"
16*5e7646d2SAndroid Build Coastguard WorkerCUPS_REVISION=""
17*5e7646d2SAndroid Build Coastguard WorkerCUPS_BUILD="cups-$CUPS_VERSION"
18*5e7646d2SAndroid Build Coastguard Worker
19*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_WITH(cups_build, [  --with-cups-build       set "cups-config --build" string ],
20*5e7646d2SAndroid Build Coastguard Worker	CUPS_BUILD="$withval")
21*5e7646d2SAndroid Build Coastguard Worker
22*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(CUPS_VERSION)
23*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(CUPS_REVISION)
24*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(CUPS_BUILD)
25*5e7646d2SAndroid Build Coastguard WorkerAC_DEFINE_UNQUOTED(CUPS_SVERSION, "AC_PACKAGE_NAME v$CUPS_VERSION$CUPS_REVISION")
26*5e7646d2SAndroid Build Coastguard WorkerAC_DEFINE_UNQUOTED(CUPS_MINIMAL, "AC_PACKAGE_NAME/$CUPS_VERSION$CUPS_REVISION")
27*5e7646d2SAndroid Build Coastguard Worker
28*5e7646d2SAndroid Build Coastguard Workerdnl Default compiler flags...
29*5e7646d2SAndroid Build Coastguard WorkerCFLAGS="${CFLAGS:=}"
30*5e7646d2SAndroid Build Coastguard WorkerCPPFLAGS="${CPPFLAGS:=}"
31*5e7646d2SAndroid Build Coastguard WorkerCXXFLAGS="${CXXFLAGS:=}"
32*5e7646d2SAndroid Build Coastguard WorkerLDFLAGS="${LDFLAGS:=}"
33*5e7646d2SAndroid Build Coastguard Worker
34*5e7646d2SAndroid Build Coastguard Workerdnl Checks for programs...
35*5e7646d2SAndroid Build Coastguard WorkerAC_PROG_AWK
36*5e7646d2SAndroid Build Coastguard WorkerAC_PROG_CC(clang cc gcc)
37*5e7646d2SAndroid Build Coastguard WorkerAC_PROG_CPP
38*5e7646d2SAndroid Build Coastguard WorkerAC_PROG_CXX(clang++ c++ g++)
39*5e7646d2SAndroid Build Coastguard WorkerAC_PROG_RANLIB
40*5e7646d2SAndroid Build Coastguard WorkerAC_PATH_PROG(AR,ar)
41*5e7646d2SAndroid Build Coastguard WorkerAC_PATH_PROG(CHMOD,chmod)
42*5e7646d2SAndroid Build Coastguard WorkerAC_PATH_PROG(GZIPPROG,gzip)
43*5e7646d2SAndroid Build Coastguard WorkerAC_MSG_CHECKING(for install-sh script)
44*5e7646d2SAndroid Build Coastguard WorkerINSTALL="`pwd`/install-sh"
45*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(INSTALL)
46*5e7646d2SAndroid Build Coastguard WorkerAC_MSG_RESULT(using $INSTALL)
47*5e7646d2SAndroid Build Coastguard WorkerAC_PATH_PROG(LD,ld)
48*5e7646d2SAndroid Build Coastguard WorkerAC_PATH_PROG(LN,ln)
49*5e7646d2SAndroid Build Coastguard WorkerAC_PATH_PROG(MKDIR,mkdir)
50*5e7646d2SAndroid Build Coastguard WorkerAC_PATH_PROG(MV,mv)
51*5e7646d2SAndroid Build Coastguard WorkerAC_PATH_PROG(RM,rm)
52*5e7646d2SAndroid Build Coastguard WorkerAC_PATH_PROG(RMDIR,rmdir)
53*5e7646d2SAndroid Build Coastguard WorkerAC_PATH_PROG(SED,sed)
54*5e7646d2SAndroid Build Coastguard WorkerAC_PATH_PROG(XDGOPEN,xdg-open)
55*5e7646d2SAndroid Build Coastguard Worker
56*5e7646d2SAndroid Build Coastguard Workerif test "x$XDGOPEN" = x; then
57*5e7646d2SAndroid Build Coastguard Worker	CUPS_HTMLVIEW="htmlview"
58*5e7646d2SAndroid Build Coastguard Workerelse
59*5e7646d2SAndroid Build Coastguard Worker	CUPS_HTMLVIEW="$XDGOPEN"
60*5e7646d2SAndroid Build Coastguard Workerfi
61*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(CUPS_HTMLVIEW)
62*5e7646d2SAndroid Build Coastguard Worker
63*5e7646d2SAndroid Build Coastguard Workerif test "x$AR" = x; then
64*5e7646d2SAndroid Build Coastguard Worker	AC_MSG_ERROR([Unable to find required library archive command.])
65*5e7646d2SAndroid Build Coastguard Workerfi
66*5e7646d2SAndroid Build Coastguard Workerif test "x$CC" = x; then
67*5e7646d2SAndroid Build Coastguard Worker	AC_MSG_ERROR([Unable to find required C compiler command.])
68*5e7646d2SAndroid Build Coastguard Workerfi
69*5e7646d2SAndroid Build Coastguard Worker
70*5e7646d2SAndroid Build Coastguard Workerdnl Static library option...
71*5e7646d2SAndroid Build Coastguard WorkerINSTALLSTATIC=""
72*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_ENABLE(static, [  --enable-static         install static libraries])
73*5e7646d2SAndroid Build Coastguard Worker
74*5e7646d2SAndroid Build Coastguard Workerif test x$enable_static = xyes; then
75*5e7646d2SAndroid Build Coastguard Worker	echo Installing static libraries...
76*5e7646d2SAndroid Build Coastguard Worker	INSTALLSTATIC="installstatic"
77*5e7646d2SAndroid Build Coastguard Workerfi
78*5e7646d2SAndroid Build Coastguard Worker
79*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(INSTALLSTATIC)
80*5e7646d2SAndroid Build Coastguard Worker
81*5e7646d2SAndroid Build Coastguard Workerdnl Check for pkg-config, which is used for some other tests later on...
82*5e7646d2SAndroid Build Coastguard WorkerAC_PATH_TOOL(PKGCONFIG, pkg-config)
83*5e7646d2SAndroid Build Coastguard Worker
84*5e7646d2SAndroid Build Coastguard Workerdnl Check for libraries...
85*5e7646d2SAndroid Build Coastguard WorkerAC_SEARCH_LIBS(abs, m, AC_DEFINE(HAVE_ABS))
86*5e7646d2SAndroid Build Coastguard WorkerAC_SEARCH_LIBS(crypt, crypt)
87*5e7646d2SAndroid Build Coastguard WorkerAC_SEARCH_LIBS(fmod, m)
88*5e7646d2SAndroid Build Coastguard WorkerAC_SEARCH_LIBS(getspent, sec gen)
89*5e7646d2SAndroid Build Coastguard Worker
90*5e7646d2SAndroid Build Coastguard WorkerLIBMALLOC=""
91*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_ENABLE(mallinfo, [  --enable-mallinfo       build with malloc debug logging])
92*5e7646d2SAndroid Build Coastguard Worker
93*5e7646d2SAndroid Build Coastguard Workerif test x$enable_mallinfo = xyes; then
94*5e7646d2SAndroid Build Coastguard Worker	SAVELIBS="$LIBS"
95*5e7646d2SAndroid Build Coastguard Worker	LIBS=""
96*5e7646d2SAndroid Build Coastguard Worker	AC_SEARCH_LIBS(mallinfo, malloc, AC_DEFINE(HAVE_MALLINFO))
97*5e7646d2SAndroid Build Coastguard Worker	LIBMALLOC="$LIBS"
98*5e7646d2SAndroid Build Coastguard Worker	LIBS="$SAVELIBS"
99*5e7646d2SAndroid Build Coastguard Workerfi
100*5e7646d2SAndroid Build Coastguard Worker
101*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LIBMALLOC)
102*5e7646d2SAndroid Build Coastguard Worker
103*5e7646d2SAndroid Build Coastguard Workerdnl Check for libpaper support...
104*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_ENABLE(libpaper, [  --enable-libpaper       build with libpaper support])
105*5e7646d2SAndroid Build Coastguard Worker
106*5e7646d2SAndroid Build Coastguard Workerif test x$enable_libpaper = xyes; then
107*5e7646d2SAndroid Build Coastguard Worker	AC_CHECK_LIB(paper,systempapername,
108*5e7646d2SAndroid Build Coastguard Worker		AC_DEFINE(HAVE_LIBPAPER)
109*5e7646d2SAndroid Build Coastguard Worker		LIBPAPER="-lpaper",
110*5e7646d2SAndroid Build Coastguard Worker		LIBPAPER="")
111*5e7646d2SAndroid Build Coastguard Workerelse
112*5e7646d2SAndroid Build Coastguard Worker	LIBPAPER=""
113*5e7646d2SAndroid Build Coastguard Workerfi
114*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LIBPAPER)
115*5e7646d2SAndroid Build Coastguard Worker
116*5e7646d2SAndroid Build Coastguard Workerdnl Checks for header files.
117*5e7646d2SAndroid Build Coastguard WorkerAC_HEADER_STDC
118*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
119*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
120*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
121*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
122*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
123*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(stdint.h,AC_DEFINE(HAVE_STDINT_H))
124*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
125*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
126*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
127*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
128*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
129*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
130*5e7646d2SAndroid Build Coastguard Worker
131*5e7646d2SAndroid Build Coastguard Workerdnl Checks for iconv.h and iconv_open
132*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(iconv.h,
133*5e7646d2SAndroid Build Coastguard Worker	SAVELIBS="$LIBS"
134*5e7646d2SAndroid Build Coastguard Worker	LIBS=""
135*5e7646d2SAndroid Build Coastguard Worker	AC_SEARCH_LIBS(iconv_open,iconv,
136*5e7646d2SAndroid Build Coastguard Worker		AC_DEFINE(HAVE_ICONV_H)
137*5e7646d2SAndroid Build Coastguard Worker		SAVELIBS="$SAVELIBS $LIBS")
138*5e7646d2SAndroid Build Coastguard Worker	AC_SEARCH_LIBS(libiconv_open,iconv,
139*5e7646d2SAndroid Build Coastguard Worker		AC_DEFINE(HAVE_ICONV_H)
140*5e7646d2SAndroid Build Coastguard Worker		SAVELIBS="$SAVELIBS $LIBS")
141*5e7646d2SAndroid Build Coastguard Worker	LIBS="$SAVELIBS")
142*5e7646d2SAndroid Build Coastguard Worker
143*5e7646d2SAndroid Build Coastguard Workerdnl Checks for statfs and its many headers...
144*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(sys/mount.h,AC_DEFINE(HAVE_SYS_MOUNT_H))
145*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(sys/statfs.h,AC_DEFINE(HAVE_SYS_STATFS_H))
146*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(sys/statvfs.h,AC_DEFINE(HAVE_SYS_STATVFS_H))
147*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H))
148*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_FUNCS(statfs statvfs)
149*5e7646d2SAndroid Build Coastguard Worker
150*5e7646d2SAndroid Build Coastguard Workerdnl Checks for string functions.
151*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_FUNCS(strdup strlcat strlcpy)
152*5e7646d2SAndroid Build Coastguard Workerif test "$host_os_name" = "hp-ux" -a "$host_os_version" = "1020"; then
153*5e7646d2SAndroid Build Coastguard Worker	echo Forcing snprintf emulation for HP-UX.
154*5e7646d2SAndroid Build Coastguard Workerelse
155*5e7646d2SAndroid Build Coastguard Worker	AC_CHECK_FUNCS(snprintf vsnprintf)
156*5e7646d2SAndroid Build Coastguard Workerfi
157*5e7646d2SAndroid Build Coastguard Worker
158*5e7646d2SAndroid Build Coastguard Workerdnl Check for random number functions...
159*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_FUNCS(random lrand48 arc4random)
160*5e7646d2SAndroid Build Coastguard Worker
161*5e7646d2SAndroid Build Coastguard Workerdnl Check for geteuid function.
162*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_FUNCS(geteuid)
163*5e7646d2SAndroid Build Coastguard Worker
164*5e7646d2SAndroid Build Coastguard Workerdnl Check for setpgid function.
165*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_FUNCS(setpgid)
166*5e7646d2SAndroid Build Coastguard Worker
167*5e7646d2SAndroid Build Coastguard Workerdnl Check for vsyslog function.
168*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_FUNCS(vsyslog)
169*5e7646d2SAndroid Build Coastguard Worker
170*5e7646d2SAndroid Build Coastguard Workerdnl Checks for signal functions.
171*5e7646d2SAndroid Build Coastguard Workercase "$host_os_name" in
172*5e7646d2SAndroid Build Coastguard Worker	linux* | gnu*)
173*5e7646d2SAndroid Build Coastguard Worker		# Do not use sigset on Linux or GNU HURD
174*5e7646d2SAndroid Build Coastguard Worker		;;
175*5e7646d2SAndroid Build Coastguard Worker	*)
176*5e7646d2SAndroid Build Coastguard Worker		# Use sigset on other platforms, if available
177*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_FUNCS(sigset)
178*5e7646d2SAndroid Build Coastguard Worker		;;
179*5e7646d2SAndroid Build Coastguard Workeresac
180*5e7646d2SAndroid Build Coastguard Worker
181*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_FUNCS(sigaction)
182*5e7646d2SAndroid Build Coastguard Worker
183*5e7646d2SAndroid Build Coastguard Workerdnl Checks for wait functions.
184*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_FUNCS(waitpid wait3)
185*5e7646d2SAndroid Build Coastguard Worker
186*5e7646d2SAndroid Build Coastguard Workerdnl Check for posix_spawn
187*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_FUNCS(posix_spawn)
188*5e7646d2SAndroid Build Coastguard Worker
189*5e7646d2SAndroid Build Coastguard Workerdnl Check for getgrouplist
190*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_FUNCS(getgrouplist)
191*5e7646d2SAndroid Build Coastguard Worker
192*5e7646d2SAndroid Build Coastguard Workerdnl See if the tm structure has the tm_gmtoff member...
193*5e7646d2SAndroid Build Coastguard WorkerAC_MSG_CHECKING(for tm_gmtoff member in tm structure)
194*5e7646d2SAndroid Build Coastguard WorkerAC_TRY_COMPILE([#include <time.h>],[struct tm t;
195*5e7646d2SAndroid Build Coastguard Worker	int o = t.tm_gmtoff;],
196*5e7646d2SAndroid Build Coastguard Worker	AC_MSG_RESULT(yes)
197*5e7646d2SAndroid Build Coastguard Worker	AC_DEFINE(HAVE_TM_GMTOFF),
198*5e7646d2SAndroid Build Coastguard Worker	AC_MSG_RESULT(no))
199*5e7646d2SAndroid Build Coastguard Worker
200*5e7646d2SAndroid Build Coastguard Workerdnl See if the stat structure has the st_gen member...
201*5e7646d2SAndroid Build Coastguard WorkerAC_MSG_CHECKING(for st_gen member in stat structure)
202*5e7646d2SAndroid Build Coastguard WorkerAC_TRY_COMPILE([#include <sys/stat.h>],[struct stat t;
203*5e7646d2SAndroid Build Coastguard Worker	int o = t.st_gen;],
204*5e7646d2SAndroid Build Coastguard Worker	AC_MSG_RESULT(yes)
205*5e7646d2SAndroid Build Coastguard Worker	AC_DEFINE(HAVE_ST_GEN),
206*5e7646d2SAndroid Build Coastguard Worker	AC_MSG_RESULT(no))
207*5e7646d2SAndroid Build Coastguard Worker
208*5e7646d2SAndroid Build Coastguard Workerdnl See if we have the removefile(3) function for securely removing files
209*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_FUNCS(removefile)
210*5e7646d2SAndroid Build Coastguard Worker
211*5e7646d2SAndroid Build Coastguard Workerdnl See if we have libusb...
212*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_ENABLE(libusb, [  --enable-libusb         use libusb for USB printing])
213*5e7646d2SAndroid Build Coastguard Worker
214*5e7646d2SAndroid Build Coastguard WorkerLIBUSB=""
215*5e7646d2SAndroid Build Coastguard WorkerUSBQUIRKS=""
216*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LIBUSB)
217*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(USBQUIRKS)
218*5e7646d2SAndroid Build Coastguard Worker
219*5e7646d2SAndroid Build Coastguard Workerif test "x$PKGCONFIG" != x; then
220*5e7646d2SAndroid Build Coastguard Worker	if test x$enable_libusb != xno -a $host_os_name != darwin; then
221*5e7646d2SAndroid Build Coastguard Worker		AC_MSG_CHECKING(for libusb-1.0)
222*5e7646d2SAndroid Build Coastguard Worker		if $PKGCONFIG --exists libusb-1.0; then
223*5e7646d2SAndroid Build Coastguard Worker			AC_MSG_RESULT(yes)
224*5e7646d2SAndroid Build Coastguard Worker			AC_DEFINE(HAVE_LIBUSB)
225*5e7646d2SAndroid Build Coastguard Worker			CFLAGS="$CFLAGS `$PKGCONFIG --cflags libusb-1.0`"
226*5e7646d2SAndroid Build Coastguard Worker			LIBUSB="`$PKGCONFIG --libs libusb-1.0`"
227*5e7646d2SAndroid Build Coastguard Worker			USBQUIRKS="\$(DATADIR)/usb"
228*5e7646d2SAndroid Build Coastguard Worker		else
229*5e7646d2SAndroid Build Coastguard Worker			AC_MSG_RESULT(no)
230*5e7646d2SAndroid Build Coastguard Worker			if test x$enable_libusb = xyes; then
231*5e7646d2SAndroid Build Coastguard Worker				AC_MSG_ERROR(libusb required for --enable-libusb.)
232*5e7646d2SAndroid Build Coastguard Worker			fi
233*5e7646d2SAndroid Build Coastguard Worker		fi
234*5e7646d2SAndroid Build Coastguard Worker	fi
235*5e7646d2SAndroid Build Coastguard Workerelif test x$enable_libusb = xyes; then
236*5e7646d2SAndroid Build Coastguard Worker	AC_MSG_ERROR(Need pkg-config to enable libusb support.)
237*5e7646d2SAndroid Build Coastguard Workerfi
238*5e7646d2SAndroid Build Coastguard Worker
239*5e7646d2SAndroid Build Coastguard Workerdnl See if we have libwrap for TCP wrappers support...
240*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_ENABLE(tcp_wrappers, [  --enable-tcp-wrappers   use libwrap for TCP wrappers support])
241*5e7646d2SAndroid Build Coastguard Worker
242*5e7646d2SAndroid Build Coastguard WorkerLIBWRAP=""
243*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LIBWRAP)
244*5e7646d2SAndroid Build Coastguard Worker
245*5e7646d2SAndroid Build Coastguard Workerif test x$enable_tcp_wrappers = xyes; then
246*5e7646d2SAndroid Build Coastguard Worker	AC_CHECK_LIB(wrap, hosts_access,[
247*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_HEADER(tcpd.h,
248*5e7646d2SAndroid Build Coastguard Worker			AC_DEFINE(HAVE_TCPD_H)
249*5e7646d2SAndroid Build Coastguard Worker			LIBWRAP="-lwrap")])
250*5e7646d2SAndroid Build Coastguard Workerfi
251*5e7646d2SAndroid Build Coastguard Worker
252*5e7646d2SAndroid Build Coastguard Workerdnl ZLIB
253*5e7646d2SAndroid Build Coastguard WorkerINSTALL_GZIP=""
254*5e7646d2SAndroid Build Coastguard WorkerLIBZ=""
255*5e7646d2SAndroid Build Coastguard WorkerAC_CHECK_HEADER(zlib.h,
256*5e7646d2SAndroid Build Coastguard Worker    AC_CHECK_LIB(z, gzgets,[
257*5e7646d2SAndroid Build Coastguard Worker	AC_DEFINE(HAVE_LIBZ)
258*5e7646d2SAndroid Build Coastguard Worker	LIBZ="-lz"
259*5e7646d2SAndroid Build Coastguard Worker	LIBS="$LIBS -lz"
260*5e7646d2SAndroid Build Coastguard Worker	AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_INFLATECOPY))
261*5e7646d2SAndroid Build Coastguard Worker	if test "x$GZIPPROG" != x; then
262*5e7646d2SAndroid Build Coastguard Worker		INSTALL_GZIP="-z"
263*5e7646d2SAndroid Build Coastguard Worker	fi]))
264*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(INSTALL_GZIP)
265*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LIBZ)
266*5e7646d2SAndroid Build Coastguard Worker
267*5e7646d2SAndroid Build Coastguard Workerdnl Flags for "ar" command...
268*5e7646d2SAndroid Build Coastguard Workercase $host_os_name in
269*5e7646d2SAndroid Build Coastguard Worker        darwin* | *bsd*)
270*5e7646d2SAndroid Build Coastguard Worker                ARFLAGS="-rcv"
271*5e7646d2SAndroid Build Coastguard Worker                ;;
272*5e7646d2SAndroid Build Coastguard Worker        *)
273*5e7646d2SAndroid Build Coastguard Worker                ARFLAGS="crvs"
274*5e7646d2SAndroid Build Coastguard Worker                ;;
275*5e7646d2SAndroid Build Coastguard Workeresac
276*5e7646d2SAndroid Build Coastguard Worker
277*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(ARFLAGS)
278*5e7646d2SAndroid Build Coastguard Worker
279*5e7646d2SAndroid Build Coastguard Workerdnl Prep libraries specifically for cupsd and backends...
280*5e7646d2SAndroid Build Coastguard WorkerBACKLIBS=""
281*5e7646d2SAndroid Build Coastguard WorkerSERVERLIBS=""
282*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(BACKLIBS)
283*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(SERVERLIBS)
284*5e7646d2SAndroid Build Coastguard Worker
285*5e7646d2SAndroid Build Coastguard Workerdnl See if we have POSIX ACL support...
286*5e7646d2SAndroid Build Coastguard WorkerSAVELIBS="$LIBS"
287*5e7646d2SAndroid Build Coastguard WorkerLIBS=""
288*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_ENABLE(acl, [  --enable-acl            build with POSIX ACL support])
289*5e7646d2SAndroid Build Coastguard Workerif test "x$enable_acl" != xno; then
290*5e7646d2SAndroid Build Coastguard Worker	AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
291*5e7646d2SAndroid Build Coastguard Worker	SERVERLIBS="$SERVERLIBS $LIBS"
292*5e7646d2SAndroid Build Coastguard Workerfi
293*5e7646d2SAndroid Build Coastguard WorkerLIBS="$SAVELIBS"
294*5e7646d2SAndroid Build Coastguard Worker
295*5e7646d2SAndroid Build Coastguard Workerdnl Check for DBUS support
296*5e7646d2SAndroid Build Coastguard WorkerDBUSDIR=""
297*5e7646d2SAndroid Build Coastguard WorkerDBUS_NOTIFIER=""
298*5e7646d2SAndroid Build Coastguard WorkerDBUS_NOTIFIERLIBS=""
299*5e7646d2SAndroid Build Coastguard Worker
300*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_ENABLE(dbus, [  --disable-dbus          build without DBUS support])
301*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_WITH(dbusdir, [  --with-dbusdir          set DBUS configuration directory ],
302*5e7646d2SAndroid Build Coastguard Worker	DBUSDIR="$withval")
303*5e7646d2SAndroid Build Coastguard Worker
304*5e7646d2SAndroid Build Coastguard Workerif test "x$enable_dbus" != xno -a "x$PKGCONFIG" != x -a "x$host_os_name" != xdarwin; then
305*5e7646d2SAndroid Build Coastguard Worker	AC_MSG_CHECKING(for DBUS)
306*5e7646d2SAndroid Build Coastguard Worker	if $PKGCONFIG --exists dbus-1; then
307*5e7646d2SAndroid Build Coastguard Worker		AC_MSG_RESULT(yes)
308*5e7646d2SAndroid Build Coastguard Worker		AC_DEFINE(HAVE_DBUS)
309*5e7646d2SAndroid Build Coastguard Worker		CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
310*5e7646d2SAndroid Build Coastguard Worker		SERVERLIBS="$SERVERLIBS `$PKGCONFIG --libs dbus-1`"
311*5e7646d2SAndroid Build Coastguard Worker		DBUS_NOTIFIER="dbus"
312*5e7646d2SAndroid Build Coastguard Worker		DBUS_NOTIFIERLIBS="`$PKGCONFIG --libs dbus-1`"
313*5e7646d2SAndroid Build Coastguard Worker		SAVELIBS="$LIBS"
314*5e7646d2SAndroid Build Coastguard Worker		LIBS="$LIBS $DBUS_NOTIFIERLIBS"
315*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_FUNC(dbus_message_iter_init_append,
316*5e7646d2SAndroid Build Coastguard Worker			      AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
317*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_FUNC(dbus_threads_init,
318*5e7646d2SAndroid Build Coastguard Worker			      AC_DEFINE(HAVE_DBUS_THREADS_INIT))
319*5e7646d2SAndroid Build Coastguard Worker		LIBS="$SAVELIBS"
320*5e7646d2SAndroid Build Coastguard Worker		if test -d /etc/dbus-1 -a "x$DBUSDIR" = x; then
321*5e7646d2SAndroid Build Coastguard Worker			DBUSDIR="/etc/dbus-1"
322*5e7646d2SAndroid Build Coastguard Worker		fi
323*5e7646d2SAndroid Build Coastguard Worker	else
324*5e7646d2SAndroid Build Coastguard Worker		AC_MSG_RESULT(no)
325*5e7646d2SAndroid Build Coastguard Worker	fi
326*5e7646d2SAndroid Build Coastguard Workerfi
327*5e7646d2SAndroid Build Coastguard Worker
328*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(DBUSDIR)
329*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(DBUS_NOTIFIER)
330*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(DBUS_NOTIFIERLIBS)
331*5e7646d2SAndroid Build Coastguard Worker
332*5e7646d2SAndroid Build Coastguard Workerdnl Extra platform-specific libraries...
333*5e7646d2SAndroid Build Coastguard WorkerCUPS_DEFAULT_PRINTOPERATOR_AUTH="@SYSTEM"
334*5e7646d2SAndroid Build Coastguard WorkerCUPS_DEFAULT_SYSTEM_AUTHKEY=""
335*5e7646d2SAndroid Build Coastguard WorkerCUPS_SYSTEM_AUTHKEY=""
336*5e7646d2SAndroid Build Coastguard WorkerINSTALLXPC=""
337*5e7646d2SAndroid Build Coastguard Worker
338*5e7646d2SAndroid Build Coastguard Workercase $host_os_name in
339*5e7646d2SAndroid Build Coastguard Worker        darwin*)
340*5e7646d2SAndroid Build Coastguard Worker                BACKLIBS="$BACKLIBS -framework IOKit"
341*5e7646d2SAndroid Build Coastguard Worker                SERVERLIBS="$SERVERLIBS -framework IOKit -weak_framework ApplicationServices"
342*5e7646d2SAndroid Build Coastguard Worker                LIBS="-framework CoreFoundation -framework Security $LIBS"
343*5e7646d2SAndroid Build Coastguard Worker
344*5e7646d2SAndroid Build Coastguard Worker		dnl Check for framework headers...
345*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h,AC_DEFINE(HAVE_APPLICATIONSERVICES_H))
346*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
347*5e7646d2SAndroid Build Coastguard Worker
348*5e7646d2SAndroid Build Coastguard Worker		dnl Check for dynamic store function...
349*5e7646d2SAndroid Build Coastguard Worker		SAVELIBS="$LIBS"
350*5e7646d2SAndroid Build Coastguard Worker		LIBS="-framework SystemConfiguration $LIBS"
351*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_FUNCS(SCDynamicStoreCopyComputerName,[
352*5e7646d2SAndroid Build Coastguard Worker		    AC_DEFINE(HAVE_SCDYNAMICSTORECOPYCOMPUTERNAME)],[
353*5e7646d2SAndroid Build Coastguard Worker		    LIBS="$SAVELIBS"])
354*5e7646d2SAndroid Build Coastguard Worker
355*5e7646d2SAndroid Build Coastguard Worker		dnl Check for the new membership functions in MacOSX 10.4...
356*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
357*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_FUNCS(mbr_uid_to_uuid)
358*5e7646d2SAndroid Build Coastguard Worker
359*5e7646d2SAndroid Build Coastguard Worker		dnl Need <dlfcn.h> header...
360*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
361*5e7646d2SAndroid Build Coastguard Worker
362*5e7646d2SAndroid Build Coastguard Worker		dnl Check for notify_post support
363*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
364*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_FUNCS(notify_post)
365*5e7646d2SAndroid Build Coastguard Worker
366*5e7646d2SAndroid Build Coastguard Worker		dnl Check for Authorization Services support
367*5e7646d2SAndroid Build Coastguard Worker		AC_ARG_WITH(adminkey, [  --with-adminkey         set the default SystemAuthKey value],
368*5e7646d2SAndroid Build Coastguard Worker			default_adminkey="$withval",
369*5e7646d2SAndroid Build Coastguard Worker			default_adminkey="default")
370*5e7646d2SAndroid Build Coastguard Worker 		AC_ARG_WITH(operkey, [  --with-operkey          set the default operator @AUTHKEY value],
371*5e7646d2SAndroid Build Coastguard Worker			default_operkey="$withval",
372*5e7646d2SAndroid Build Coastguard Worker			default_operkey="default")
373*5e7646d2SAndroid Build Coastguard Worker
374*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_HEADER(Security/Authorization.h, [
375*5e7646d2SAndroid Build Coastguard Worker			AC_DEFINE(HAVE_AUTHORIZATION_H)
376*5e7646d2SAndroid Build Coastguard Worker
377*5e7646d2SAndroid Build Coastguard Worker			if test "x$default_adminkey" != xdefault; then
378*5e7646d2SAndroid Build Coastguard Worker				CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
379*5e7646d2SAndroid Build Coastguard Worker				CUPS_DEFAULT_SYSTEM_AUTHKEY="$default_adminkey"
380*5e7646d2SAndroid Build Coastguard Worker			else
381*5e7646d2SAndroid Build Coastguard Worker				CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
382*5e7646d2SAndroid Build Coastguard Worker				CUPS_DEFAULT_SYSTEM_AUTHKEY="system.print.admin"
383*5e7646d2SAndroid Build Coastguard Worker			fi
384*5e7646d2SAndroid Build Coastguard Worker
385*5e7646d2SAndroid Build Coastguard Worker			if test "x$default_operkey" != xdefault; then
386*5e7646d2SAndroid Build Coastguard Worker				CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
387*5e7646d2SAndroid Build Coastguard Worker			else
388*5e7646d2SAndroid Build Coastguard Worker				CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
389*5e7646d2SAndroid Build Coastguard Worker			fi])
390*5e7646d2SAndroid Build Coastguard Worker
391*5e7646d2SAndroid Build Coastguard Worker		dnl Check for sandbox/Seatbelt support
392*5e7646d2SAndroid Build Coastguard Worker		if test $host_os_version -ge 100; then
393*5e7646d2SAndroid Build Coastguard Worker			AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
394*5e7646d2SAndroid Build Coastguard Worker		fi
395*5e7646d2SAndroid Build Coastguard Worker		if test $host_os_version -ge 110 -a $host_os_version -lt 120; then
396*5e7646d2SAndroid Build Coastguard Worker			# Broken public headers in 10.7.x...
397*5e7646d2SAndroid Build Coastguard Worker			AC_MSG_CHECKING(for sandbox/private.h presence)
398*5e7646d2SAndroid Build Coastguard Worker			if test -f /usr/local/include/sandbox/private.h; then
399*5e7646d2SAndroid Build Coastguard Worker				AC_MSG_RESULT(yes)
400*5e7646d2SAndroid Build Coastguard Worker			else
401*5e7646d2SAndroid Build Coastguard Worker				AC_MSG_RESULT(no)
402*5e7646d2SAndroid Build Coastguard Worker				AC_MSG_ERROR(Run 'sudo mkdir -p /usr/local/include/sandbox' and 'sudo touch /usr/local/include/sandbox/private.h' to build CUPS.)
403*5e7646d2SAndroid Build Coastguard Worker			fi
404*5e7646d2SAndroid Build Coastguard Worker		fi
405*5e7646d2SAndroid Build Coastguard Worker
406*5e7646d2SAndroid Build Coastguard Worker		dnl Check for XPC support
407*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_HEADER(xpc/xpc.h,
408*5e7646d2SAndroid Build Coastguard Worker			AC_DEFINE(HAVE_XPC)
409*5e7646d2SAndroid Build Coastguard Worker			INSTALLXPC="install-xpc")
410*5e7646d2SAndroid Build Coastguard Worker                ;;
411*5e7646d2SAndroid Build Coastguard Workeresac
412*5e7646d2SAndroid Build Coastguard Worker
413*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(CUPS_DEFAULT_PRINTOPERATOR_AUTH)
414*5e7646d2SAndroid Build Coastguard WorkerAC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTOPERATOR_AUTH, "$CUPS_DEFAULT_PRINTOPERATOR_AUTH")
415*5e7646d2SAndroid Build Coastguard WorkerAC_DEFINE_UNQUOTED(CUPS_DEFAULT_SYSTEM_AUTHKEY, "$CUPS_DEFAULT_SYSTEM_AUTHKEY")
416*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(CUPS_SYSTEM_AUTHKEY)
417*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(INSTALLXPC)
418*5e7646d2SAndroid Build Coastguard Worker
419*5e7646d2SAndroid Build Coastguard Workerdnl Check for build components
420*5e7646d2SAndroid Build Coastguard WorkerCOMPONENTS="all"
421*5e7646d2SAndroid Build Coastguard Worker
422*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_WITH(components, [  --with-components       set components to build:
423*5e7646d2SAndroid Build Coastguard Worker			    - "all" (default) builds everything
424*5e7646d2SAndroid Build Coastguard Worker			    - "core" builds libcups and ipptool
425*5e7646d2SAndroid Build Coastguard Worker			    - "libcups" builds just libcups
426*5e7646d2SAndroid Build Coastguard Worker			    - "libcupslite" builds just libcups without driver support],
427*5e7646d2SAndroid Build Coastguard Worker	COMPONENTS="$withval")
428*5e7646d2SAndroid Build Coastguard Worker
429*5e7646d2SAndroid Build Coastguard Workercupsimagebase="cupsimage"
430*5e7646d2SAndroid Build Coastguard WorkerIPPEVECOMMANDS="ippevepcl ippeveps"
431*5e7646d2SAndroid Build Coastguard WorkerLIBCUPSOBJS="\$(COREOBJS) \$(DRIVEROBJS)"
432*5e7646d2SAndroid Build Coastguard WorkerLIBHEADERS="\$(COREHEADERS) \$(DRIVERHEADERS)"
433*5e7646d2SAndroid Build Coastguard WorkerLIBHEADERSPRIV="\$(COREHEADERSPRIV) \$(DRIVERHEADERSPRIV)"
434*5e7646d2SAndroid Build Coastguard Worker
435*5e7646d2SAndroid Build Coastguard Workercase "$COMPONENTS" in
436*5e7646d2SAndroid Build Coastguard Worker	all)
437*5e7646d2SAndroid Build Coastguard Worker		BUILDDIRS="tools filter backend berkeley cgi-bin monitor notifier ppdc scheduler systemv conf data desktop locale man doc examples templates"
438*5e7646d2SAndroid Build Coastguard Worker		;;
439*5e7646d2SAndroid Build Coastguard Worker
440*5e7646d2SAndroid Build Coastguard Worker	core)
441*5e7646d2SAndroid Build Coastguard Worker		BUILDDIRS="tools examples locale"
442*5e7646d2SAndroid Build Coastguard Worker		;;
443*5e7646d2SAndroid Build Coastguard Worker
444*5e7646d2SAndroid Build Coastguard Worker	corelite)
445*5e7646d2SAndroid Build Coastguard Worker		AC_DEFINE(CUPS_LITE)
446*5e7646d2SAndroid Build Coastguard Worker		BUILDDIRS="tools examples locale"
447*5e7646d2SAndroid Build Coastguard Worker		cupsimagebase=""
448*5e7646d2SAndroid Build Coastguard Worker		LIBCUPSOBJS="\$(COREOBJS)"
449*5e7646d2SAndroid Build Coastguard Worker		LIBHEADERS="\$(COREHEADERS)"
450*5e7646d2SAndroid Build Coastguard Worker		LIBHEADERSPRIV="\$(COREHEADERSPRIV)"
451*5e7646d2SAndroid Build Coastguard Worker		;;
452*5e7646d2SAndroid Build Coastguard Worker
453*5e7646d2SAndroid Build Coastguard Worker	libcups)
454*5e7646d2SAndroid Build Coastguard Worker		BUILDDIRS="locale"
455*5e7646d2SAndroid Build Coastguard Worker		cupsimagebase=""
456*5e7646d2SAndroid Build Coastguard Worker		;;
457*5e7646d2SAndroid Build Coastguard Worker
458*5e7646d2SAndroid Build Coastguard Worker	libcupslite)
459*5e7646d2SAndroid Build Coastguard Worker		AC_DEFINE(CUPS_LITE)
460*5e7646d2SAndroid Build Coastguard Worker		BUILDDIRS="locale"
461*5e7646d2SAndroid Build Coastguard Worker		cupsimagebase=""
462*5e7646d2SAndroid Build Coastguard Worker		LIBCUPSOBJS="\$(COREOBJS)"
463*5e7646d2SAndroid Build Coastguard Worker		LIBHEADERS="\$(COREHEADERS)"
464*5e7646d2SAndroid Build Coastguard Worker		LIBHEADERSPRIV="\$(COREHEADERSPRIV)"
465*5e7646d2SAndroid Build Coastguard Worker		;;
466*5e7646d2SAndroid Build Coastguard Worker
467*5e7646d2SAndroid Build Coastguard Worker	*)
468*5e7646d2SAndroid Build Coastguard Worker		AC_MSG_ERROR([Bad build component "$COMPONENT" specified!])
469*5e7646d2SAndroid Build Coastguard Worker		;;
470*5e7646d2SAndroid Build Coastguard Workeresac
471*5e7646d2SAndroid Build Coastguard Worker
472*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(BUILDDIRS)
473*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(IPPEVECOMMANDS)
474*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LIBCUPSOBJS)
475*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LIBHEADERS)
476*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(LIBHEADERSPRIV)
477