1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
5 AC_INIT(src/soup-core/soup.h)
11 AC_SUBST(SOUP_CURRENT)
12 AC_SUBST(SOUP_REVISION)
15 AM_CONFIG_HEADER(config.h)
16 AM_INIT_AUTOMAKE(soup, 0.4.1)
21 dnl ***************************
22 dnl *** Set debugging flags ***
23 dnl ***************************
25 # Figure out debugging default, prior to $ac_help setup
26 if test `expr $SOUP_REVISION \% 2` = 1 ; then
32 # Declare --enable-* args and collect ac_help strings
34 [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,
35 enable_debug=$debug_default)
38 if test "x$enable_debug" = "xyes"; then
39 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
40 SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
42 if test "x$enable_debug" = "xno"; then
43 SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
47 AC_SUBST(SOUP_DEBUG_FLAGS)
50 dnl ***************************
51 dnl *** Checks for programs ***
52 dnl ***************************
65 dnl ***************************
66 dnl *** Checks for glib 1.2 ***
67 dnl ***************************
70 AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?]))
72 GLIB_CFLAGS=`glib-config --cflags glib`
73 GLIB_LIBS=`glib-config --libs glib`
74 GMODULE_LIBS=`glib-config --libs gmodule`
78 AC_SUBST(GMODULE_LIBS)
81 dnl ****************************
82 dnl *** Checks for gnome-xml ***
83 dnl ****************************
87 [ --with-libxml=[1/2] which version of libxml to use [default=$FAVOUR_LIBXML]],,
88 with_libxml=$FAVOUR_LIBXML)
90 if test "x$with_libxml" = "x" -o "$with_libxml" = "yes"; then
91 with_libxml=$FAVOUR_LIBXML
94 if test "$with_libxml" = "1"; then
95 AC_PATH_PROG(XML_CONFIG,xml-config,no)
96 if test x$XML_CONFIG = xno; then
97 AC_MSG_ERROR([Cannot find LIBXML: Is xml-config in path?])
100 XML_MIN_VERSION=1.8.8
102 if test "$with_libxml" = "2"; then
103 AC_PATH_PROG(XML_CONFIG,xml2-config,no)
104 if test x$XML_CONFIG = xno; then
105 AC_MSG_ERROR([Cannot find LIBXML2: Is xml2-config in path?])
108 XML_MIN_VERSION=2.3.10
110 AC_MSG_ERROR(Can't use libxml version $with_libxml)
115 XML_VERSION=`$XML_CONFIG --version`
116 ver=`echo $XML_VERSION | awk -F. '{printf("%d", ($1*1000+$2)*1000+$3);}'`
117 minver=`echo $XML_MIN_VERSION | awk -F. '{printf("%d", ($1*1000+$2)*1000+$3);}'`
118 if test "$minver" -gt "$ver"
120 AC_MSG_ERROR(Found libxml version $XML_VERSION. You need $XML_MIN_VERSION or newer)
123 XML_CFLAGS=`$XML_CONFIG --cflags`
124 XML_LIBS=`$XML_CONFIG --libs`
130 dnl ***********************
131 dnl *** Checks for popt ***
132 dnl ***********************
134 save_CPPFLAGS=$CPPFLAGS
139 AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt is required]))
140 AC_CHECK_HEADERS(popt.h,, AC_MSG_ERROR([popt.h is required]))
142 POPT_CFLAGS=$CPPFLAGS
145 AC_SUBST(POPT_CFLAGS)
148 CPPFLAGS=$save_CPPFLAGS
152 dnl **********************************************
153 dnl *** Variable substitution for soup*Conf.sh ***
154 dnl **********************************************
157 SOUP_LIBDIR='-L${libdir}'
158 SOUP_INCLUDEDIR=" -I${includedir} $GLIB_CFLAGS $XML_CFLAGS"
159 SOUP_LIBS="-lsoup $GLIB_LIBS $XML_LIBS"
161 AC_SUBST(SOUP_LIBDIR)
162 AC_SUBST(SOUP_INCLUDEDIR)
165 ### soup-apacheConf.sh
166 SOUP_APACHE_LIBDIR='-L${libdir}'
167 SOUP_APACHE_INCLUDEDIR="$SOUP_INCLUDEDIR $APACHE_CFLAGS"
168 SOUP_APACHE_LIBS="$SOUP_LIBS -lsoup-apache $APACHE_LIBS"
170 AC_SUBST(SOUP_APACHE_LIBDIR)
171 AC_SUBST(SOUP_APACHE_INCLUDEDIR)
172 AC_SUBST(SOUP_APACHE_LIBS)
175 SOUP_WSDL_LIBDIR='-L${libdir}'
176 SOUP_WSDL_INCLUDEDIR=" -I${includedir} $GLIB_CFLAGS $XML_CFLAGS"
177 SOUP_WSDL_LIBS="-lwsdl $GLIB_LIBS $XML_LIBS"
179 AC_SUBST(SOUP_WSDL_LIBDIR)
180 AC_SUBST(SOUP_WSDL_INCLUDEDIR)
181 AC_SUBST(SOUP_WSDL_LIBS)
184 dnl *********************************
185 dnl *** Networking library checks ***
186 dnl *********************************
188 AC_CHECK_HEADERS(unistd.h)
189 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h)
190 AC_CHECK_HEADERS(sys/socket.h sys/sockio.h sys/poll.h sys/param.h sys/wait.h)
192 AC_CHECK_LIB(nsl, main)
193 AC_CHECK_LIB(resolv, main)
195 ### Check if we have gethostbyname_r (if so, assume gethostbyaddr_r).
196 AC_CHECK_FUNC(gethostbyname_r,
198 dnl First check for the glibc variant of gethostbyname_r
200 AC_MSG_CHECKING(for glibc gethostbyname_r)
201 AC_TRY_LINK([ #include <netdb.h>],[
202 struct hostent result_buf;
204 struct hostent* result;
207 gethostbyname_r("localhost", &result_buf, buf, sizeof(buf),
211 dnl Have glibc gethostbyname_r
214 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC)
215 HAVE_GETHOSTBYNAME_R=yes
219 dnl If we don't have glibc gethostbyname_r, check
220 dnl for Solaris/Irix gethostbyname_r
223 AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
224 AC_TRY_LINK([ #include <netdb.h>],[
225 struct hostent result;
229 gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);
233 dnl Have Solaris/Irix gethostbyname_r
236 AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS)
237 HAVE_GETHOSTBYNAME_R=yes
240 dnl If don't have Solaris/Irix gethostbyname_r, check
241 dnl for HP-UX gethostbyname_r
244 AC_MSG_CHECKING(for HP-UX gethostbyname_r)
245 AC_TRY_LINK([ #include <netdb.h>],[
246 struct hostent result;
248 gethostbyname_r("localhost", &result, buf);
251 dnl Have HP-UX gethostbyname_r
254 AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX)
255 HAVE_GETHOSTBYNAME_R=yes
262 ### If we don't have gethostbyname_r, try to use Glib mutexes
263 if test -z "$HAVE_GETHOSTBYNAME_R"; then
265 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX), [
266 AC_MSG_WARN(You have neither Glib threads nor the function
267 gethostbyname_r. This means that calls to
268 gethostbyname (called by the Soup address
269 functions) will not be thread safe so could
270 malfunction in programs that use threads.)
275 dnl ****************************************************
276 dnl *** SSL Library checks (Mozilla NSS, or OpenSSL) ***
277 dnl ****************************************************
280 [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],,
283 AC_ARG_WITH(nspr-includes,
284 [ --with-nspr-includes Specify location of Netscape Portable Runtime headers],
285 [nspr_inc_prefix=-I$withval])
287 AC_ARG_WITH(nspr-libs,
288 [ --with-nspr-libs Specify location of Netscape Portable Runtime libs],[nspr_prefix=-L$withval])
290 AC_ARG_WITH(nss-includes,
291 [ --with-nss-includes Specify location of NSS header files],
292 [nss_inc_prefix=-I$withval])
294 AC_ARG_WITH(nss-libs,
295 [ --with-nss-libs Specify location of NSS libs],
296 [nss_prefix=-L$withval])
299 AC_ARG_WITH(openssl-includes,
300 [ --with-openssl-includes Specify location of OpenSSL header files],
301 [openssl_inc_prefix=-I$withval])
303 AC_ARG_WITH(openssl-libs,
304 [ --with-openssl-libs Specify location of OpenSSL libs],
305 [openssl_prefix=-L$withval],
306 [openssl_prefix=-L/usr/lib])
311 if test "x$enable_ssl" = xyes; then
312 save_CPPFLAGS=$CPPFLAGS
313 CPPFLAGS="$openssl_inc_prefix"
314 AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
315 [OPENSSL_CFLAGS="$CPPFLAGS"
316 OPENSSL_LIBS="$openssl_prefix -lssl -lcrypto"
317 enable_openssl="yes"],
322 AC_SUBST(OPENSSL_CFLAGS)
323 AC_SUBST(OPENSSL_LIBS)
324 CPPFLAGS=$save_CPPFLAGS
326 save_CPPFLAGS=$CPPFLAGS
327 CPPFLAGS="$nspr_inc_prefix $nss_inc_prefix"
328 AC_CHECK_HEADERS(prthread.h security/ssl.h security/pk11func.h,
329 [NSS_CFLAGS="$CPPFLAGS"
330 NSS_LIBS="-lpthread $nspr_prefix -lnspr4 $nss_prefix -lnss3 -lssl3"
338 CPPFLAGS=$save_CPPFLAGS
342 dnl *************************
343 dnl *** Checks for Apache ***
344 dnl *************************
348 AC_PATH_PROG(APXS,apxs,no)
349 if test x$APXS != xno; then
350 APACHE_CFLAGS="-I`apxs -q INCLUDEDIR CFLAGS`"
351 APACHE_LIBS=`apxs -q LDFLAGS_SHLIB LIBS_SHLIB`
353 save_CPPFLAGS=$CPPFLAGS
354 CPPFLAGS=$APACHE_CFLAGS
355 AC_CHECK_HEADERS(httpd.h http_config.h http_core.h http_log.h http_main.h http_protocol.h,
356 [enable_apache="yes"],
359 CPPFLAGS=$save_CPPFLAGS
361 AC_SUBST(APACHE_CFLAGS)
362 AC_SUBST(APACHE_LIBS)
366 dnl *********************************************
367 dnl *** Checks for gtk-doc (lifted from glib) ***
368 dnl *********************************************
370 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ])
372 if test "x$with_html_dir" = "x" ; then
373 HTML_DIR='${datadir}/gtk-doc/html'
375 HTML_DIR=$with_html_dir
380 AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
381 AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
382 AC_SUBST(HAVE_GTK_DOC)
384 AC_CHECK_PROG(DB2HTML, db2html, true, false)
385 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
387 dnl Let people disable the gtk-doc stuff.
388 AC_ARG_ENABLE(gtk-doc, [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
390 if test x$enable_gtk_doc = xauto ; then
391 if test x$GTKDOC = xtrue ; then
398 dnl NOTE: We need to use a separate automake conditional for this
399 dnl to make this work with the tarballs.
400 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
403 dnl *******************************************************
404 dnl *** Type alignment test (based on the one in ORBit) ***
405 dnl *******************************************************
407 AC_DEFUN(AC_CHECK_ALIGNOF,
408 [changequote(<<, >>)dnl
409 dnl The name to #define.
410 define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
411 dnl The cache variable name.
412 define(<<AC_CV_NAME>>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl
414 AC_MSG_CHECKING(alignment of $1)
415 align_save_libs="$LIBS"
416 LIBS="$GLIB_LIBS $LIBS"
417 AC_CACHE_VAL(AC_CV_NAME,
421 typedef struct {char s1;} gstruct;
422 struct test {char s1; $1 s2;};
425 FILE *f=fopen("conftestval", "w");
427 fprintf(f, "%d\n", &(((struct test*)0)->s2));
429 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, AC_CV_NAME=0)])dnl
430 AC_MSG_RESULT($AC_CV_NAME)
431 LIBS="$align_save_libs"
432 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
433 undefine([AC_TYPE_NAME])dnl
434 undefine([AC_CV_NAME])dnl
437 orig_CPPFLAGS=$CPPFLAGS
438 CPPFLAGS=$GLIB_CFLAGS
439 AC_CHECK_ALIGNOF(gboolean)
440 AC_CHECK_ALIGNOF(gchar)
441 AC_CHECK_ALIGNOF(guchar)
442 AC_CHECK_ALIGNOF(gint)
443 AC_CHECK_ALIGNOF(guint)
444 AC_CHECK_ALIGNOF(gshort)
445 AC_CHECK_ALIGNOF(gushort)
446 AC_CHECK_ALIGNOF(glong)
447 AC_CHECK_ALIGNOF(gulong)
448 AC_CHECK_ALIGNOF(gint8)
449 AC_CHECK_ALIGNOF(guint8)
450 AC_CHECK_ALIGNOF(gint16)
451 AC_CHECK_ALIGNOF(guint16)
452 AC_CHECK_ALIGNOF(gint32)
453 AC_CHECK_ALIGNOF(guint32)
454 AC_CHECK_ALIGNOF(gfloat)
455 AC_CHECK_ALIGNOF(gdouble)
456 AC_CHECK_ALIGNOF(gpointer)
457 AC_CHECK_ALIGNOF(gstruct)
458 CPPFLAGS=$orig_CPPFLAGS
461 dnl *************************************
462 dnl *** Warnings to show if using GCC ***
463 dnl *************************************
465 AC_ARG_ENABLE(more-warnings,
466 [ --enable-more-warnings Maximum compiler warnings],
467 set_more_warnings="$enableval",
468 set_more_warnings=no)
470 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
472 -Wall -Wstrict-prototypes -Wmissing-declarations \
473 -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
475 # -Wredundant-decls warns about libxml headers
476 # -Wwrite-strings warns when defining GDebugKey structs (solved by
477 # casting the strings in wsdl-trace.c and leaving out -Wcast-qual)
478 WSDL_CFLAGS="-W -Wundef -Wshadow -Wbad-function-cast \
479 -Wcast-align -Wwrite-strings -Wconversion \
480 -Waggregate-return -Wmissing-noreturn"
482 AC_SUBST(WSDL_CFLAGS)
485 # Use reentrant functions
486 CFLAGS="$CFLAGS -D_REENTRANT"
489 dnl *************************
490 dnl *** Output Everything ***
491 dnl *************************
499 docs/reference/Makefile
501 src/soup-core/Makefile
502 src/soup-wsdl/Makefile
503 src/soup-wsdl-runtime/Makefile
511 Source code location: ${srcdir}
513 Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS}
515 OpenSSL support: ${enable_openssl}
516 Mozilla NSS support: ${enable_nss}
518 Apache module support: ${enable_apache}