1 # ****************************************
2 # Initialize automake and set version
4 AC_INIT(src/soup-core/soup.h)
10 AC_SUBST(SOUP_CURRENT)
11 AC_SUBST(SOUP_REVISION)
14 AM_CONFIG_HEADER(config.h)
15 AM_INIT_AUTOMAKE(soup, 0.2.1)
19 # ****************************************
22 # Figure out debugging default, prior to $ac_help setup
23 if test `expr $SOUP_REVISION \% 2` = 1 ; then
29 # Declare --enable-* args and collect ac_help strings
31 [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,
32 enable_debug=$debug_default)
35 if test "x$enable_debug" = "xyes"; then
36 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
37 SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
39 if test "x$enable_debug" = "xno"; then
40 SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
44 AC_SUBST(SOUP_DEBUG_FLAGS)
47 # ****************************************
61 # ****************************************
66 AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?]))
68 GLIB_CFLAGS=`glib-config --cflags glib`
69 GLIB_LIBS=`glib-config --libs glib`
76 AC_PATH_PROG(XML_CONFIG,xml-config,no)
77 if test x$XML_CONFIG = xno; then
78 AC_MSG_ERROR([Cannot find LIBXML: Is xml-config in path?])
80 XML_CFLAGS=`xml-config --cflags`
81 XML_LIBS=`xml-config --libs`
88 save_CPPFLAGS=$CPPFLAGS
93 AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt is required]))
94 AC_CHECK_HEADERS(popt.h,, AC_MSG_ERROR([popt.h is required]))
102 CPPFLAGS=$save_CPPFLAGS
105 # For proper var substitution in soupConf.sh and soup-apacheConf.sh
106 SOUP_LIBDIR='-L${libdir}'
107 SOUP_INCLUDEDIR=" -I${includedir} $GLIB_CFLAGS $XML_CFLAGS"
108 SOUP_LIBS="-lsoup $GLIB_LIBS $XML_LIBS"
110 AC_SUBST(SOUP_LIBDIR)
111 AC_SUBST(SOUP_INCLUDEDIR)
114 SOUP_APACHE_LIBDIR='-L${libdir}'
115 SOUP_APACHE_INCLUDEDIR="$SOUP_INCLUDEDIR $APACHE_CFLAGS"
116 SOUP_APACHE_LIBS="$SOUP_LIBS -lsoup-apache $APACHE_LIBS"
118 AC_SUBST(SOUP_APACHE_LIBDIR)
119 AC_SUBST(SOUP_APACHE_INCLUDEDIR)
120 AC_SUBST(SOUP_APACHE_LIBS)
122 SOUP_WSDL_LIBDIR='-L${libdir}'
123 SOUP_WSDL_INCLUDEDIR=" -I${includedir} $GLIB_CFLAGS $XML_CFLAGS"
124 SOUP_WSDL_LIBS="-lwsdl $GLIB_LIBS $XML_LIBS"
126 AC_SUBST(SOUP_WSDL_LIBDIR)
127 AC_SUBST(SOUP_WSDL_INCLUDEDIR)
128 AC_SUBST(SOUP_WSDL_LIBS)
133 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h)
134 AC_CHECK_HEADERS(sys/sockio.h sys/poll.h sys/param.h)
136 AC_CHECK_LIB(nsl, main)
137 AC_CHECK_LIB(resolv, main)
139 # Check if we have gethostbyname_r (if so, assume gethostbyaddr_r).
140 AC_CHECK_FUNC(gethostbyname_r,
142 dnl First check for the glibc variant of gethostbyname_r
144 AC_MSG_CHECKING(for glibc gethostbyname_r)
145 AC_TRY_LINK([ #include <netdb.h>],[
146 struct hostent result_buf;
148 struct hostent* result;
151 gethostbyname_r("localhost", &result_buf, buf, sizeof(buf),
155 dnl Have glibc gethostbyname_r
158 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC)
159 HAVE_GETHOSTBYNAME_R=yes
163 dnl If we don't have glibc gethostbyname_r, check
164 dnl for Solaris/Irix gethostbyname_r
167 AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
168 AC_TRY_LINK([ #include <netdb.h>],[
169 struct hostent result;
173 gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);
177 dnl Have Solaris/Irix gethostbyname_r
180 AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS)
181 HAVE_GETHOSTBYNAME_R=yes
184 dnl If don't have Solaris/Irix gethostbyname_r, check
185 dnl for HP-UX gethostbyname_r
188 AC_MSG_CHECKING(for HP-UX gethostbyname_r)
189 AC_TRY_LINK([ #include <netdb.h>],[
190 struct hostent result;
192 gethostbyname_r("localhost", &result, buf);
195 dnl Have HP-UX gethostbyname_r
198 AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX)
199 HAVE_GETHOSTBYNAME_R=yes
206 # If we don't have gethostbyname_r, try to use Glib mutexes
207 if test -z "$HAVE_GETHOSTBYNAME_R"; then
209 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX), [
210 AC_MSG_WARN(You have neither Glib threads nor the function
211 gethostbyname_r. This means that calls to
212 gethostbyname (called by the Soup address
213 functions) will not be thread safe so could
214 malfunction in programs that use threads.)
220 # SSL Library Handling
223 [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],,
226 AC_ARG_WITH(nspr-includes,
227 [ --with-nspr-includes Specify location of Netscape Portable Runtime headers],
228 [nspr_inc_prefix=-I$withval])
230 AC_ARG_WITH(nspr-libs,
231 [ --with-nspr-libs Specify location of Netscape Portable Runtime libs],[nspr_prefix=-L$withval])
233 AC_ARG_WITH(nss-includes,
234 [ --with-nss-includes Specify location of NSS header files],
235 [nss_inc_prefix=-I$withval])
237 AC_ARG_WITH(nss-libs,
238 [ --with-nss-libs Specify location of NSS libs],
239 [nss_prefix=-L$withval])
242 AC_ARG_WITH(openssl-includes,
243 [ --with-openssl-includes Specify location of OpenSSL header files],
244 [openssl_inc_prefix=-I$withval])
246 AC_ARG_WITH(openssl-libs,
247 [ --with-openssl-libs Specify location of OpenSSL libs],
248 [openssl_prefix=-L$withval],
249 [openssl_prefix=-L/usr/lib])
254 if test "x$enable_ssl" = xyes; then
255 save_CPPFLAGS=$CPPFLAGS
256 CPPFLAGS="$openssl_inc_prefix"
257 AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
258 [OPENSSL_CFLAGS="$CPPFLAGS"
259 OPENSSL_LIBS="$openssl_prefix -lssl -lcrypto"
260 enable_openssl="yes"],
265 AC_SUBST(OPENSSL_CFLAGS)
266 AC_SUBST(OPENSSL_LIBS)
267 CPPFLAGS=$save_CPPFLAGS
269 save_CPPFLAGS=$CPPFLAGS
270 CPPFLAGS="$nspr_inc_prefix $nss_inc_prefix"
271 AC_CHECK_HEADERS(prthread.h security/ssl.h security/pk11func.h,
272 [NSS_CFLAGS="$CPPFLAGS"
273 NSS_LIBS="-lpthread $nspr_prefix -lnspr4 $nss_prefix -lnss3 -lssl3"
281 CPPFLAGS=$save_CPPFLAGS
287 AC_PATH_PROG(APXS,apxs,no)
288 if test x$APXS != xno; then
289 APACHE_CFLAGS="-I`apxs -q INCLUDEDIR CFLAGS`"
290 APACHE_LIBS=`apxs -q LDFLAGS_SHLIB LIBS_SHLIB`
292 save_CPPFLAGS=$CPPFLAGS
293 CPPFLAGS=$APACHE_CFLAGS
294 AC_CHECK_HEADERS(httpd.h http_config.h http_core.h http_log.h http_main.h http_protocol.h,
295 [enable_apache="yes"],
298 CPPFLAGS=$save_CPPFLAGS
300 AC_SUBST(APACHE_CFLAGS)
301 AC_SUBST(APACHE_LIBS)
304 dnl type alignment test (based on the one in ORBit)
305 AC_DEFUN(AC_CHECK_ALIGNOF,
306 [changequote(<<, >>)dnl
307 dnl The name to #define.
308 define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
309 dnl The cache variable name.
310 define(<<AC_CV_NAME>>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl
312 AC_MSG_CHECKING(alignment of $1)
313 align_save_libs="$LIBS"
314 LIBS="$GLIB_LIBS $LIBS"
315 AC_CACHE_VAL(AC_CV_NAME,
319 typedef struct {char s1;} gstruct;
320 struct test {char s1; $1 s2;};
323 FILE *f=fopen("conftestval", "w");
325 fprintf(f, "%d\n", &(((struct test*)0)->s2));
327 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, AC_CV_NAME=0)])dnl
328 AC_MSG_RESULT($AC_CV_NAME)
329 LIBS="$align_save_libs"
330 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
331 undefine([AC_TYPE_NAME])dnl
332 undefine([AC_CV_NAME])dnl
335 orig_CPPFLAGS=$CPPFLAGS
336 CPPFLAGS=$GLIB_CFLAGS
337 AC_CHECK_ALIGNOF(gboolean)
338 AC_CHECK_ALIGNOF(gchar)
339 AC_CHECK_ALIGNOF(guchar)
340 AC_CHECK_ALIGNOF(gint)
341 AC_CHECK_ALIGNOF(guint)
342 AC_CHECK_ALIGNOF(gshort)
343 AC_CHECK_ALIGNOF(gushort)
344 AC_CHECK_ALIGNOF(glong)
345 AC_CHECK_ALIGNOF(gulong)
346 AC_CHECK_ALIGNOF(gint8)
347 AC_CHECK_ALIGNOF(guint8)
348 AC_CHECK_ALIGNOF(gint16)
349 AC_CHECK_ALIGNOF(guint16)
350 AC_CHECK_ALIGNOF(gint32)
351 AC_CHECK_ALIGNOF(guint32)
352 AC_CHECK_ALIGNOF(gfloat)
353 AC_CHECK_ALIGNOF(gdouble)
354 AC_CHECK_ALIGNOF(gpointer)
355 AC_CHECK_ALIGNOF(gstruct)
356 CPPFLAGS=$orig_CPPFLAGS
358 AC_ARG_ENABLE(more-warnings,
359 [ --enable-more-warnings Maximum compiler warnings],
360 set_more_warnings="$enableval",
361 set_more_warnings=yes)
363 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
365 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes \
366 -Wnested-externs -Wpointer-arith"
368 # -Wredundant-decls warns about libxml headers
369 # -Wwrite-strings warns when defining GDebugKey structs (solved by
370 # casting the strings in wsdl-trace.c and leaving out -Wcast-qual)
371 WSDL_CFLAGS="-Werror -W -Wundef -Wshadow -Wbad-function-cast -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wmissing-noreturn"
374 AC_SUBST(WSDL_CFLAGS)
376 # Use reentrant functions
377 CFLAGS="$CFLAGS -D_REENTRANT"
388 src/soup-core/Makefile
389 src/soup-wsdl/Makefile
390 src/soup-wsdl-runtime/Makefile
398 Source code location: ${srcdir}
400 Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS}
402 OpenSSL support: ${enable_openssl}
403 Mozilla NSS support: ${enable_nss}
405 Apache module support: ${enable_apache}