source: trunk/third/libsoup/configure.in @ 19535

Revision 19535, 11.8 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r19534, which included commits to RCS files with non-trunk default branches.
Line 
1dnl *******************************************
2dnl *** Initialize automake and set version ***
3dnl *******************************************
4
5AC_INIT(libsoup/soup.h)
6
7AM_INIT_AUTOMAKE(libsoup, 1.99.23)
8AM_CONFIG_HEADER(config.h)
9AM_MAINTAINER_MODE
10AC_PROG_MAKE_SET
11
12# Increment on interface addition. Reset on removal.
13SOUP_AGE=0
14
15# Increment on interface add, remove, or change.
16SOUP_CURRENT=0
17
18# Increment on source change. Reset when CURRENT changes.
19SOUP_REVISION=0
20
21AC_SUBST(SOUP_CURRENT)
22AC_SUBST(SOUP_REVISION)
23AC_SUBST(SOUP_AGE)
24
25dnl ***************************
26dnl *** Set debugging flags ***
27dnl ***************************
28
29debug_default=minimum
30
31# Declare --enable-* args and collect ac_help strings
32AC_ARG_ENABLE(debug,
33              [  --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,
34              enable_debug=$debug_default)
35
36# Set the debug flags
37if test "x$enable_debug" = "xyes"; then
38        test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
39        SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
40else
41        if test "x$enable_debug" = "xno"; then
42                SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
43        fi
44fi
45
46AC_SUBST(SOUP_DEBUG_FLAGS)
47
48
49dnl ***************************
50dnl *** Checks for programs ***
51dnl ***************************
52
53AC_PROG_CC
54AM_PROG_CC_STDC
55AC_PROG_INSTALL
56
57# Set STDC_HEADERS
58AC_HEADER_STDC
59
60# Initialize libtool
61AM_PROG_LIBTOOL
62
63# This isn't a program, but it doesn't fit anywhere else...
64AC_FUNC_ALLOCA
65
66dnl ***********************
67dnl *** Checks for glib ***
68dnl ***********************
69
70PKG_CHECK_MODULES(GLIB, glib-2.0)
71AC_SUBST(GLIB_CFLAGS)
72AC_SUBST(GLIB_LIBS)
73
74dnl *********************************
75dnl *** Networking library checks ***
76dnl *********************************
77
78AC_CHECK_HEADERS(sys/sockio.h sys/poll.h sys/param.h)
79AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
80
81AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
82AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
83
84AC_CHECK_FUNCS(inet_pton inet_aton)
85
86### Check if we have gethostbyname_r (if so, assume gethostbyaddr_r).
87AC_CHECK_FUNC(gethostbyname_r,
88  [
89  dnl  First check for the glibc variant of gethostbyname_r
90
91  AC_MSG_CHECKING(for glibc gethostbyname_r)
92  AC_TRY_LINK([ #include <netdb.h>],[
93          struct hostent result_buf;
94          char buf[1024];
95          struct hostent* result;
96          int h_errnop;
97
98          gethostbyname_r("localhost", &result_buf, buf, sizeof(buf),
99                          &result, &h_errnop);
100        ], [
101
102          dnl Have glibc gethostbyname_r
103
104          AC_MSG_RESULT(yes)
105          AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC, 1,
106                    [Define if you have a glibc-style gethostbyname_r()])
107          HAVE_GETHOSTBYNAME_R=yes
108
109        ], [
110
111  dnl  If we don't have glibc gethostbyname_r, check
112  dnl  for Solaris/Irix gethostbyname_r
113
114  AC_MSG_RESULT(no)
115  AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r)
116  AC_TRY_LINK([ #include <netdb.h>],[
117          struct hostent result;
118          char buf[1024];
119          int h_errnop;
120
121          gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop);
122
123        ], [
124
125          dnl Have Solaris/Irix gethostbyname_r
126
127          AC_MSG_RESULT(yes)
128          AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS, 1,
129                    [Define if you have a Solaris-style gethostbyname_r()])
130          HAVE_GETHOSTBYNAME_R=yes
131
132        ], [
133  dnl  If don't have Solaris/Irix gethostbyname_r, check
134  dnl  for HP-UX gethostbyname_r
135
136  AC_MSG_RESULT(no)
137  AC_MSG_CHECKING(for HP-UX gethostbyname_r)
138  AC_TRY_LINK([ #include <netdb.h>],[
139          struct hostent result;
140          char buf[1024];
141          gethostbyname_r("localhost", &result, buf);
142        ], [
143       
144          dnl Have HP-UX gethostbyname_r
145
146          AC_MSG_RESULT(yes)
147          AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX, 1,
148                    [Define if you have an HP-UX-style gethostbyname_r()])
149          HAVE_GETHOSTBYNAME_R=yes
150
151        ]
152     )]
153  )]
154)])
155
156# If we don't have gethostbyname_r, we'll use Glib mutexes, but give a warning
157if test -z "$HAVE_GETHOSTBYNAME_R"; then
158        AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIB_MUTEX, 1,
159                  [Define if you have no gethostbyname_r()])
160        AC_MSG_WARN([You have neither Glib threads nor the function
161                    gethostbyname_r.  This means that calls to
162                    gethostbyname (called by the Soup address
163                    functions) will not be thread safe so could
164                    malfunction in programs that use threads.])
165fi
166
167AC_CACHE_CHECK(IPv6 support, soup_cv_ipv6, [
168        AC_EGREP_HEADER(sockaddr_in6, netinet/in.h, soup_cv_ipv6=yes, soup_cv_ipv6=no)
169])
170case $soup_cv_ipv6 in
171yes)
172        AC_DEFINE(HAVE_IPV6, 1, [Define if you have support for IPv6 sockets])
173        ;;
174esac
175
176dnl ************************************************************
177dnl *** SSL Library checks (GnuTLS, Mozilla NSS, or OpenSSL) ***
178dnl ************************************************************
179
180AC_ARG_ENABLE(ssl,
181              [  --enable-ssl             Turn on Secure Sockets Layer support [default=yes]],,
182              enable_ssl=yes)
183
184dnl NSS AC_ARG_WITH(nspr-includes,
185dnl NSS             [  --with-nspr-includes     Specify location of Netscape Portable Runtime headers],
186dnl NSS             [nspr_inc_prefix=-I$withval])
187dnl NSS
188dnl NSS AC_ARG_WITH(nspr-libs,
189dnl NSS             [  --with-nspr-libs         Specify location of Netscape Portable Runtime libs],
190dnl NSS             [nspr_prefix=$withval],
191dnl NSS             [nspr_prefix=$libdir])
192dnl NSS
193dnl NSS AC_ARG_WITH(nss-includes,
194dnl NSS             [  --with-nss-includes      Specify location of NSS header files],
195dnl NSS             [nss_inc_prefix=-I$withval])
196dnl NSS
197dnl NSS AC_ARG_WITH(nss-libs,
198dnl NSS             [  --with-nss-libs          Specify location of NSS libs],
199dnl NSS             [nss_prefix=$withval],
200dnl NSS             [nss_prefix=$libdir])
201
202
203AC_ARG_WITH(openssl-includes,
204            [  --with-openssl-includes  Specify location of OpenSSL header files],
205            [openssl_inc_prefix=-I$withval])
206
207AC_ARG_WITH(openssl-libs,
208            [  --with-openssl-libs      Specify location of OpenSSL libs],
209            [openssl_prefix=$withval],
210            [openssl_prefix=$libdir])
211
212AC_ARG_WITH(gnutls-includes,
213            [  --with-gnutls-includes   Specify location of GnuTLS header files],
214            [gnutls_inc_prefix=-I$withval])
215
216AC_ARG_WITH(gnutls-libs,
217            [  --with-gnutls-libs       Specify location of GnuTLS libs],
218            [gnutls_prefix=$withval],
219            [gnutls_prefix=$libdir])
220
221###
222### Allow for a custom SSL proxy name
223###
224SSL_PROXY_NAME=libsoup-ssl-proxy
225AC_ARG_WITH(ssl-proxy-name,
226            [  --with-ssl-proxy-name    Custom name for ssl proxy executable [default=libsoup-ssl-proxy]],
227            [SSL_PROXY_NAME=$withval],
228            [SSL_PROXY_NAME=libsoup-ssl-proxy])
229
230AC_DEFINE_UNQUOTED(SSL_PROXY_NAME, "${SSL_PROXY_NAME}",
231                   [The name to use for the SSL proxy binary. Defaults to libsoup-ssl-proxy])
232AC_SUBST(SSL_PROXY_NAME)
233
234###
235### Try to link statically with the SSL library
236###
237AC_ARG_ENABLE(ssl-link-static,
238              [  --enable-static-ssl      Link with SSL library statically [default=no]],
239              [enable_static_ssl=yes])
240
241enable_gnutls="no"
242enable_openssl="no"
243dnl NSS enable_nss="no"
244
245if test "x$enable_ssl" = xyes; then
246        found_ssl=
247
248        ###
249        ### Check for GnuTLS
250        ###
251        save_CPPFLAGS=$CPPFLAGS
252        CPPFLAGS="$CPPFLAGS $gnutls_inc_prefix"
253        AC_CHECK_HEADERS(gnutls/gnutls.h,
254                         [enable_gnutls="yes"],
255                         [enable_gnutls="no"; break])
256
257        if test "x$enable_gnutls" = xyes; then
258                if test "x$enable_static_ssl" = "xyes"; then
259                        GNUTLS_LIBS="$gnutls_prefix/libgnutls.a $gnutls_prefix/libgcrypt.a"
260                else
261                        GNUTLS_LIBS="-L$gnutls_prefix -lgnutls -lgcrypt"
262                fi
263                GNUTLS_CFLAGS=$CPPFLAGS
264                AC_DEFINE(HAVE_GNUTLS, 1,
265                          [Defined if you are using GnuTLS for SSL support])
266                found_ssl=yes
267        else
268                GNUTLS_LIBS=
269                GNUTLS_CFLAGS=
270        fi
271
272        AC_SUBST(GNUTLS_CFLAGS)
273        AC_SUBST(GNUTLS_LIBS)
274        CPPFLAGS=$save_CPPFLAGS
275
276        AM_CONDITIONAL(BUILD_PROXY, false)
277
278        ###
279        ### Check for OpenSSL
280        ###
281        if test "x$found_ssl" != "xyes"; then
282                save_CPPFLAGS=$CPPFLAGS
283                CPPFLAGS="$CPPFLAGS $openssl_inc_prefix"
284                AC_CHECK_LIB(dl, dlopen, DL_LDFLAGS="-ldl", DL_LDFLAGS="")
285                AC_CHECK_HEADERS(openssl/ssl.h openssl/err.h,
286                                 [enable_openssl="yes"],
287                                 [enable_openssl="no"; break])
288
289                if test "x$enable_openssl" = xyes; then
290                        if test "x$enable_static_ssl" = "xyes"; then
291                                OPENSSL_LIBS="$openssl_prefix/libssl.a $openssl_prefix/libcrypto.a"
292                        else
293                                OPENSSL_LIBS="-L$openssl_prefix -lssl -lcrypto $DL_LDFLAGS"
294                        fi
295                        OPENSSL_CFLAGS=$CPPFLAGS
296                        AC_DEFINE(HAVE_OPENSSL, 1,
297                                  [Defined if you are using OpenSSL for SSL support])
298                        found_ssl=yes
299                        AM_CONDITIONAL(BUILD_PROXY, true)
300                else
301                        OPENSSL_LIBS=
302                        OPENSSL_CFLAGS=
303                fi
304
305                AC_SUBST(OPENSSL_CFLAGS)
306                AC_SUBST(OPENSSL_LIBS)
307                CPPFLAGS=$save_CPPFLAGS
308        fi
309
310dnl NSS         ###
311dnl NSS         ### Check for Mozilla NSS
312dnl NSS         ###
313dnl NSS         if test "x$found_ssl" != "xyes"; then
314dnl NSS                 save_CPPFLAGS=$CPPFLAGS
315dnl NSS                 CPPFLAGS="$CPPFLAGS $nspr_inc_prefix $nss_inc_prefix"
316dnl NSS                 AC_CHECK_HEADERS(nss.h ssl.h pk11func.h,
317dnl NSS                                  [enable_nss="yes"],
318dnl NSS                                  [enable_nss="no"; break])
319dnl NSS
320dnl NSS                 if test "x$enable_nss" = xyes; then
321dnl NSS                         if test "x$enable_static_ssl" = "xyes"; then
322dnl NSS                                 NSS_LIBS="-lpthread $nspr_prefix/libnspr4.a $nspr_prefix/libplc4.a $nspr_prefix/libplds4.a $nss_prefix/libnssb.a"
323dnl NSS                         else
324dnl NSS                                 NSS_LIBS="-lpthread -L$nspr_prefix -lnspr4 -lplc4 -lplds4 $nss_prefix -lnss3 -lssl3"
325dnl NSS                         fi
326dnl NSS                         NSS_CFLAGS=$CPPFLAGS
327dnl NSS                         AC_DEFINE(HAVE_NSS, 1,
328dnl NSS                                   [Defined if you are using Mozilla NSS for SSL support])
329dnl NSS                         found_ssl=yes
330dnl NSS                 else
331dnl NSS                         NSS_LIBS=
332dnl NSS                         NSS_CFLAGS=
333dnl NSS                 fi
334dnl NSS
335dnl NSS                 AC_SUBST(NSS_CFLAGS)
336dnl NSS                 AC_SUBST(NSS_LIBS)
337dnl NSS                 CPPFLAGS=$save_CPPFLAGS
338dnl NSS         fi
339fi
340
341
342dnl *********************************************
343dnl *** Checks for gtk-doc (lifted from glib) ***
344dnl *********************************************
345
346AC_ARG_WITH(html-dir, [  --with-html-dir=PATH     Path to installed docs ])
347
348if test "x$with_html_dir" = "x" ; then
349  HTML_DIR='${datadir}/gtk-doc/html'
350else
351  HTML_DIR=$with_html_dir
352fi
353
354AC_SUBST(HTML_DIR)
355
356AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
357AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
358AC_SUBST(HAVE_GTK_DOC)
359
360AC_CHECK_PROG(DB2HTML, db2html, true, false)
361AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
362
363dnl Let people disable the gtk-doc stuff.
364AC_ARG_ENABLE(gtk-doc,
365              [  --enable-gtk-doc         Use gtk-doc to build documentation [default=auto]],
366              enable_gtk_doc="$enableval",
367              enable_gtk_doc=auto)
368
369if test x$enable_gtk_doc = xauto ; then
370  if test x$GTKDOC = xtrue ; then
371    enable_gtk_doc=yes
372  else
373    enable_gtk_doc=no
374  fi
375fi
376
377dnl NOTE: We need to use a separate automake conditional for this
378dnl       to make this work with the tarballs.
379AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
380
381
382dnl *************************************
383dnl *** Warnings to show if using GCC ***
384dnl *************************************
385
386AC_ARG_ENABLE(more-warnings,
387              [  --disable-more-warnings  Inhibit compiler warnings],
388              set_more_warnings=no)
389
390if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
391        CFLAGS="$CFLAGS \
392                -Wall -Wstrict-prototypes -Wmissing-declarations \
393                -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
394fi
395
396# Use reentrant functions
397CFLAGS="$CFLAGS -D_REENTRANT"
398
399dnl *****************************
400dnl *** link proxy statically ***
401dnl *****************************
402AC_ARG_ENABLE(static-proxy,
403  [  --enable-static-proxy  Build ${SSL_PROXY_NAME} statically ])
404
405if test x"$enable_static_proxy" = xyes; then
406        LINK_STATIC="-Wl,-Bstatic"
407        LINK_DYNAMIC="-Wl,-Bdynamic"
408        FORCE_SHLIBS="dl resolv rt nsl"
409        for lib in $FORCE_SHLIBS; do
410          OPENSSL_LIBS=`echo $OPENSSL_LIBS | sed "s/-l$lib/-Wl,-Bdynamic -l$lib -Wl,-Bstatic/"`
411          GMODULE_LIBS=`echo $GMODULE_LIBS | sed "s/-l$lib/-Wl,-Bdynamic -l$lib -Wl,-Bstatic/"`
412        done
413else
414        LINK_STATIC=
415        LINK_DYNAMIC=
416fi
417
418AC_SUBST(LINK_STATIC)
419AC_SUBST(LINK_DYNAMIC)
420
421dnl *************************
422dnl *** Output Everything ***
423dnl *************************
424
425AC_OUTPUT([
426        soup-2.0.pc
427        Makefile
428        libsoup/Makefile
429        tests/Makefile
430        ])
431
432echo "
433
434Configuration:
435
436  Source code location:         ${srcdir}
437  Compiler:                     ${CC}
438  Build flags:                  ${CFLAGS} ${SOUP_DEBUG_FLAGS}
439
440  GnuTLS support:               ${enable_gnutls}
441  OpenSSL support:              ${enable_openssl}
442    Static SSL Proxy:           ${enable_static_proxy:-no}
443    SSL Proxy Name:             ${SSL_PROXY_NAME}
444
445
446"
Note: See TracBrowser for help on using the repository browser.