]> 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 6032 2006-10-12 19:19:47Z 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.2.5"
33 CUPS_REVISION=""
34 if 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'`"
36 fi
37
38 AC_SUBST(CUPS_VERSION)
39 AC_SUBST(CUPS_REVISION)
40 AC_DEFINE_UNQUOTED(CUPS_SVERSION, "CUPS v$CUPS_VERSION$CUPS_REVISION")
41 AC_DEFINE_UNQUOTED(CUPS_MINIMAL, "CUPS/$CUPS_VERSION$CUPS_REVISION")
42
43 dnl Default compiler flags...
44 CFLAGS="${CFLAGS:=}"
45 CPPFLAGS="${CPPFLAGS:=}"
46 CXXFLAGS="${CXXFLAGS:=}"
47 LDFLAGS="${LDFLAGS:=}"
48
49 dnl Checks for programs...
50 AC_PROG_AWK
51 AC_PROG_CC
52 AC_PROG_CXX
53 AC_PROG_CPP
54 AC_PROG_INSTALL
55 if test "$INSTALL" = "$ac_install_sh"; then
56 # Use full path to install-sh script...
57 INSTALL="`pwd`/install-sh -c"
58 fi
59 AC_PROG_RANLIB
60 AC_PATH_PROG(AR,ar)
61 AC_PATH_PROG(HTMLDOC,htmldoc)
62 AC_PATH_PROG(LD,ld)
63 AC_PATH_PROG(LN,ln)
64 AC_PATH_PROG(MV,mv)
65 AC_PATH_PROG(RM,rm)
66 AC_PATH_PROG(RMDIR,rmdir)
67 AC_PATH_PROG(SED,sed)
68 AC_PATH_PROG(STRIP,strip)
69
70 if test "x$AR" = x; then
71 AC_MSG_ERROR([Unable to find required library archive command.])
72 fi
73 if test "x$CC" = x; then
74 AC_MSG_ERROR([Unable to find required C compiler command.])
75 fi
76 if test "x$CXX" = x; then
77 AC_MSG_ERROR([Unable to find required C++ compiler command.])
78 fi
79
80 dnl Static library option...
81 INSTALLSTATIC=""
82 AC_ARG_ENABLE(static, [ --enable-static install static libraries, default=no])
83
84 if test x$enable_static = xyes; then
85 echo Installing static libraries...
86 INSTALLSTATIC="installstatic"
87 fi
88
89 AC_SUBST(INSTALLSTATIC)
90
91 dnl Check for libraries...
92 AC_SEARCH_LIBS(crypt, crypt)
93 AC_SEARCH_LIBS(getspent, sec gen)
94
95 LIBMALLOC=""
96 AC_ARG_ENABLE(mallinfo, [ --enable-mallinfo turn on malloc debug information, default=no])
97
98 if 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
107 fi
108
109 AC_SUBST(LIBMALLOC)
110
111 dnl Check for libpaper support...
112 AC_ARG_ENABLE(libpaper, [ --enable-libpaper turn on libpaper support, default=no])
113
114 if test x$enable_libpaper = xyes; then
115 AC_CHECK_LIB(paper,systempapername,
116 AC_DEFINE(HAVE_LIBPAPER)
117 LIBPAPER="-lpaper",
118 LIBPAPER="")
119 else
120 LIBPAPER=""
121 fi
122 AC_SUBST(LIBPAPER)
123
124 dnl Checks for header files.
125 AC_HEADER_STDC
126 AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
127 AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
128 AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
129 AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
130 AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
131 AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
132 AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
133 AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
134 AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
135 AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
136
137 dnl Checks for string functions.
138 AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
139 if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
140 echo Forcing snprintf emulation for HP-UX.
141 else
142 AC_CHECK_FUNCS(snprintf vsnprintf)
143 fi
144
145 dnl Checks for mkstemp and mkstemps functions.
146 AC_CHECK_FUNCS(mkstemp mkstemps)
147
148 dnl Check for geteuid function.
149 AC_CHECK_FUNCS(geteuid)
150
151 dnl Check for vsyslog function.
152 AC_CHECK_FUNCS(vsyslog)
153
154 dnl Checks for signal functions.
155 case "$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 ;;
163 esac
164
165 AC_CHECK_FUNCS(sigaction)
166
167 dnl Checks for wait functions.
168 AC_CHECK_FUNCS(waitpid)
169 AC_CHECK_FUNCS(wait3)
170
171 dnl See if the tm structure has the tm_gmtoff member...
172 AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
173 AC_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
179 dnl Flags for "ar" command...
180 case $uname in
181 Darwin* | *BSD*)
182 ARFLAGS="-rcv"
183 ;;
184 *)
185 ARFLAGS="crvs"
186 ;;
187 esac
188
189 AC_SUBST(ARFLAGS)
190
191 dnl Extra platform-specific libraries...
192 BACKLIBS=""
193 CUPSDLIBS=""
194 DBUSDIR=""
195
196 AC_ARG_ENABLE(dbus, [ --enable-dbus enable DBUS support, default=auto])
197
198 case $uname in
199 Darwin*)
200 BACKLIBS="-framework IOKit"
201 CUPSDLIBS="-framework IOKit -framework SystemConfiguration"
202 LIBS="-framework CoreFoundation $LIBS"
203
204 dnl Check for CFLocaleCreateCanonicalLocaleIdentifierFromString...
205 AC_MSG_CHECKING(for CFLocaleCreateCanonicalLocaleIdentifierFromString)
206 if test "$uname" = "Darwin" -a $uversion -ge 70; then
207 AC_DEFINE(HAVE_CF_LOCALE_ID)
208 AC_MSG_RESULT(yes)
209 else
210 AC_MSG_RESULT(no)
211 fi
212
213 dnl Check for framework headers...
214 AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
215 AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
216 AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
217
218 dnl Check for the new membership functions in MacOSX 10.4 (Tiger)...
219 AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
220 AC_CHECK_FUNCS(mbr_uid_to_uuid)
221
222 dnl Check for notify_post support
223 AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H))
224 AC_CHECK_FUNCS(notify_post)
225 ;;
226
227 Linux*)
228 dnl Check for DBUS support
229 if test "x$enable_dbus" != xno; then
230 AC_PATH_PROG(PKGCONFIG, pkg-config)
231 if test "x$PKGCONFIG" != x; then
232 AC_MSG_CHECKING(for DBUS)
233 if $PKGCONFIG --exists dbus-1; then
234 AC_MSG_RESULT(yes)
235 AC_DEFINE(HAVE_DBUS)
236 CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
237 CUPSDLIBS="`$PKGCONFIG --libs dbus-1`"
238 DBUSDIR="/etc/dbus-1/system.d"
239 AC_CHECK_LIB(dbus-1,
240 dbus_message_iter_init_append,
241 AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
242 else
243 AC_MSG_RESULT(no)
244 fi
245 fi
246 fi
247 ;;
248 esac
249
250 dnl See if we have POSIX ACL support...
251 SAVELIBS="$LIBS"
252 LIBS=""
253 AC_SEARCH_LIBS(acl_init, acl, AC_DEFINE(HAVE_ACL_INIT))
254 CUPSDLIBS="$CUPSDLIBS $LIBS"
255 LIBS="$SAVELIBS"
256
257 AC_SUBST(BACKLIBS)
258 AC_SUBST(CUPSDLIBS)
259 AC_SUBST(DBUSDIR)
260
261 dnl New default port definition for IPP...
262 AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP ],
263 DEFAULT_IPP_PORT="$withval",
264 DEFAULT_IPP_PORT="631")
265
266 AC_SUBST(DEFAULT_IPP_PORT)
267 AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
268
269 dnl
270 dnl End of "$Id: cups-common.m4 6032 2006-10-12 19:19:47Z mike $".
271 dnl