1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
5 AC_INIT(src/libsoup/soup.h)
7 # Increment on interface addition. Reset on removal.
10 # Increment on interface add, remove, or change.
13 # Increment on source change. Reset when CURRENT changes.
16 AC_SUBST(SOUP_CURRENT)
17 AC_SUBST(SOUP_REVISION)
20 # Update in src/soup-core/soup-private.h for Windows
21 AM_INIT_AUTOMAKE(soup, 0.5.99)
23 AM_CONFIG_HEADER(config.h)
28 dnl ***************************
29 dnl *** Set debugging flags ***
30 dnl ***************************
32 # Figure out debugging default, prior to $ac_help setup
33 if test `expr $SOUP_REVISION \% 2` = 1 ; then
39 # Declare --enable-* args and collect ac_help strings
41 [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,
42 enable_debug=$debug_default)
45 if test "x$enable_debug" = "xyes"; then
46 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
47 SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
49 if test "x$enable_debug" = "xno"; then
50 SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
54 AC_SUBST(SOUP_DEBUG_FLAGS)
57 dnl ***************************
58 dnl *** Checks for programs ***
59 dnl ***************************
72 dnl ***************************
73 dnl *** Checks for glib 1.2 ***
74 dnl ***************************
77 AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?]))
79 GLIB_CFLAGS=`glib-config --cflags glib`
80 GLIB_LIBS=`glib-config --libs glib`
81 GMODULE_LIBS=`glib-config --libs gmodule`
85 AC_SUBST(GMODULE_LIBS)
88 dnl ****************************
89 dnl *** Checks for gnome-xml ***
90 dnl ****************************
94 [ --with-libxml=[1/2] which version of libxml to use [default=$FAVOUR_LIBXML]],,
95 with_libxml=$FAVOUR_LIBXML)
97 if test "x$with_libxml" = "x" -o "$with_libxml" = "yes"; then
98 with_libxml=$FAVOUR_LIBXML
101 if test "$with_libxml" = "1"; then
102 AC_PATH_PROG(XML_CONFIG,xml-config,no)
103 if test x$XML_CONFIG = xno; then
104 AC_MSG_ERROR([Cannot find LIBXML: Is xml-config in path?])
107 XML_MIN_VERSION=1.8.8
109 if test "$with_libxml" = "2"; then
110 AC_PATH_PROG(XML_CONFIG,xml2-config,no)
111 if test x$XML_CONFIG = xno; then
112 AC_MSG_ERROR([Cannot find LIBXML2: Is xml2-config in path?])
115 XML_MIN_VERSION=2.3.10
117 AC_MSG_ERROR(Can't use libxml version $with_libxml)
122 XML_VERSION=`$XML_CONFIG --version`
123 ver=`echo $XML_VERSION | awk -F. '{printf("%d", ($1*1000+$2)*1000+$3);}'`
124 minver=`echo $XML_MIN_VERSION | awk -F. '{printf("%d", ($1*1000+$2)*1000+$3);}'`
125 if test "$minver" -gt "$ver"
127 AC_MSG_ERROR(Found libxml version $XML_VERSION. You need $XML_MIN_VERSION or newer)
130 XML_CFLAGS=`$XML_CONFIG --cflags`
131 XML_LIBS=`$XML_CONFIG --libs`
137 dnl ***********************
138 dnl *** Checks for popt ***
139 dnl ***********************
141 save_CPPFLAGS=$CPPFLAGS
146 AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt is required]))
147 AC_CHECK_HEADERS(popt.h,, AC_MSG_ERROR([popt.h is required]))
149 POPT_CFLAGS=$CPPFLAGS
152 AC_SUBST(POPT_CFLAGS)
155 CPPFLAGS=$save_CPPFLAGS
159 dnl **********************************************
160 dnl *** Variable substitution for soup*Conf.sh ***
161 dnl **********************************************
164 SOUP_LIBDIR='-L${libdir}'
165 SOUP_INCLUDEDIR=" -I${includedir}/soup $GLIB_CFLAGS $XML_CFLAGS"
166 SOUP_LIBS="-lsoup $GLIB_LIBS $XML_LIBS"
168 AC_SUBST(SOUP_LIBDIR)
169 AC_SUBST(SOUP_INCLUDEDIR)
172 ### soup-apacheConf.sh
173 SOUP_APACHE_LIBDIR='-L${libdir}'
174 SOUP_APACHE_INCLUDEDIR="$SOUP_INCLUDEDIR $APACHE_CFLAGS"
175 SOUP_APACHE_LIBS="$SOUP_LIBS -lsoup-apache $APACHE_LIBS"
177 AC_SUBST(SOUP_APACHE_LIBDIR)
178 AC_SUBST(SOUP_APACHE_INCLUDEDIR)
179 AC_SUBST(SOUP_APACHE_LIBS)
182 SOUP_WSDL_LIBDIR='-L${libdir}'
183 SOUP_WSDL_INCLUDEDIR=" -I${includedir}/soup $GLIB_CFLAGS $XML_CFLAGS"
184 SOUP_WSDL_LIBS="$SOUP_LIBS -lwsdl"
186 AC_SUBST(SOUP_WSDL_LIBDIR)
187 AC_SUBST(SOUP_WSDL_INCLUDEDIR)
188 AC_SUBST(SOUP_WSDL_LIBS)
191 dnl *********************************
192 dnl *** Networking library checks ***
193 dnl *********************************
195 AC_CHECK_HEADERS(unistd.h)
196 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h)
197 AC_CHECK_HEADERS(sys/socket.h sys/sockio.h sys/poll.h sys/param.h sys/wait.h)
199 AC_CHECK_LIB(nsl, main)
200 AC_CHECK_LIB(resolv, main)
204 ### Check if we have gethostbyname_r (if so, assume gethostbyaddr_r).
205 AC_CHECK_FUNC(gethostbyname_r,
207 dnl First check for the glibc variant of gethostbyname_r
209 AC_MSG_CHECKING(for glibc gethostbyname_r)
210 AC_TRY_LINK([ #include <netdb.h>],[
211 struct hostent result_buf;
213 struct hostent* result;
216 gethostbyname_r("localhost", &result_buf, buf, sizeof(buf),
220 dnl Have glibc gethostbyname_r
223 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC)
224 HAVE_GETHOSTBYNAME_R=yes
228 dnl If we don't have glibc gethostbyname_r, check
229 dnl for Solaris/Irix gethostbyname_r
232 AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
233 AC_TRY_LINK([ #include <netdb.h>],[
234 struct hostent result;
238 gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);
242 dnl Have Solaris/Irix gethostbyname_r
245 AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS)
246 HAVE_GETHOSTBYNAME_R=yes
249 dnl If don't have Solaris/Irix gethostbyname_r, check
250 dnl for HP-UX gethostbyname_r
253 AC_MSG_CHECKING(for HP-UX gethostbyname_r)
254 AC_TRY_LINK([ #include <netdb.h>],[
255 struct hostent result;
257 gethostbyname_r("localhost", &result, buf);
260 dnl Have HP-UX gethostbyname_r
263 AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX)
264 HAVE_GETHOSTBYNAME_R=yes
271 ### If we don't have gethostbyname_r, try to use Glib mutexes
272 if test -z "$HAVE_GETHOSTBYNAME_R"; then
274 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX), [
275 AC_MSG_WARN(You have neither Glib threads nor the function
276 gethostbyname_r. This means that calls to
277 gethostbyname (called by the Soup address
278 functions) will not be thread safe so could
279 malfunction in programs that use threads.)
284 dnl ****************************************************
285 dnl *** SSL Library checks (Mozilla NSS, or OpenSSL) ***
286 dnl ****************************************************
289 [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],,
292 AC_ARG_WITH(nspr-includes,
293 [ --with-nspr-includes Specify location of Netscape Portable Runtime headers],
294 [nspr_inc_prefix=-I$withval])
296 AC_ARG_WITH(nspr-libs,
297 [ --with-nspr-libs Specify location of Netscape Portable Runtime libs],[nspr_prefix=-L$withval])
299 AC_ARG_WITH(nss-includes,
300 [ --with-nss-includes Specify location of NSS header files],
301 [nss_inc_prefix=-I$withval])
303 AC_ARG_WITH(nss-libs,
304 [ --with-nss-libs Specify location of NSS libs],
305 [nss_prefix=-L$withval])
308 AC_ARG_WITH(openssl-includes,
309 [ --with-openssl-includes Specify location of OpenSSL header files],
310 [openssl_inc_prefix=-I$withval])
312 AC_ARG_WITH(openssl-libs,
313 [ --with-openssl-libs Specify location of OpenSSL libs],
314 [openssl_prefix=-L$withval],
315 [openssl_prefix=-L/usr/lib])
320 if test "x$enable_ssl" = xyes; then
321 save_CPPFLAGS=$CPPFLAGS
322 CPPFLAGS="$openssl_inc_prefix"
323 AC_CHECK_LIB(dl, dlopen, DL_LDFLAGS="-ldl", DL_LDFLAGS="")
324 AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
325 [OPENSSL_CFLAGS="$CPPFLAGS"
326 OPENSSL_LIBS="$openssl_prefix -lssl -lcrypto $DL_LDFLAGS"
327 enable_openssl="yes"],
332 AC_SUBST(OPENSSL_CFLAGS)
333 AC_SUBST(OPENSSL_LIBS)
334 CPPFLAGS=$save_CPPFLAGS
336 if test "x$enable_openssl" = xyes; then
337 AC_DEFINE(HAVE_OPENSSL)
340 save_CPPFLAGS=$CPPFLAGS
341 CPPFLAGS="$nspr_inc_prefix $nss_inc_prefix"
342 AC_CHECK_HEADERS(nss.h ssl.h pk11func.h,
343 [NSS_CFLAGS="$CPPFLAGS"
344 NSS_LIBS="-lpthread $nspr_prefix -lnspr4 -lplc4 -lplds4 $nss_prefix -lnss3 -lssl3"
352 CPPFLAGS=$save_CPPFLAGS
354 if test "x$enable_nss" = xyes; then
360 dnl *************************
361 dnl *** Checks for Apache ***
362 dnl *************************
366 AC_PATH_PROG(APXS,apxs,no)
367 if test x$APXS != xno; then
368 APACHE_CFLAGS="-I`apxs -q INCLUDEDIR CFLAGS`"
369 APACHE_LIBS=`apxs -q LDFLAGS_SHLIB LIBS_SHLIB`
371 save_CPPFLAGS=$CPPFLAGS
372 CPPFLAGS=$APACHE_CFLAGS
373 AC_CHECK_HEADERS(httpd.h http_config.h http_core.h http_log.h http_main.h http_protocol.h,
374 [enable_apache="yes"],
377 CPPFLAGS=$save_CPPFLAGS
379 AC_SUBST(APACHE_CFLAGS)
380 AC_SUBST(APACHE_LIBS)
384 dnl *********************************************
385 dnl *** Checks for gtk-doc (lifted from glib) ***
386 dnl *********************************************
388 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Path to installed docs ])
390 if test "x$with_html_dir" = "x" ; then
391 HTML_DIR='${datadir}/gtk-doc/html'
393 HTML_DIR=$with_html_dir
398 AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
399 AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
400 AC_SUBST(HAVE_GTK_DOC)
402 AC_CHECK_PROG(DB2HTML, db2html, true, false)
403 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
405 dnl Let people disable the gtk-doc stuff.
406 AC_ARG_ENABLE(gtk-doc,
407 [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]],
408 enable_gtk_doc="$enableval",
411 if test x$enable_gtk_doc = xauto ; then
412 if test x$GTKDOC = xtrue ; then
419 dnl NOTE: We need to use a separate automake conditional for this
420 dnl to make this work with the tarballs.
421 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
424 dnl *******************************************************
425 dnl *** Type alignment test (based on the one in ORBit) ***
426 dnl *******************************************************
428 AC_DEFUN(AC_CHECK_ALIGNOF,
429 [changequote(<<, >>)dnl
430 dnl The name to #define.
431 define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
432 dnl The cache variable name.
433 define(<<AC_CV_NAME>>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl
435 AC_MSG_CHECKING(alignment of $1)
436 align_save_libs="$LIBS"
437 LIBS="$GLIB_LIBS $LIBS"
438 AC_CACHE_VAL(AC_CV_NAME,
442 typedef struct {char s1;} gstruct;
443 struct test {char s1; $1 s2;};
446 FILE *f=fopen("conftestval", "w");
448 fprintf(f, "%d\n", &(((struct test*)0)->s2));
450 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, AC_CV_NAME=0)])dnl
451 AC_MSG_RESULT($AC_CV_NAME)
452 LIBS="$align_save_libs"
453 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
454 undefine([AC_TYPE_NAME])dnl
455 undefine([AC_CV_NAME])dnl
458 orig_CPPFLAGS=$CPPFLAGS
459 CPPFLAGS=$GLIB_CFLAGS
460 AC_CHECK_ALIGNOF(gboolean)
461 AC_CHECK_ALIGNOF(gchar)
462 AC_CHECK_ALIGNOF(guchar)
463 AC_CHECK_ALIGNOF(gint)
464 AC_CHECK_ALIGNOF(guint)
465 AC_CHECK_ALIGNOF(gshort)
466 AC_CHECK_ALIGNOF(gushort)
467 AC_CHECK_ALIGNOF(glong)
468 AC_CHECK_ALIGNOF(gulong)
469 AC_CHECK_ALIGNOF(gint8)
470 AC_CHECK_ALIGNOF(guint8)
471 AC_CHECK_ALIGNOF(gint16)
472 AC_CHECK_ALIGNOF(guint16)
473 AC_CHECK_ALIGNOF(gint32)
474 AC_CHECK_ALIGNOF(guint32)
475 AC_CHECK_ALIGNOF(gfloat)
476 AC_CHECK_ALIGNOF(gdouble)
477 AC_CHECK_ALIGNOF(gpointer)
478 AC_CHECK_ALIGNOF(gstruct)
479 CPPFLAGS=$orig_CPPFLAGS
482 dnl *************************************
483 dnl *** Warnings to show if using GCC ***
484 dnl *************************************
486 AC_ARG_ENABLE(more-warnings,
487 [ --disable-more-warnings Inhibit compiler warnings],
488 set_more_warnings=no)
490 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
492 -Wall -Wstrict-prototypes -Wmissing-declarations \
493 -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
496 # Use reentrant functions
497 CFLAGS="$CFLAGS -D_REENTRANT"
500 dnl *************************
501 dnl *** Output Everything ***
502 dnl *************************
510 docs/reference/Makefile
513 src/libsoup-apache/Makefile
515 src/soup-httpd/Makefile
516 src/soup-ssl-proxy/Makefile
517 src/soup-wsdl/Makefile
525 Source code location: ${srcdir}
527 Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS}
529 OpenSSL support: ${enable_openssl}
530 Mozilla NSS support: ${enable_nss}
532 Apache module support: ${enable_apache}