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} $XML_CFLAGS"
108 SOUP_LIBS="-lsoup $XML_LIBS"
110 AC_SUBST(SOUP_LIBDIR)
111 AC_SUBST(SOUP_INCLUDEDIR)
114 SOUP_APACHE_LIBDIR='-L${libdir}'
115 SOUP_APACHE_INCLUDEDIR=" -I${includedir} $APACHE_CFLAGS $XML_CFLAGS"
116 SOUP_APACHE_LIBS="-lsoup -lsoup-apache $APACHE_LIBS $XML_LIBS"
118 AC_SUBST(SOUP_APACHE_LIBDIR)
119 AC_SUBST(SOUP_APACHE_INCLUDEDIR)
120 AC_SUBST(SOUP_APACHE_LIBS)
125 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h)
126 AC_CHECK_HEADERS(sys/sockio.h sys/poll.h sys/param.h)
128 AC_CHECK_LIB(nsl, main)
129 AC_CHECK_LIB(resolv, main)
131 # Check if we have gethostbyname_r (if so, assume gethostbyaddr_r).
132 AC_CHECK_FUNC(gethostbyname_r,
134 dnl First check for the glibc variant of gethostbyname_r
136 AC_MSG_CHECKING(for glibc gethostbyname_r)
137 AC_TRY_LINK([ #include <netdb.h>],[
138 struct hostent result_buf;
140 struct hostent* result;
143 gethostbyname_r("localhost", &result_buf, buf, sizeof(buf),
147 dnl Have glibc gethostbyname_r
150 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC)
151 HAVE_GETHOSTBYNAME_R=yes
155 dnl If we don't have glibc gethostbyname_r, check
156 dnl for Solaris/Irix gethostbyname_r
159 AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
160 AC_TRY_LINK([ #include <netdb.h>],[
161 struct hostent result;
165 gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);
169 dnl Have Solaris/Irix gethostbyname_r
172 AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS)
173 HAVE_GETHOSTBYNAME_R=yes
176 dnl If don't have Solaris/Irix gethostbyname_r, check
177 dnl for HP-UX gethostbyname_r
180 AC_MSG_CHECKING(for HP-UX gethostbyname_r)
181 AC_TRY_LINK([ #include <netdb.h>],[
182 struct hostent result;
184 gethostbyname_r("localhost", &result, buf);
187 dnl Have HP-UX gethostbyname_r
190 AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX)
191 HAVE_GETHOSTBYNAME_R=yes
198 # If we don't have gethostbyname_r, try to use Glib mutexes
199 if test -z "$HAVE_GETHOSTBYNAME_R"; then
201 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX), [
202 AC_MSG_WARN(You have neither Glib threads nor the function
203 gethostbyname_r. This means that calls to
204 gethostbyname (called by the Soup address
205 functions) will not be thread safe so could
206 malfunction in programs that use threads.)
212 # SSL Library Handling
215 [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],,
218 AC_ARG_WITH(nspr-includes,
219 [ --with-nspr-includes Specify location of Netscape Portable Runtime headers],
220 [nspr_inc_prefix=-I$withval])
222 AC_ARG_WITH(nspr-libs,
223 [ --with-nspr-libs Specify location of Netscape Portable Runtime libs],[nspr_prefix=-L$withval])
225 AC_ARG_WITH(nss-includes,
226 [ --with-nss-includes Specify location of NSS header files],
227 [nss_inc_prefix=-I$withval])
229 AC_ARG_WITH(nss-libs,
230 [ --with-nss-libs Specify location of NSS libs],
231 [nss_prefix=-L$withval])
234 AC_ARG_WITH(openssl-includes,
235 [ --with-openssl-includes Specify location of OpenSSL header files],
236 [openssl_inc_prefix=-I$withval])
238 AC_ARG_WITH(openssl-libs,
239 [ --with-openssl-libs Specify location of OpenSSL libs],
240 [openssl_prefix=-L$withval],
241 [openssl_prefix=-L/usr/lib])
246 if test "x$enable_ssl" = xyes; then
247 save_CPPFLAGS=$CPPFLAGS
248 CPPFLAGS="$openssl_inc_prefix"
249 AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
250 [OPENSSL_CFLAGS="$CPPFLAGS"
251 OPENSSL_LIBS="$openssl_prefix -lssl -lcrypto"
252 enable_openssl="yes"],
257 AC_SUBST(OPENSSL_CFLAGS)
258 AC_SUBST(OPENSSL_LIBS)
259 CPPFLAGS=$save_CPPFLAGS
261 save_CPPFLAGS=$CPPFLAGS
262 CPPFLAGS="$nspr_inc_prefix $nss_inc_prefix"
263 AC_CHECK_HEADERS(prthread.h security/ssl.h security/pk11func.h,
264 [NSS_CFLAGS="$CPPFLAGS"
265 NSS_LIBS="-lpthread $nspr_prefix -lnspr4 $nss_prefix -lnss3 -lssl3"
273 CPPFLAGS=$save_CPPFLAGS
279 AC_PATH_PROG(APXS,apxs,no)
280 if test x$APXS != xno; then
281 APACHE_CFLAGS="-I`apxs -q INCLUDEDIR CFLAGS`"
282 APACHE_LIBS=`apxs -q LDFLAGS_SHLIB LIBS_SHLIB`
284 save_CPPFLAGS=$CPPFLAGS
285 CPPFLAGS=$APACHE_CFLAGS
286 AC_CHECK_HEADERS(httpd.h http_config.h http_core.h http_log.h http_main.h http_protocol.h,
287 [enable_apache="yes"],
290 CPPFLAGS=$save_CPPFLAGS
292 AC_SUBST(APACHE_CFLAGS)
293 AC_SUBST(APACHE_LIBS)
297 AC_ARG_ENABLE(more-warnings,
298 [ --enable-more-warnings Maximum compiler warnings],
299 set_more_warnings="$enableval",
300 set_more_warnings=yes)
302 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
304 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes \
305 -Wnested-externs -Wpointer-arith"
306 WSDL_CFLAGS="-Werror"
309 AC_SUBST(WSDL_CFLAGS)
311 # Use reentrant functions
312 CFLAGS="$CFLAGS -D_REENTRANT"
323 src/soup-core/Makefile
324 src/soup-wsdl/Makefile
332 Source code location: ${srcdir}
334 Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS}
336 OpenSSL support: ${enable_openssl}
337 Mozilla NSS support: ${enable_nss}
339 Apache module support: ${enable_apache}