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