[19534] | 1 | dnl ******************************************* |
---|
| 2 | dnl *** Initialize automake and set version *** |
---|
| 3 | dnl ******************************************* |
---|
| 4 | |
---|
[21107] | 5 | AC_PREREQ(2.53) |
---|
[21518] | 6 | AC_INIT(libsoup, 2.2.2) |
---|
[21107] | 7 | AC_CONFIG_SRCDIR(libsoup-2.2.pc.in) |
---|
| 8 | AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) |
---|
[19534] | 9 | |
---|
| 10 | AM_CONFIG_HEADER(config.h) |
---|
| 11 | AM_MAINTAINER_MODE |
---|
| 12 | AC_PROG_MAKE_SET |
---|
| 13 | |
---|
[21107] | 14 | SOUP_API_VERSION=2.2 |
---|
| 15 | AC_SUBST(SOUP_API_VERSION) |
---|
| 16 | |
---|
[19534] | 17 | # Increment on interface addition. Reset on removal. |
---|
| 18 | SOUP_AGE=0 |
---|
| 19 | |
---|
| 20 | # Increment on interface add, remove, or change. |
---|
[21107] | 21 | SOUP_CURRENT=7 |
---|
[19534] | 22 | |
---|
| 23 | # Increment on source change. Reset when CURRENT changes. |
---|
| 24 | SOUP_REVISION=0 |
---|
| 25 | |
---|
| 26 | AC_SUBST(SOUP_CURRENT) |
---|
| 27 | AC_SUBST(SOUP_REVISION) |
---|
| 28 | AC_SUBST(SOUP_AGE) |
---|
| 29 | |
---|
| 30 | dnl *************************** |
---|
| 31 | dnl *** Set debugging flags *** |
---|
| 32 | dnl *************************** |
---|
| 33 | |
---|
| 34 | debug_default=minimum |
---|
| 35 | |
---|
| 36 | # Declare --enable-* args and collect ac_help strings |
---|
| 37 | AC_ARG_ENABLE(debug, |
---|
| 38 | [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],, |
---|
| 39 | enable_debug=$debug_default) |
---|
| 40 | |
---|
| 41 | # Set the debug flags |
---|
| 42 | if test "x$enable_debug" = "xyes"; then |
---|
| 43 | test "$cflags_set" = set || CFLAGS="$CFLAGS -g" |
---|
| 44 | SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG" |
---|
| 45 | else |
---|
| 46 | if test "x$enable_debug" = "xno"; then |
---|
| 47 | SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS" |
---|
| 48 | fi |
---|
| 49 | fi |
---|
| 50 | |
---|
| 51 | AC_SUBST(SOUP_DEBUG_FLAGS) |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | dnl *************************** |
---|
| 55 | dnl *** Checks for programs *** |
---|
| 56 | dnl *************************** |
---|
| 57 | |
---|
| 58 | AC_PROG_CC |
---|
| 59 | AM_PROG_CC_STDC |
---|
| 60 | AC_PROG_INSTALL |
---|
| 61 | |
---|
| 62 | # Set STDC_HEADERS |
---|
| 63 | AC_HEADER_STDC |
---|
| 64 | |
---|
| 65 | # Initialize libtool |
---|
| 66 | AM_PROG_LIBTOOL |
---|
| 67 | |
---|
| 68 | # This isn't a program, but it doesn't fit anywhere else... |
---|
| 69 | AC_FUNC_ALLOCA |
---|
| 70 | |
---|
| 71 | dnl *********************** |
---|
| 72 | dnl *** Checks for glib *** |
---|
| 73 | dnl *********************** |
---|
| 74 | |
---|
[21107] | 75 | AM_PATH_GLIB_2_0(2.0.0,,,gobject gthread) |
---|
[19534] | 76 | |
---|
[21107] | 77 | PKG_CHECK_MODULES(XML, libxml-2.0) |
---|
| 78 | AC_SUBST(XML_CFLAGS) |
---|
| 79 | AC_SUBST(XML_LIBS) |
---|
| 80 | |
---|
[19534] | 81 | dnl ********************************* |
---|
| 82 | dnl *** Networking library checks *** |
---|
| 83 | dnl ********************************* |
---|
| 84 | |
---|
| 85 | AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket)) |
---|
| 86 | AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname)) |
---|
| 87 | |
---|
| 88 | AC_CHECK_FUNCS(inet_pton inet_aton) |
---|
| 89 | |
---|
| 90 | ### Check if we have gethostbyname_r (if so, assume gethostbyaddr_r). |
---|
| 91 | AC_CHECK_FUNC(gethostbyname_r, |
---|
| 92 | [ |
---|
| 93 | dnl First check for the glibc variant of gethostbyname_r |
---|
| 94 | |
---|
| 95 | AC_MSG_CHECKING(for glibc gethostbyname_r) |
---|
| 96 | AC_TRY_LINK([ #include <netdb.h>],[ |
---|
| 97 | struct hostent result_buf; |
---|
| 98 | char buf[1024]; |
---|
| 99 | struct hostent* result; |
---|
| 100 | int h_errnop; |
---|
| 101 | |
---|
| 102 | gethostbyname_r("localhost", &result_buf, buf, sizeof(buf), |
---|
| 103 | &result, &h_errnop); |
---|
| 104 | ], [ |
---|
| 105 | |
---|
| 106 | dnl Have glibc gethostbyname_r |
---|
| 107 | |
---|
| 108 | AC_MSG_RESULT(yes) |
---|
| 109 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_GLIBC, 1, |
---|
| 110 | [Define if you have a glibc-style gethostbyname_r()]) |
---|
| 111 | HAVE_GETHOSTBYNAME_R=yes |
---|
| 112 | |
---|
| 113 | ], [ |
---|
| 114 | |
---|
| 115 | dnl If we don't have glibc gethostbyname_r, check |
---|
| 116 | dnl for Solaris/Irix gethostbyname_r |
---|
| 117 | |
---|
| 118 | AC_MSG_RESULT(no) |
---|
| 119 | AC_MSG_CHECKING(for Solaris/Irix gethostbyname_r) |
---|
| 120 | AC_TRY_LINK([ #include <netdb.h>],[ |
---|
| 121 | struct hostent result; |
---|
| 122 | char buf[1024]; |
---|
| 123 | int h_errnop; |
---|
| 124 | |
---|
| 125 | gethostbyname_r("localhost", &result, buf, sizeof(buf), &h_errnop); |
---|
| 126 | |
---|
| 127 | ], [ |
---|
| 128 | |
---|
| 129 | dnl Have Solaris/Irix gethostbyname_r |
---|
| 130 | |
---|
| 131 | AC_MSG_RESULT(yes) |
---|
| 132 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_SOLARIS, 1, |
---|
| 133 | [Define if you have a Solaris-style gethostbyname_r()]) |
---|
| 134 | HAVE_GETHOSTBYNAME_R=yes |
---|
| 135 | |
---|
| 136 | ], [ |
---|
| 137 | dnl If don't have Solaris/Irix gethostbyname_r, check |
---|
| 138 | dnl for HP-UX gethostbyname_r |
---|
| 139 | |
---|
| 140 | AC_MSG_RESULT(no) |
---|
| 141 | AC_MSG_CHECKING(for HP-UX gethostbyname_r) |
---|
| 142 | AC_TRY_LINK([ #include <netdb.h>],[ |
---|
| 143 | struct hostent result; |
---|
| 144 | char buf[1024]; |
---|
| 145 | gethostbyname_r("localhost", &result, buf); |
---|
| 146 | ], [ |
---|
| 147 | |
---|
| 148 | dnl Have HP-UX gethostbyname_r |
---|
| 149 | |
---|
| 150 | AC_MSG_RESULT(yes) |
---|
| 151 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_HPUX, 1, |
---|
| 152 | [Define if you have an HP-UX-style gethostbyname_r()]) |
---|
| 153 | HAVE_GETHOSTBYNAME_R=yes |
---|
| 154 | |
---|
| 155 | ] |
---|
| 156 | )] |
---|
| 157 | )] |
---|
| 158 | )]) |
---|
| 159 | |
---|
| 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.]) |
---|
| 169 | fi |
---|
| 170 | |
---|
| 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) |
---|
| 173 | ]) |
---|
| 174 | case $soup_cv_ipv6 in |
---|
| 175 | yes) |
---|
| 176 | AC_DEFINE(HAVE_IPV6, 1, [Define if you have support for IPv6 sockets]) |
---|
| 177 | ;; |
---|
| 178 | esac |
---|
| 179 | |
---|
[21107] | 180 | dnl ********************************** |
---|
| 181 | dnl *** SSL Library check (GnuTLS) *** |
---|
| 182 | dnl ********************************** |
---|
[19534] | 183 | |
---|
| 184 | AC_ARG_ENABLE(ssl, |
---|
| 185 | [ --enable-ssl Turn on Secure Sockets Layer support [default=yes]],, |
---|
[21107] | 186 | enable_ssl=auto) |
---|
[19534] | 187 | |
---|
| 188 | AC_ARG_ENABLE(ssl-link-static, |
---|
| 189 | [ --enable-static-ssl Link with SSL library statically [default=no]], |
---|
| 190 | [enable_static_ssl=yes]) |
---|
| 191 | |
---|
[21107] | 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) |
---|
[19534] | 195 | |
---|
[21107] | 196 | if test "$enable_ssl" != "no"; then |
---|
| 197 | AM_PATH_LIBGNUTLS(1.0.0, have_ssl=yes, have_ssl=no) |
---|
[19534] | 198 | |
---|
[21107] | 199 | if test "$have_ssl" != "yes"; then |
---|
| 200 | if test "$enable_ssl" = "auto"; then |
---|
| 201 | AC_MSG_WARN(Disabling SSL support); |
---|
| 202 | enable_ssl=no; |
---|
[19534] | 203 | else |
---|
[21107] | 204 | AC_MSG_ERROR(Could not configure SSL support); |
---|
[19534] | 205 | fi |
---|
| 206 | fi |
---|
[21107] | 207 | fi |
---|
[19534] | 208 | |
---|
[21107] | 209 | LIBGNUTLS_LIBS_STATIC="" |
---|
| 210 | if test "$enable_ssl" != "no"; then |
---|
| 211 | AC_DEFINE(HAVE_SSL, 1, [Defined if you have SSL support]) |
---|
[19534] | 212 | |
---|
[21107] | 213 | libgpg_error_libs_static="" |
---|
| 214 | libgpg_error_libs="" |
---|
[19534] | 215 | |
---|
[21107] | 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]) |
---|
[19534] | 220 | fi |
---|
[21107] | 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" |
---|
[19534] | 224 | fi |
---|
| 225 | |
---|
[21107] | 226 | if test "$enable_static_ssl" = "yes"; then |
---|
| 227 | gnutls_libdir=`$LIBGNUTLS_CONFIG --exec-prefix`/lib |
---|
| 228 | LIBGNUTLS_LIBS="" |
---|
| 229 | LIBGNUTLS_LIBS_STATIC="$gnutls_libdir/libgnutls.a $gnutls_libdir/libgcrypt.a $libgpg_error_libs_static" |
---|
| 230 | fi |
---|
[19534] | 231 | fi |
---|
| 232 | |
---|
[21107] | 233 | AC_SUBST(LIBGNUTLS_CFLAGS) |
---|
| 234 | AC_SUBST(LIBGNUTLS_LIBS) |
---|
| 235 | AC_SUBST(LIBGNUTLS_LIBS_STATIC) |
---|
[19534] | 236 | |
---|
[21107] | 237 | dnl *************** |
---|
| 238 | dnl *** gtk-doc *** |
---|
| 239 | dnl *************** |
---|
| 240 | GTK_DOC_CHECK([1.0]) |
---|
[19534] | 241 | |
---|
| 242 | |
---|
| 243 | dnl ************************************* |
---|
| 244 | dnl *** Warnings to show if using GCC *** |
---|
| 245 | dnl ************************************* |
---|
| 246 | |
---|
| 247 | AC_ARG_ENABLE(more-warnings, |
---|
| 248 | [ --disable-more-warnings Inhibit compiler warnings], |
---|
| 249 | set_more_warnings=no) |
---|
| 250 | |
---|
| 251 | if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then |
---|
| 252 | CFLAGS="$CFLAGS \ |
---|
| 253 | -Wall -Wstrict-prototypes -Wmissing-declarations \ |
---|
| 254 | -Wmissing-prototypes -Wnested-externs -Wpointer-arith" |
---|
| 255 | fi |
---|
| 256 | |
---|
[21107] | 257 | # Use reentrant functions (FIXME!) |
---|
[19534] | 258 | CFLAGS="$CFLAGS -D_REENTRANT" |
---|
| 259 | |
---|
| 260 | dnl ************************* |
---|
| 261 | dnl *** Output Everything *** |
---|
| 262 | dnl ************************* |
---|
| 263 | |
---|
| 264 | AC_OUTPUT([ |
---|
[21107] | 265 | libsoup-2.2.pc |
---|
[19534] | 266 | Makefile |
---|
| 267 | libsoup/Makefile |
---|
| 268 | tests/Makefile |
---|
[21107] | 269 | docs/Makefile |
---|
| 270 | docs/reference/Makefile |
---|
[19534] | 271 | ]) |
---|