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