1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
6 AC_INIT(libsoup, 2.1.1)
7 AC_CONFIG_SRCDIR(libsoup-2.2.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.0.0,,,gobject)
77 dnl *********************************
78 dnl *** Networking library checks ***
79 dnl *********************************
81 AC_CHECK_HEADERS(sys/sockio.h sys/poll.h sys/param.h)
82 AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
84 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
85 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
87 AC_CHECK_FUNCS(inet_pton inet_aton)
89 ### Check if we have gethostbyname_r (if so, assume gethostbyaddr_r).
90 AC_CHECK_FUNC(gethostbyname_r,
92 dnl First check for the glibc variant of gethostbyname_r
94 AC_MSG_CHECKING(for glibc gethostbyname_r)
95 AC_TRY_LINK([ #include <netdb.h>],[
96 struct hostent result_buf;
98 struct hostent* result;
101 gethostbyname_r("localhost", &result_buf, buf, sizeof(buf),
105 dnl Have glibc gethostbyname_r
108 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC, 1,
109 [Define if you have a glibc-style gethostbyname_r()])
110 HAVE_GETHOSTBYNAME_R=yes
114 dnl If we don't have glibc gethostbyname_r, check
115 dnl for Solaris/Irix gethostbyname_r
118 AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
119 AC_TRY_LINK([ #include <netdb.h>],[
120 struct hostent result;
124 gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);
128 dnl Have Solaris/Irix gethostbyname_r
131 AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS, 1,
132 [Define if you have a Solaris-style gethostbyname_r()])
133 HAVE_GETHOSTBYNAME_R=yes
136 dnl If don't have Solaris/Irix gethostbyname_r, check
137 dnl for HP-UX gethostbyname_r
140 AC_MSG_CHECKING(for HP-UX gethostbyname_r)
141 AC_TRY_LINK([ #include <netdb.h>],[
142 struct hostent result;
144 gethostbyname_r("localhost", &result, buf);
147 dnl Have HP-UX gethostbyname_r
150 AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX, 1,
151 [Define if you have an HP-UX-style gethostbyname_r()])
152 HAVE_GETHOSTBYNAME_R=yes
159 # If we don't have gethostbyname_r, we'll use Glib mutexes, but give a warning
160 if test -z "$HAVE_GETHOSTBYNAME_R"; then
161 AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX, 1,
162 [Define if you have no gethostbyname_r()])
163 AC_MSG_WARN([You have neither Glib threads nor the function
164 gethostbyname_r. This means that calls to
165 gethostbyname (called by the Soup address
166 functions) will not be thread safe so could
167 malfunction in programs that use threads.])
170 AC_CACHE_CHECK(IPv6 support, soup_cv_ipv6, [
171 AC_EGREP_HEADER(sockaddr_in6, netinet/in.h, soup_cv_ipv6=yes, soup_cv_ipv6=no)
173 case $soup_cv_ipv6 in
175 AC_DEFINE(HAVE_IPV6, 1, [Define if you have support for IPv6 sockets])
179 dnl **********************************
180 dnl *** SSL Library check (GnuTLS) ***
181 dnl **********************************
184 [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],,
187 AC_ARG_ENABLE(ssl-link-static,
188 [ --enable-static-ssl Link with SSL library statically [default=no]],
189 [enable_static_ssl=yes])
191 AC_ARG_ENABLE(libgpg-error,
192 [ --enable-libgpg-error Work around broken libgcrypt-config scripts],
193 enable_libgpg_error=yes, enable_libgpg_error=no)
198 libgpg_error_libs_static=""
201 if test "x$enable_libgpg_error" = "xyes"; then
202 AM_PATH_GPG_ERROR("0.4")
203 if test "x$GPG_ERROR_LIBS" = "x"; then
204 AC_MSG_ERROR([libgpg-error is needed])
206 gpg_error_prefix=$($GPG_ERROR_CONFIG --prefix)
207 libgpg_error_libs_static="$gpg_error_prefix/lib/libgpg-error.a"
208 libgpg_error_libs="$GPG_ERROR_LIBS"
211 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
212 case $LIBGNUTLS_CONFIG in
214 AC_MSG_WARN(Disabling SSL support)
220 GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags | sed -e 's:-I/usr/include::'`
221 GNUTLS_LIBS="`$LIBGNUTLS_CONFIG --libs | sed -e 's:-L/usr/lib *::'` $libgpg_error_libs"
223 save_CPPFLAGS="$CPPFLAGS"
224 CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS"
225 AC_CHECK_HEADERS(gnutls/gnutls.h,,
226 [AC_MSG_WARN(Disabling SSL support)
229 CPPFLAGS="$save_CPPFLAGS"
231 case $enable_static_ssl in
233 gnutls_libdir=`$LIBGNUTLS_CONFIG --exec-prefix`/lib
234 GNUTLS_LIBS="$gnutls_libdir/libgnutls.a $gnutls_libdir/libgcrypt.a $libgpg_error_libs_static"
238 AC_DEFINE(HAVE_SSL, 1, [Defined if you have SSL support])
242 AC_SUBST(GNUTLS_CFLAGS)
243 AC_SUBST(GNUTLS_LIBS)
246 dnl *********************************************
247 dnl *** Checks for gtk-doc (lifted from glib) ***
248 dnl *********************************************
250 AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Path to installed docs ])
252 if test "x$with_html_dir" = "x" ; then
253 HTML_DIR='${datadir}/gtk-doc/html'
255 HTML_DIR=$with_html_dir
260 AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
261 AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
262 AC_SUBST(HAVE_GTK_DOC)
264 AC_CHECK_PROG(DB2HTML, db2html, true, false)
265 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
267 dnl Let people disable the gtk-doc stuff.
268 AC_ARG_ENABLE(gtk-doc,
269 [ --enable-gtk-doc Use gtk-doc to build documentation [default=auto]],
270 enable_gtk_doc="$enableval",
273 if test x$enable_gtk_doc = xauto ; then
274 if test x$GTKDOC = xtrue ; then
281 dnl NOTE: We need to use a separate automake conditional for this
282 dnl to make this work with the tarballs.
283 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
286 dnl *************************************
287 dnl *** Warnings to show if using GCC ***
288 dnl *************************************
290 AC_ARG_ENABLE(more-warnings,
291 [ --disable-more-warnings Inhibit compiler warnings],
292 set_more_warnings=no)
294 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
296 -Wall -Wstrict-prototypes -Wmissing-declarations \
297 -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
300 # Use reentrant functions (FIXME!)
301 CFLAGS="$CFLAGS -D_REENTRANT"
303 dnl *************************
304 dnl *** Output Everything ***
305 dnl *************************
318 Source code location: ${srcdir}
320 Build flags: ${CFLAGS} ${SOUP_DEBUG_FLAGS}
322 SSL support: ${enable_ssl}