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