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)
20 # ****************************************
23 # Figure out debugging default, prior to $ac_help setup
24 if test `expr $SOUP_REVISION \% 2` = 1 ; then
30 # Declare --enable-* args and collect ac_help strings
32 [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,
33 enable_debug=$debug_default)
36 if test "x$enable_debug" = "xyes"; then
37 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
38 SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
40 if test "x$enable_debug" = "xno"; then
41 SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
45 AC_SUBST(SOUP_DEBUG_FLAGS)
48 # ****************************************
62 # ****************************************
67 AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?]))
69 GLIB_CFLAGS=`glib-config --cflags glib`
70 GLIB_LIBS=`glib-config --libs glib`
77 AC_PATH_PROG(XML_CONFIG,xml-config,no)
78 if test x$XML_CONFIG = xno; then
79 AC_MSG_ERROR([Cannot find LIBXML: Is xml-config in path?])
81 XML_CFLAGS=`xml-config --cflags`
82 XML_LIBS=`xml-config --libs`
89 save_CPPFLAGS=$CPPFLAGS
94 AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt is required]))
95 AC_CHECK_HEADERS(popt.h,, AC_MSG_ERROR([popt.h is required]))
100 AC_SUBST(POPT_CFLAGS)
103 CPPFLAGS=$save_CPPFLAGS
106 # For proper var substitution in soupConf.sh and soup-apacheConf.sh
107 SOUP_LIBDIR='-L${libdir}'
108 SOUP_INCLUDEDIR=" -I${includedir} $GLIB_CFLAGS $XML_CFLAGS"
109 SOUP_LIBS="-lsoup $GLIB_LIBS $XML_LIBS"
111 AC_SUBST(SOUP_LIBDIR)
112 AC_SUBST(SOUP_INCLUDEDIR)
115 SOUP_APACHE_LIBDIR='-L${libdir}'
116 SOUP_APACHE_INCLUDEDIR="$SOUP_INCLUDEDIR $APACHE_CFLAGS"
117 SOUP_APACHE_LIBS="$SOUP_LIBS -lsoup-apache $APACHE_LIBS"
119 AC_SUBST(SOUP_APACHE_LIBDIR)
120 AC_SUBST(SOUP_APACHE_INCLUDEDIR)
121 AC_SUBST(SOUP_APACHE_LIBS)
123 SOUP_WSDL_LIBDIR='-L${libdir}'
124 SOUP_WSDL_INCLUDEDIR=" -I${includedir} $GLIB_CFLAGS $XML_CFLAGS"
125 SOUP_WSDL_LIBS="-lwsdl $GLIB_LIBS $XML_LIBS"
127 AC_SUBST(SOUP_WSDL_LIBDIR)
128 AC_SUBST(SOUP_WSDL_INCLUDEDIR)
129 AC_SUBST(SOUP_WSDL_LIBS)
134 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h)
135 AC_CHECK_HEADERS(sys/sockio.h sys/poll.h sys/param.h)
137 AC_CHECK_LIB(nsl, main)
138 AC_CHECK_LIB(resolv, main)
140 # Check if we have gethostbyname_r (if so, assume gethostbyaddr_r).
141 AC_CHECK_FUNC(gethostbyname_r,
143 dnl First check for the glibc variant of gethostbyname_r
145 AC_MSG_CHECKING(for glibc gethostbyname_r)
146 AC_TRY_LINK([ #include <netdb.h>],[
147 struct hostent result_buf;
149 struct hostent* result;
152 gethostbyname_r("localhost", &result_buf, buf, sizeof(buf),
156 dnl Have glibc gethostbyname_r
159 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC)
160 HAVE_GETHOSTBYNAME_R=yes
164 dnl If we don't have glibc gethostbyname_r, check
165 dnl for Solaris/Irix gethostbyname_r
168 AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
169 AC_TRY_LINK([ #include <netdb.h>],[
170 struct hostent result;
174 gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);
178 dnl Have Solaris/Irix gethostbyname_r
181 AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS)
182 HAVE_GETHOSTBYNAME_R=yes
185 dnl If don't have Solaris/Irix gethostbyname_r, check
186 dnl for HP-UX gethostbyname_r
189 AC_MSG_CHECKING(for HP-UX gethostbyname_r)
190 AC_TRY_LINK([ #include <netdb.h>],[
191 struct hostent result;
193 gethostbyname_r("localhost", &result, buf);
196 dnl Have HP-UX gethostbyname_r
199 AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX)
200 HAVE_GETHOSTBYNAME_R=yes
207 # If we don't have gethostbyname_r, try to use Glib mutexes
208 if test -z "$HAVE_GETHOSTBYNAME_R"; then
210 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX), [
211 AC_MSG_WARN(You have neither Glib threads nor the function
212 gethostbyname_r. This means that calls to
213 gethostbyname (called by the Soup address
214 functions) will not be thread safe so could
215 malfunction in programs that use threads.)
221 # SSL Library Handling
224 [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],,
227 AC_ARG_WITH(nspr-includes,
228 [ --with-nspr-includes Specify location of Netscape Portable Runtime headers],
229 [nspr_inc_prefix=-I$withval])
231 AC_ARG_WITH(nspr-libs,
232 [ --with-nspr-libs Specify location of Netscape Portable Runtime libs],[nspr_prefix=-L$withval])
234 AC_ARG_WITH(nss-includes,
235 [ --with-nss-includes Specify location of NSS header files],
236 [nss_inc_prefix=-I$withval])
238 AC_ARG_WITH(nss-libs,
239 [ --with-nss-libs Specify location of NSS libs],
240 [nss_prefix=-L$withval])
243 AC_ARG_WITH(openssl-includes,
244 [ --with-openssl-includes Specify location of OpenSSL header files],
245 [openssl_inc_prefix=-I$withval])
247 AC_ARG_WITH(openssl-libs,
248 [ --with-openssl-libs Specify location of OpenSSL libs],
249 [openssl_prefix=-L$withval],
250 [openssl_prefix=-L/usr/lib])
255 if test "x$enable_ssl" = xyes; then
256 save_CPPFLAGS=$CPPFLAGS
257 CPPFLAGS="$openssl_inc_prefix"
258 AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
259 [OPENSSL_CFLAGS="$CPPFLAGS"
260 OPENSSL_LIBS="$openssl_prefix -lssl -lcrypto"
261 enable_openssl="yes"],
266 AC_SUBST(OPENSSL_CFLAGS)
267 AC_SUBST(OPENSSL_LIBS)
268 CPPFLAGS=$save_CPPFLAGS
270 save_CPPFLAGS=$CPPFLAGS
271 CPPFLAGS="$nspr_inc_prefix $nss_inc_prefix"
272 AC_CHECK_HEADERS(prthread.h security/ssl.h security/pk11func.h,
273 [NSS_CFLAGS="$CPPFLAGS"
274 NSS_LIBS="-lpthread $nspr_prefix -lnspr4 $nss_prefix -lnss3 -lssl3"
282 CPPFLAGS=$save_CPPFLAGS
288 AC_PATH_PROG(APXS,apxs,no)
289 if test x$APXS != xno; then
290 APACHE_CFLAGS="-I`apxs -q INCLUDEDIR CFLAGS`"
291 APACHE_LIBS=`apxs -q LDFLAGS_SHLIB LIBS_SHLIB`
293 save_CPPFLAGS=$CPPFLAGS
294 CPPFLAGS=$APACHE_CFLAGS
295 AC_CHECK_HEADERS(httpd.h http_config.h http_core.h http_log.h http_main.h http_protocol.h,
296 [enable_apache="yes"],
299 CPPFLAGS=$save_CPPFLAGS
301 AC_SUBST(APACHE_CFLAGS)
302 AC_SUBST(APACHE_LIBS)
305 dnl type alignment test (based on the one in ORBit)
306 AC_DEFUN(AC_CHECK_ALIGNOF,
307 [changequote(<<, >>)dnl
308 dnl The name to #define.
309 define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
310 dnl The cache variable name.
311 define(<<AC_CV_NAME>>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl
313 AC_MSG_CHECKING(alignment of $1)
314 align_save_libs="$LIBS"
315 LIBS="$GLIB_LIBS $LIBS"
316 AC_CACHE_VAL(AC_CV_NAME,
320 typedef struct {char s1;} gstruct;
321 struct test {char s1; $1 s2;};
324 FILE *f=fopen("conftestval", "w");
326 fprintf(f, "%d\n", &(((struct test*)0)->s2));
328 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, AC_CV_NAME=0)])dnl
329 AC_MSG_RESULT($AC_CV_NAME)
330 LIBS="$align_save_libs"
331 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
332 undefine([AC_TYPE_NAME])dnl
333 undefine([AC_CV_NAME])dnl
336 orig_CPPFLAGS=$CPPFLAGS
337 CPPFLAGS=$GLIB_CFLAGS
338 AC_CHECK_ALIGNOF(gboolean)
339 AC_CHECK_ALIGNOF(gchar)
340 AC_CHECK_ALIGNOF(guchar)
341 AC_CHECK_ALIGNOF(gint)
342 AC_CHECK_ALIGNOF(guint)
343 AC_CHECK_ALIGNOF(gshort)
344 AC_CHECK_ALIGNOF(gushort)
345 AC_CHECK_ALIGNOF(glong)
346 AC_CHECK_ALIGNOF(gulong)
347 AC_CHECK_ALIGNOF(gint8)
348 AC_CHECK_ALIGNOF(guint8)
349 AC_CHECK_ALIGNOF(gint16)
350 AC_CHECK_ALIGNOF(guint16)
351 AC_CHECK_ALIGNOF(gint32)
352 AC_CHECK_ALIGNOF(guint32)
353 AC_CHECK_ALIGNOF(gfloat)
354 AC_CHECK_ALIGNOF(gdouble)
355 AC_CHECK_ALIGNOF(gpointer)
356 AC_CHECK_ALIGNOF(gstruct)
357 CPPFLAGS=$orig_CPPFLAGS
359 AC_ARG_ENABLE(more-warnings,
360 [ --enable-more-warnings Maximum compiler warnings],
361 set_more_warnings="$enableval",
362 set_more_warnings=yes)
364 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
366 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes \
367 -Wnested-externs -Wpointer-arith"
369 # -Wredundant-decls warns about libxml headers
370 # -Wwrite-strings warns when defining GDebugKey structs (solved by
371 # casting the strings in wsdl-trace.c and leaving out -Wcast-qual)
372 WSDL_CFLAGS="-Werror -W -Wundef -Wshadow -Wbad-function-cast -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wmissing-noreturn"
375 AC_SUBST(WSDL_CFLAGS)
377 # Use reentrant functions
378 CFLAGS="$CFLAGS -D_REENTRANT"
380 dnl *********************************************
381 dnl *** Checks for gtk-doc (lifted from glib) ***
382 dnl *********************************************
384 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ])
386 if test "x$with_html_dir" = "x" ; then
387 HTML_DIR='${datadir}/gtk-doc/html'
389 HTML_DIR=$with_html_dir
394 AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
396 gtk_doc_min_version=0.6
398 gtk_doc_version=`gtkdoc-mkdb --version`
399 AC_MSG_CHECKING([gtk-doc version ($gtk_doc_version) >= $gtk_doc_min_version])
401 exit (("$gtk_doc_version" =~ /^[[0-9]]+\.[[0-9]]+$/) &&
402 ("$gtk_doc_version" >= "$gtk_doc_min_version") ? 0 : 1);
411 AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
412 AC_SUBST(HAVE_GTK_DOC)
414 AC_CHECK_PROG(DB2HTML, db2html, true, false)
415 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
417 dnl Let people disable the gtk-doc stuff.
418 AC_ARG_ENABLE(gtk-doc, [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
420 if test x$enable_gtk_doc = xauto ; then
421 if test x$GTKDOC = xtrue ; then
428 dnl NOTE: We need to use a separate automake conditional for this
429 dnl to make this work with the tarballs.
430 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
432 dnl *** End of gtk-doc section
442 src/soup-core/Makefile
443 src/soup-wsdl/Makefile
444 src/soup-wsdl-runtime/Makefile
447 docs/reference/Makefile
454 Source code location: ${srcdir}
456 Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS}
458 OpenSSL support: ${enable_openssl}
459 Mozilla NSS support: ${enable_nss}
461 Apache module support: ${enable_apache}