]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-common.m4
Load cups into easysw/current.
[thirdparty/cups.git] / config-scripts / cups-common.m4
CommitLineData
ef416fc2 1dnl
bc44d920 2dnl "$Id: cups-common.m4 6682 2007-07-16 20:22:37Z mike $"
ef416fc2 3dnl
4dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
5dnl
bc44d920 6dnl Copyright 2007 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
16dnl We need at least autoconf 2.50...
17AC_PREREQ(2.50)
18
19dnl Set the name of the config header file...
20AC_CONFIG_HEADER(config.h)
21
f7deaa1a 22dnl Versio number information...
bc44d920 23CUPS_VERSION="1.3b1"
ecdc0628 24CUPS_REVISION=""
bc44d920 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
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:=}"
37CXXFLAGS="${CXXFLAGS:=}"
38LDFLAGS="${LDFLAGS:=}"
39
40dnl Checks for programs...
41AC_PROG_AWK
42AC_PROG_CC
43AC_PROG_CXX
44AC_PROG_CPP
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
67if test "x$CXX" = x; then
68 AC_MSG_ERROR([Unable to find required C++ compiler command.])
69fi
70
923edb68 71dnl Static library option...
72INSTALLSTATIC=""
d6ae789d 73AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])
923edb68 74
d6ae789d 75if test x$enable_static = xyes; then
76 echo Installing static libraries...
923edb68 77 INSTALLSTATIC="installstatic"
78fi
79
80AC_SUBST(INSTALLSTATIC)
ef416fc2 81
82dnl Check for libraries...
83AC_SEARCH_LIBS(crypt, crypt)
84AC_SEARCH_LIBS(getspent, sec gen)
85
86LIBMALLOC=""
87AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo turn on malloc debug information, default=no])
88
89if 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
98fi
99
100AC_SUBST(LIBMALLOC)
101
102dnl Check for libpaper support...
103AC_ARG_ENABLE(libpaper, [ --enable-libpaper turn on libpaper support, default=no])
104
105if test x$enable_libpaper = xyes; then
106 AC_CHECK_LIB(paper,systempapername,
107 AC_DEFINE(HAVE_LIBPAPER)
108 LIBPAPER="-lpaper",
109 LIBPAPER="")
110else
111 LIBPAPER=""
112fi
113AC_SUBST(LIBPAPER)
114
115dnl Checks for header files.
116AC_HEADER_STDC
117AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
118AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
119AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
120AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
121AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
122AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
123AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
124AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
125AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
bc44d920 126AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
2abf387c 127AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
ef416fc2 128
129dnl Checks for string functions.
130AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
131if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
132 echo Forcing snprintf emulation for HP-UX.
133else
134 AC_CHECK_FUNCS(snprintf vsnprintf)
135fi
136
137dnl Checks for mkstemp and mkstemps functions.
138AC_CHECK_FUNCS(mkstemp mkstemps)
139
140dnl Check for geteuid function.
141AC_CHECK_FUNCS(geteuid)
142
143dnl Check for vsyslog function.
144AC_CHECK_FUNCS(vsyslog)
145
146dnl Checks for signal functions.
147case "$uname" in
148 Linux | GNU)
149 # Do not use sigset on Linux or GNU HURD
150 ;;
151 *)
152 # Use sigset on other platforms, if available
153 AC_CHECK_FUNCS(sigset)
154 ;;
155esac
156
157AC_CHECK_FUNCS(sigaction)
158
159dnl Checks for wait functions.
160AC_CHECK_FUNCS(waitpid)
161AC_CHECK_FUNCS(wait3)
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
171dnl Flags for "ar" command...
172case $uname in
173 Darwin* | *BSD*)
174 ARFLAGS="-rcv"
175 ;;
176 *)
177 ARFLAGS="crvs"
178 ;;
179esac
180
181AC_SUBST(ARFLAGS)
182
183dnl Extra platform-specific libraries...
bd7854cb 184BACKLIBS=""
185CUPSDLIBS=""
186DBUSDIR=""
f7deaa1a 187CUPS_SYSTEM_AUTHKEY=""
bd7854cb 188
ecdc0628 189AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
190
09a101d6 191AC_ARG_WITH(libcupsorder, [ --with-libcupsorder libcups secorder file, default=libcups.order],
192 LIBCUPSORDER="$withval",
193 LIBCUPSORDER="libcups.order")
194AC_SUBST(LIBCUPSORDER)
195
196FONTS="fonts"
197AC_SUBST(FONTS)
198LEGACY_BACKENDS="parallel scsi"
199AC_SUBST(LEGACY_BACKENDS)
200
ef416fc2 201case $uname in
202 Darwin*)
09a101d6 203 FONTS=""
204 LEGACY_BACKENDS=""
ef416fc2 205 BACKLIBS="-framework IOKit"
09a101d6 206 CUPSDLIBS="-sectorder __TEXT __text cupsd.order -e start -framework IOKit -framework SystemConfiguration"
ef416fc2 207 LIBS="-framework CoreFoundation $LIBS"
fa73b229 208
209 dnl Check for CFLocaleCreateCanonicalLocaleIdentifierFromString...
210 AC_MSG_CHECKING(for CFLocaleCreateCanonicalLocaleIdentifierFromString)
211 if test "$uname" = "Darwin" -a $uversion -ge 70; then
212 AC_DEFINE(HAVE_CF_LOCALE_ID)
213 AC_MSG_RESULT(yes)
214 else
215 AC_MSG_RESULT(no)
216 fi
217
218 dnl Check for framework headers...
219 AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
220 AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
221 AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
222
7594b224 223 dnl Check for the new membership functions in MacOSX 10.4...
fa73b229 224 AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
7594b224 225 AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
fa73b229 226 AC_CHECK_FUNCS(mbr_uid_to_uuid)
227
7594b224 228 dnl Need <dlfcn.h> header...
229 AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
230
fa73b229 231 dnl Check for notify_post support
232 AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
233 AC_CHECK_FUNCS(notify_post)
f7deaa1a 234
235 dnl Check for Authorization Services support
236 AC_CHECK_HEADER(Security/Authorization.h, [
237 AC_DEFINE(HAVE_AUTHORIZATION_H)
bc44d920 238 CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"])
f7deaa1a 239 AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
ef416fc2 240 ;;
e00b005a 241
242 Linux*)
243 dnl Check for DBUS support
ecdc0628 244 if test "x$enable_dbus" != xno; then
245 AC_PATH_PROG(PKGCONFIG, pkg-config)
246 if test "x$PKGCONFIG" != x; then
247 AC_MSG_CHECKING(for DBUS)
248 if $PKGCONFIG --exists dbus-1; then
249 AC_MSG_RESULT(yes)
2abf387c 250 AC_DEFINE(HAVE_DBUS)
251 CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
252 CUPSDLIBS="`$PKGCONFIG --libs dbus-1`"
f7deaa1a 253 AC_ARG_WITH(dbusdir, [ --with-dbusdir set DBUS configuration directory ], dbusdir="$withval", dbusdir="/etc/dbus-1")
254 DBUSDIR="$dbusdir"
ecdc0628 255 AC_CHECK_LIB(dbus-1,
256 dbus_message_iter_init_append,
2abf387c 257 AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
ecdc0628 258 else
259 AC_MSG_RESULT(no)
260 fi
e00b005a 261 fi
262 fi
263 ;;
ef416fc2 264esac
265
f7deaa1a 266AC_SUBST(CUPS_SYSTEM_AUTHKEY)
267
bd7854cb 268dnl See if we have POSIX ACL support...
269SAVELIBS="$LIBS"
270LIBS=""
271AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
272CUPSDLIBS="$CUPSDLIBS $LIBS"
273LIBS="$SAVELIBS"
274
ef416fc2 275AC_SUBST(BACKLIBS)
09ec0018 276AC_SUBST(CUPSDLIBS)
bd7854cb 277AC_SUBST(DBUSDIR)
ef416fc2 278
279dnl New default port definition for IPP...
280AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP ],
281 DEFAULT_IPP_PORT="$withval",
282 DEFAULT_IPP_PORT="631")
283
284AC_SUBST(DEFAULT_IPP_PORT)
285AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
286
287dnl
bc44d920 288dnl End of "$Id: cups-common.m4 6682 2007-07-16 20:22:37Z mike $".
ef416fc2 289dnl