1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
6 AC_INIT(libsoup, 2.3.0)
7 AC_CONFIG_SRCDIR(libsoup.pc.in)
8 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
10 AM_CONFIG_HEADER(config.h)
15 AC_SUBST(SOUP_API_VERSION)
17 # Increment on interface addition. Reset on removal.
20 # Increment on interface add, remove, or change.
23 # Increment on source change. Reset when CURRENT changes.
26 AC_SUBST(SOUP_CURRENT)
27 AC_SUBST(SOUP_REVISION)
30 dnl ***************************
31 dnl *** Set debugging flags ***
32 dnl ***************************
36 # Declare --enable-* args and collect ac_help strings
38 [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,
39 enable_debug=$debug_default)
42 if test "x$enable_debug" = "xyes"; then
43 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
44 SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
46 if test "x$enable_debug" = "xno"; then
47 SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
51 AC_SUBST(SOUP_DEBUG_FLAGS)
54 dnl ***************************
55 dnl *** Checks for programs ***
56 dnl ***************************
68 # This isn't a program, but it doesn't fit anywhere else...
71 dnl ***********************
72 dnl *** Checks for glib ***
73 dnl ***********************
75 AM_PATH_GLIB_2_0(2.4.0,,,gobject gthread)
77 PKG_CHECK_MODULES(XML, libxml-2.0)
81 dnl *********************************
82 dnl *** Networking library checks ***
83 dnl *********************************
85 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
86 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
88 AC_CHECK_FUNCS(inet_pton inet_aton)
90 ### Check if we have gethostbyname_r (if so, assume gethostbyaddr_r).
91 AC_CHECK_FUNC(gethostbyname_r,
93 dnl First check for the glibc variant of gethostbyname_r
95 AC_MSG_CHECKING(for glibc gethostbyname_r)
96 AC_TRY_LINK([ #include <netdb.h>],[
97 struct hostent result_buf;
99 struct hostent* result;
102 gethostbyname_r("localhost", &result_buf, buf, sizeof(buf),
106 dnl Have glibc gethostbyname_r
109 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC, 1,
110 [Define if you have a glibc-style gethostbyname_r()])
111 HAVE_GETHOSTBYNAME_R=yes
115 dnl If we don't have glibc gethostbyname_r, check
116 dnl for Solaris/Irix gethostbyname_r
119 AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
120 AC_TRY_LINK([ #include <netdb.h>],[
121 struct hostent result;
125 gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);
129 dnl Have Solaris/Irix gethostbyname_r
132 AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS, 1,
133 [Define if you have a Solaris-style gethostbyname_r()])
134 HAVE_GETHOSTBYNAME_R=yes
137 dnl If don't have Solaris/Irix gethostbyname_r, check
138 dnl for HP-UX gethostbyname_r
141 AC_MSG_CHECKING(for HP-UX gethostbyname_r)
142 AC_TRY_LINK([ #include <netdb.h>],[
143 struct hostent result;
145 gethostbyname_r("localhost", &result, buf);
148 dnl Have HP-UX gethostbyname_r
151 AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX, 1,
152 [Define if you have an HP-UX-style gethostbyname_r()])
153 HAVE_GETHOSTBYNAME_R=yes
160 # If we don't have gethostbyname_r, we'll use Glib mutexes, but give a warning
161 if test -z "$HAVE_GETHOSTBYNAME_R"; then
162 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX, 1,
163 [Define if you have no gethostbyname_r()])
164 AC_MSG_WARN([You have neither Glib threads nor the function
165 gethostbyname_r. This means that calls to
166 gethostbyname (called by the Soup address
167 functions) will not be thread safe so could
168 malfunction in programs that use threads.])
171 AC_CACHE_CHECK(IPv6 support, soup_cv_ipv6, [
172 AC_EGREP_HEADER(sockaddr_in6, netinet/in.h, soup_cv_ipv6=yes, soup_cv_ipv6=no)
174 case $soup_cv_ipv6 in
176 AC_DEFINE(HAVE_IPV6, 1, [Define if you have support for IPv6 sockets])
180 dnl **********************************
181 dnl *** SSL Library check (GnuTLS) ***
182 dnl **********************************
185 [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],,
188 AC_ARG_ENABLE(ssl-link-static,
189 [ --enable-static-ssl Link with SSL library statically [default=no]],
190 [enable_static_ssl=yes])
192 AC_ARG_ENABLE(libgpg-error,
193 [ --enable-libgpg-error Work around broken libgcrypt-config scripts],
194 enable_libgpg_error=yes, enable_libgpg_error=no)
196 if test "$enable_ssl" != "no"; then
197 AM_PATH_LIBGNUTLS(1.0.0, have_ssl=yes, have_ssl=no)
199 if test "$have_ssl" != "yes"; then
200 if test "$enable_ssl" = "auto"; then
201 AC_MSG_WARN(Disabling SSL support);
204 AC_MSG_ERROR(Could not configure SSL support);
209 LIBGNUTLS_LIBS_STATIC=""
210 if test "$enable_ssl" != "no"; then
211 AC_DEFINE(HAVE_SSL, 1, [Defined if you have SSL support])
213 libgpg_error_libs_static=""
216 if test "$enable_libgpg_error" = "yes"; then
217 AM_PATH_GPG_ERROR("0.4")
218 if test "$GPG_ERROR_LIBS" = ""; then
219 AC_MSG_ERROR([libgpg-error is needed])
221 gpg_error_prefix=$($GPG_ERROR_CONFIG --prefix)
222 libgpg_error_libs_static="$gpg_error_prefix/lib/libgpg-error.a"
223 libgpg_error_libs="$GPG_ERROR_LIBS"
226 if test "$enable_static_ssl" = "yes"; then
227 gnutls_libdir=`$LIBGNUTLS_CONFIG --exec-prefix`/lib
229 LIBGNUTLS_LIBS_STATIC="$gnutls_libdir/libgnutls.a $gnutls_libdir/libgcrypt.a $libgpg_error_libs_static"
233 AC_SUBST(LIBGNUTLS_CFLAGS)
234 AC_SUBST(LIBGNUTLS_LIBS)
235 AC_SUBST(LIBGNUTLS_LIBS_STATIC)
243 dnl *************************************
244 dnl *** Warnings to show if using GCC ***
245 dnl *************************************
247 AC_ARG_ENABLE(more-warnings,
248 [ --disable-more-warnings Inhibit compiler warnings],
249 set_more_warnings=no)
251 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
253 -Wall -Wstrict-prototypes -Wmissing-declarations \
254 -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
257 # Use reentrant functions (FIXME!)
258 CFLAGS="$CFLAGS -D_REENTRANT"
260 dnl *************************
261 dnl *** Output Everything ***
262 dnl *************************
270 docs/reference/Makefile