]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-common.m4
Merge changes from CUPS 1.4svn-r7242.
[thirdparty/cups.git] / config-scripts / cups-common.m4
1 dnl
2 dnl "$Id: cups-common.m4 6964 2007-09-17 21:33:57Z mike $"
3 dnl
4 dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
5 dnl
6 dnl Copyright 2007-2008 by Apple Inc.
7 dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
8 dnl
9 dnl These coded instructions, statements, and computer programs are the
10 dnl property of Apple Inc. and are protected by Federal copyright
11 dnl law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 dnl which should have been included with this file. If this file is
13 dnl file is missing or damaged, see the license at "http://www.cups.org/".
14 dnl
15
16 dnl We need at least autoconf 2.60...
17 AC_PREREQ(2.60)
18
19 dnl Set the name of the config header file...
20 AC_CONFIG_HEADER(config.h)
21
22 dnl Versio number information...
23 CUPS_VERSION="1.4svn"
24 CUPS_REVISION=""
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
28
29 AC_SUBST(CUPS_VERSION)
30 AC_SUBST(CUPS_REVISION)
31 AC_DEFINE_UNQUOTED(CUPS_SVERSION, "CUPS v$CUPS_VERSION$CUPS_REVISION")
32 AC_DEFINE_UNQUOTED(CUPS_MINIMAL, "CUPS/$CUPS_VERSION$CUPS_REVISION")
33
34 dnl Default compiler flags...
35 CFLAGS="${CFLAGS:=}"
36 CPPFLAGS="${CPPFLAGS:=}"
37 LDFLAGS="${LDFLAGS:=}"
38
39 dnl Checks for programs...
40 AC_PROG_AWK
41 AC_PROG_CC
42 AC_PROG_CPP
43 AC_PROG_INSTALL
44 if test "$INSTALL" = "$ac_install_sh"; then
45 # Use full path to install-sh script...
46 INSTALL="`pwd`/install-sh -c"
47 fi
48 AC_PROG_RANLIB
49 AC_PATH_PROG(AR,ar)
50 AC_PATH_PROG(HTMLDOC,htmldoc)
51 AC_PATH_PROG(LD,ld)
52 AC_PATH_PROG(LN,ln)
53 AC_PATH_PROG(MV,mv)
54 AC_PATH_PROG(RM,rm)
55 AC_PATH_PROG(RMDIR,rmdir)
56 AC_PATH_PROG(SED,sed)
57 AC_PATH_PROG(STRIP,strip)
58
59 if test "x$AR" = x; then
60 AC_MSG_ERROR([Unable to find required library archive command.])
61 fi
62 if test "x$CC" = x; then
63 AC_MSG_ERROR([Unable to find required C compiler command.])
64 fi
65
66 dnl Static library option...
67 INSTALLSTATIC=""
68 AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])
69
70 if test x$enable_static = xyes; then
71 echo Installing static libraries...
72 INSTALLSTATIC="installstatic"
73 fi
74
75 AC_SUBST(INSTALLSTATIC)
76
77 dnl Check for libraries...
78 AC_SEARCH_LIBS(crypt, crypt)
79 AC_SEARCH_LIBS(getspent, sec gen)
80
81 LIBMALLOC=""
82 AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo turn on malloc debug information, default=no])
83
84 if test x$enable_mallinfo = xyes; then
85 AC_CHECK_LIB(c,mallinfo,LIBS="$LIBS"; AC_DEFINE(HAVE_MALLINFO),LIBS="$LIBS")
86 if test "$ac_cv_lib_c_mallinfo" = "no"; then
87 AC_CHECK_LIB(malloc,mallinfo,
88 LIBS="$LIBS"
89 LIBMALLOC="-lmalloc"
90 AC_DEFINE(HAVE_MALLINFO),
91 LIBS="$LIBS")
92 fi
93 fi
94
95 AC_SUBST(LIBMALLOC)
96
97 dnl Check for libpaper support...
98 AC_ARG_ENABLE(libpaper, [ --enable-libpaper turn on libpaper support, default=no])
99
100 if test x$enable_libpaper = xyes; then
101 AC_CHECK_LIB(paper,systempapername,
102 AC_DEFINE(HAVE_LIBPAPER)
103 LIBPAPER="-lpaper",
104 LIBPAPER="")
105 else
106 LIBPAPER=""
107 fi
108 AC_SUBST(LIBPAPER)
109
110 dnl Checks for header files.
111 AC_HEADER_STDC
112 AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
113 AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
114 AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
115 AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
116 AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
117 AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
118 AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
119 AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
120 AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
121 AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
122 AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
123 AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
124
125 dnl Checks for string functions.
126 AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
127 if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
128 echo Forcing snprintf emulation for HP-UX.
129 else
130 AC_CHECK_FUNCS(snprintf vsnprintf)
131 fi
132
133 dnl Checks for mkstemp and mkstemps functions.
134 AC_CHECK_FUNCS(mkstemp mkstemps)
135
136 dnl Check for geteuid function.
137 AC_CHECK_FUNCS(geteuid)
138
139 dnl Check for vsyslog function.
140 AC_CHECK_FUNCS(vsyslog)
141
142 dnl Checks for signal functions.
143 case "$uname" in
144 Linux | GNU)
145 # Do not use sigset on Linux or GNU HURD
146 ;;
147 *)
148 # Use sigset on other platforms, if available
149 AC_CHECK_FUNCS(sigset)
150 ;;
151 esac
152
153 AC_CHECK_FUNCS(sigaction)
154
155 dnl Checks for wait functions.
156 AC_CHECK_FUNCS(waitpid wait3)
157
158 dnl See if the tm structure has the tm_gmtoff member...
159 AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
160 AC_TRY_COMPILE([#include <time.h>],[struct tm t;
161 int o = t.tm_gmtoff;],
162 AC_MSG_RESULT(yes)
163 AC_DEFINE(HAVE_TM_GMTOFF),
164 AC_MSG_RESULT(no))
165
166 dnl See if we have the removefile(3) function for securely removing files
167 AC_CHECK_FUNCS(removefile)
168
169 dnl Flags for "ar" command...
170 case $uname in
171 Darwin* | *BSD*)
172 ARFLAGS="-rcv"
173 ;;
174 *)
175 ARFLAGS="crvs"
176 ;;
177 esac
178
179 AC_SUBST(ARFLAGS)
180
181 dnl Extra platform-specific libraries...
182 BACKLIBS=""
183 CUPSDLIBS=""
184 DBUSDIR=""
185 CUPS_DEFAULT_PRINTADMIN_AUTH="@SYSTEM"
186 CUPS_SYSTEM_AUTHKEY=""
187
188 AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
189
190 FONTS="fonts"
191 AC_SUBST(FONTS)
192 LEGACY_BACKENDS="parallel scsi"
193 AC_SUBST(LEGACY_BACKENDS)
194
195 case $uname in
196 Darwin*)
197 FONTS=""
198 LEGACY_BACKENDS=""
199 BACKLIBS="-framework IOKit"
200 CUPSDLIBS="-sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration"
201 LIBS="-framework SystemConfiguration -framework CoreFoundation $LIBS"
202
203 dnl Check for framework headers...
204 AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
205 AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
206 AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
207
208 dnl Check for the new membership functions in MacOSX 10.4...
209 AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
210 AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
211 AC_CHECK_FUNCS(mbr_uid_to_uuid)
212
213 dnl Need <dlfcn.h> header...
214 AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
215
216 dnl Check for notify_post support
217 AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
218 AC_CHECK_FUNCS(notify_post)
219
220 dnl Check for Authorization Services support
221 AC_CHECK_HEADER(Security/Authorization.h, [
222 AC_DEFINE(HAVE_AUTHORIZATION_H)
223 CUPS_DEFAULT_PRINTADMIN_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
224 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"])
225 AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
226
227 dnl Check for sandbox/Seatbelt support
228 AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
229 ;;
230
231 Linux*)
232 dnl Check for DBUS support
233 if test "x$enable_dbus" != xno; then
234 AC_PATH_PROG(PKGCONFIG, pkg-config)
235 if test "x$PKGCONFIG" != x; then
236 AC_MSG_CHECKING(for DBUS)
237 if $PKGCONFIG --exists dbus-1; then
238 AC_MSG_RESULT(yes)
239 AC_DEFINE(HAVE_DBUS)
240 CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
241 CUPSDLIBS="`$PKGCONFIG --libs dbus-1`"
242 AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ], dbusdir="$withval", dbusdir="/etc/dbus-1")
243 DBUSDIR="$dbusdir"
244 AC_CHECK_LIB(dbus-1,
245 dbus_message_iter_init_append,
246 AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
247 else
248 AC_MSG_RESULT(no)
249 fi
250 fi
251 fi
252 ;;
253 esac
254
255 AC_SUBST(CUPS_DEFAULT_PRINTADMIN_AUTH)
256 AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTADMIN_AUTH, "$CUPS_DEFAULT_PRINTADMIN_AUTH")
257 AC_SUBST(CUPS_SYSTEM_AUTHKEY)
258
259 dnl See if we have POSIX ACL support...
260 SAVELIBS="$LIBS"
261 LIBS=""
262 AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
263 CUPSDLIBS="$CUPSDLIBS $LIBS"
264 LIBS="$SAVELIBS"
265
266 AC_SUBST(BACKLIBS)
267 AC_SUBST(CUPSDLIBS)
268 AC_SUBST(DBUSDIR)
269
270 dnl New default port definition for IPP...
271 AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP ],
272 DEFAULT_IPP_PORT="$withval",
273 DEFAULT_IPP_PORT="631")
274
275 AC_SUBST(DEFAULT_IPP_PORT)
276 AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
277
278 dnl
279 dnl End of "$Id: cups-common.m4 6964 2007-09-17 21:33:57Z mike $".
280 dnl