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