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_HEADERS(openssl/ssl.h openssl/err.h,
324 [OPENSSL_CFLAGS="$CPPFLAGS"
325 OPENSSL_LIBS="$openssl_prefix -lssl -lcrypto"
326 enable_openssl="yes"],
331 AC_SUBST(OPENSSL_CFLAGS)
332 AC_SUBST(OPENSSL_LIBS)
333 CPPFLAGS=$save_CPPFLAGS
335 save_CPPFLAGS=$CPPFLAGS
336 CPPFLAGS="$nspr_inc_prefix $nss_inc_prefix"
337 AC_CHECK_HEADERS(prthread.h security/ssl.h security/pk11func.h,
338 [NSS_CFLAGS="$CPPFLAGS"
339 NSS_LIBS="-lpthread $nspr_prefix -lnspr4 $nss_prefix -lnss3 -lssl3"
347 CPPFLAGS=$save_CPPFLAGS
351 dnl *************************
352 dnl *** Checks for Apache ***
353 dnl *************************
357 AC_PATH_PROG(APXS,apxs,no)
358 if test x$APXS != xno; then
359 APACHE_CFLAGS="-I`apxs -q INCLUDEDIR CFLAGS`"
360 APACHE_LIBS=`apxs -q LDFLAGS_SHLIB LIBS_SHLIB`
362 save_CPPFLAGS=$CPPFLAGS
363 CPPFLAGS=$APACHE_CFLAGS
364 AC_CHECK_HEADERS(httpd.h http_config.h http_core.h http_log.h http_main.h http_protocol.h,
365 [enable_apache="yes"],
368 CPPFLAGS=$save_CPPFLAGS
370 AC_SUBST(APACHE_CFLAGS)
371 AC_SUBST(APACHE_LIBS)
375 dnl *********************************************
376 dnl *** Checks for gtk-doc (lifted from glib) ***
377 dnl *********************************************
379 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH path to installed docs ])
381 if test "x$with_html_dir" = "x" ; then
382 HTML_DIR='${datadir}/gtk-doc/html'
384 HTML_DIR=$with_html_dir
389 AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
390 AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
391 AC_SUBST(HAVE_GTK_DOC)
393 AC_CHECK_PROG(DB2HTML, db2html, true, false)
394 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
396 dnl Let people disable the gtk-doc stuff.
397 AC_ARG_ENABLE(gtk-doc,
398 [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]],
399 enable_gtk_doc="$enableval",
402 if test x$enable_gtk_doc = xauto ; then
403 if test x$GTKDOC = xtrue ; then
410 dnl NOTE: We need to use a separate automake conditional for this
411 dnl to make this work with the tarballs.
412 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
415 dnl *******************************************************
416 dnl *** Type alignment test (based on the one in ORBit) ***
417 dnl *******************************************************
419 AC_DEFUN(AC_CHECK_ALIGNOF,
420 [changequote(<<, >>)dnl
421 dnl The name to #define.
422 define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
423 dnl The cache variable name.
424 define(<<AC_CV_NAME>>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl
426 AC_MSG_CHECKING(alignment of $1)
427 align_save_libs="$LIBS"
428 LIBS="$GLIB_LIBS $LIBS"
429 AC_CACHE_VAL(AC_CV_NAME,
433 typedef struct {char s1;} gstruct;
434 struct test {char s1; $1 s2;};
437 FILE *f=fopen("conftestval", "w");
439 fprintf(f, "%d\n", &(((struct test*)0)->s2));
441 }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, AC_CV_NAME=0)])dnl
442 AC_MSG_RESULT($AC_CV_NAME)
443 LIBS="$align_save_libs"
444 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
445 undefine([AC_TYPE_NAME])dnl
446 undefine([AC_CV_NAME])dnl
449 orig_CPPFLAGS=$CPPFLAGS
450 CPPFLAGS=$GLIB_CFLAGS
451 AC_CHECK_ALIGNOF(gboolean)
452 AC_CHECK_ALIGNOF(gchar)
453 AC_CHECK_ALIGNOF(guchar)
454 AC_CHECK_ALIGNOF(gint)
455 AC_CHECK_ALIGNOF(guint)
456 AC_CHECK_ALIGNOF(gshort)
457 AC_CHECK_ALIGNOF(gushort)
458 AC_CHECK_ALIGNOF(glong)
459 AC_CHECK_ALIGNOF(gulong)
460 AC_CHECK_ALIGNOF(gint8)
461 AC_CHECK_ALIGNOF(guint8)
462 AC_CHECK_ALIGNOF(gint16)
463 AC_CHECK_ALIGNOF(guint16)
464 AC_CHECK_ALIGNOF(gint32)
465 AC_CHECK_ALIGNOF(guint32)
466 AC_CHECK_ALIGNOF(gfloat)
467 AC_CHECK_ALIGNOF(gdouble)
468 AC_CHECK_ALIGNOF(gpointer)
469 AC_CHECK_ALIGNOF(gstruct)
470 CPPFLAGS=$orig_CPPFLAGS
473 dnl *************************************
474 dnl *** Warnings to show if using GCC ***
475 dnl *************************************
477 AC_ARG_ENABLE(more-warnings,
478 [ --disable-more-warnings Inhibit compiler warnings],
479 set_more_warnings=no)
481 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
483 -Wall -Wstrict-prototypes -Wmissing-declarations \
484 -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
487 # Use reentrant functions
488 CFLAGS="$CFLAGS -D_REENTRANT"
491 dnl *************************
492 dnl *** Output Everything ***
493 dnl *************************
501 docs/reference/Makefile
504 src/libsoup-apache/Makefile
506 src/soup-httpd/Makefile
507 src/soup-ssl-proxy/Makefile
508 src/soup-wsdl/Makefile
516 Source code location: ${srcdir}
518 Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS}
520 OpenSSL support: ${enable_openssl}
521 Mozilla NSS support: ${enable_nss}
523 Apache module support: ${enable_apache}