Replaces SoupConnectionNTLM; now works as a SoupSession::request_started
[platform/upstream/libsoup.git] / configure.in
1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
4
5 AC_PREREQ(2.53)
6 AC_INIT(libsoup, 2.3.0)
7 AC_CONFIG_SRCDIR(libsoup.pc.in)
8 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
9
10 AM_CONFIG_HEADER(config.h)
11 AM_MAINTAINER_MODE
12 AC_PROG_MAKE_SET
13
14 SOUP_API_VERSION=2.4
15 AC_SUBST(SOUP_API_VERSION)
16
17 # Increment on interface addition. Reset on removal.
18 SOUP_AGE=0
19
20 # Increment on interface add, remove, or change.
21 SOUP_CURRENT=0
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 AC_LIBTOOL_WIN32_DLL
67 AM_PROG_LIBTOOL
68
69 # This isn't a program, but it doesn't fit anywhere else...
70 AC_FUNC_ALLOCA
71
72 dnl ***********************
73 dnl *** Checks for glib ***
74 dnl ***********************
75
76 AM_PATH_GLIB_2_0(2.15.0,,,gobject gthread gio)
77
78 PKG_CHECK_MODULES(XML, libxml-2.0)
79 AC_SUBST(XML_CFLAGS)
80 AC_SUBST(XML_LIBS)
81
82 dnl ***********************
83 dnl *** Check for Win32 ***
84 dnl ***********************
85
86 AC_MSG_CHECKING([for Win32])
87 case "$host" in
88   *-*-mingw*)
89     os_win32=yes
90     # Don't do this yet, as we want to support Windows 2000 which
91     # doesn't have these.
92     # AC_CACHE_VAL(ac_cv_func_getaddrinfo, [ac_cv_func_getaddrinfo=yes])
93     # AC_CACHE_VAL(ac_cv_func_getnameinfo, [ac_cv_func_getnameinfo=yes])
94     # AC_CACHE_VAL(ac_cv_func_inet_pton, [ac_cv_func_inet_pton=yes])
95     # AC_CACHE_VAL(ac_cv_func_inet_ntop, [ac_cv_func_inet_ntop=yes])
96     # AC_CACHE_VAL(soup_cv_ipv6, [soup_cv_ipv6=yes])
97     ;;
98   *)
99     os_win32=no
100     ;;
101 esac
102 AC_MSG_RESULT([$os_win32])
103 AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
104
105 dnl *******************
106 dnl *** Misc checks ***
107 dnl *******************
108 AC_CHECK_FUNCS(gmtime_r)
109 AC_CHECK_FUNCS(timegm)
110
111 dnl *********************************
112 dnl *** Networking library checks ***
113 dnl *********************************
114
115 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
116 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
117
118 AC_CHECK_FUNCS(inet_pton inet_ntop inet_aton getaddrinfo getnameinfo)
119
120 AC_CACHE_CHECK(IPv6 support, soup_cv_ipv6, [
121         AC_EGREP_HEADER(sockaddr_in6, netinet/in.h, soup_cv_ipv6=yes, soup_cv_ipv6=no)
122 ])
123 case $soup_cv_ipv6 in
124 yes)
125         AC_DEFINE(HAVE_IPV6, 1, [Define if you have support for IPv6 sockets])
126         ;;
127 esac
128
129 dnl **********************************
130 dnl *** SSL Library check (GnuTLS) ***
131 dnl **********************************
132
133 AC_ARG_ENABLE(ssl, 
134               [  --enable-ssl             Turn on Secure Sockets Layer support [default=yes]],,
135               enable_ssl=auto)
136
137 if test "$enable_ssl" != "no"; then
138         PKG_CHECK_MODULES(LIBGNUTLS, gnutls,
139                 [AM_PATH_LIBGCRYPT([], have_ssl=yes, have_ssl=no)], have_ssl=no)
140         if test "$have_ssl" = "yes"; then
141                 AC_DEFINE(HAVE_SSL, 1, [Defined if you have SSL support])
142                 SSL_REQUIREMENT="gnutls"
143         else
144                 if test "$enable_ssl" = "auto"; then
145                         AC_MSG_WARN(Disabling SSL support);
146                         enable_ssl=no;
147                 else
148                         AC_MSG_ERROR(Could not configure SSL support);
149                 fi
150         fi
151 fi
152
153 AC_SUBST(LIBGNUTLS_CFLAGS)
154 AC_SUBST(LIBGNUTLS_LIBS)
155 AC_SUBST(SSL_REQUIREMENT)
156
157 dnl This is not supposed to be conditional, but...
158 AM_CONDITIONAL(HAVE_SSL, test $enable_ssl != no)
159
160 dnl ***************
161 dnl *** gtk-doc ***
162 dnl ***************
163 GTK_DOC_CHECK([1.0])
164
165
166 dnl *************************************
167 dnl *** Warnings to show if using GCC ***
168 dnl *************************************
169
170 AC_ARG_ENABLE(more-warnings,
171               [  --disable-more-warnings  Inhibit compiler warnings],
172               set_more_warnings=no)
173
174 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
175         CFLAGS="$CFLAGS \
176                 -Wall -Wstrict-prototypes -Wmissing-declarations \
177                 -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
178 fi
179
180 if test "$os_win32" != yes; then
181         # Use reentrant functions (FIXME!)
182         CFLAGS="$CFLAGS -D_REENTRANT"
183 fi
184
185 dnl *************************************
186 dnl *** Apache (for regression tests) ***
187 dnl *************************************
188
189 AC_ARG_WITH(apache-httpd,
190             [  --with-apache-httpd      Path to apache httpd (for tests)],
191             APACHE_HTTPD="$withval",
192             [AC_PATH_PROGS(APACHE_HTTPD, httpd2 httpd, no, ${PATH}:/usr/sbin)])
193 if test "$APACHE_HTTPD" != "no"; then
194     AC_MSG_CHECKING([Apache version])
195     apache_version=`$APACHE_HTTPD -v 2>/dev/null | sed -ne 's/Server version: Apache\///p'`
196     case $apache_version in
197     2.2.*)
198         AC_MSG_RESULT([$apache_version (ok)])
199         ;;
200     *)
201         AC_MSG_RESULT([$apache_version (ignoring)])
202         APACHE_HTTPD="no"
203         ;;
204     esac
205 fi
206 AC_SUBST(APACHE_HTTPD)
207 AC_DEFINE_UNQUOTED(APACHE_HTTPD, "$APACHE_HTTPD", [Apache httpd])
208
209 if test "$APACHE_HTTPD" != "no"; then
210     AC_MSG_CHECKING([for Apache module directory])
211     AC_ARG_WITH(apache-module-dir,
212                 [  --with-apache-module-dir Apache modules dir (for tests)],
213                 APACHE_MODULE_DIR="$withval",
214                 [apache_prefix=`dirname \`dirname $APACHE_HTTPD\``
215                 mpm=`$APACHE_HTTPD -V | sed -ne 's/^Server MPM: */-/p' | tr 'A-Z' 'a-z'`
216                 # This only works with bash, but should fail harmlessly in sh
217                 for dir in $apache_prefix/lib{64,}/{apache,apache2,http,http2,httpd}{$mpm,}{/modules,}; do
218                     if test -f $dir/mod_auth_digest.so; then
219                         APACHE_MODULE_DIR="$dir"
220                     fi
221                     if test -f $dir/mod_ssl.so; then
222                         APACHE_SSL_MODULE_DIR="$dir"
223                     fi
224                     if test -f $dir/mod_php5.so; then
225                         APACHE_PHP_MODULE_DIR="$dir"
226                         APACHE_PHP_MODULE=mod_php5.so
227                     fi
228                     if test -f $dir/libphp5.so; then
229                         APACHE_PHP_MODULE_DIR="$dir"
230                         APACHE_PHP_MODULE=libphp5.so
231                     fi
232                 done])
233     AC_MSG_RESULT($APACHE_MODULE_DIR)
234     AC_SUBST(APACHE_MODULE_DIR)
235     AC_SUBST(APACHE_SSL_MODULE_DIR)
236     AC_SUBST(APACHE_PHP_MODULE_DIR)
237     AC_SUBST(APACHE_PHP_MODULE)
238 fi
239
240 if test "$APACHE_HTTPD" != "no" -a -n "$APACHE_MODULE_DIR"; then
241     AC_DEFINE(HAVE_APACHE, 1, [Whether or not apache can be used for tests])
242     have_apache=1
243 else
244     have_apache=0
245 fi
246 AM_CONDITIONAL(HAVE_APACHE, test $have_apache = 1)
247
248 if test "$have_apache" = 1; then
249     AC_CHECK_PROGS(PHP, php php5)
250
251     AC_MSG_CHECKING([for Apache PHP module])
252     if test -f $APACHE_PHP_MODULE_DIR/$APACHE_PHP_MODULE; then
253         have_php=yes
254         IF_HAVE_PHP=""
255     else
256         have_php=no
257         IF_HAVE_PHP="#"
258     fi
259     AC_MSG_RESULT($have_php)
260
261     if test "$have_php" = yes; then
262         AC_MSG_CHECKING([for xmlrpc-epi-php])
263         if $PHP --rf xmlrpc_server_create | grep -q "does not exist"; then
264             have_xmlrpc_epi_php=no
265         else
266             have_xmlrpc_epi_php=yes
267         fi
268         AC_MSG_RESULT($have_xmlrpc_epi_php)
269     fi
270 fi
271
272 AC_SUBST(IF_HAVE_PHP)
273 AM_CONDITIONAL(HAVE_XMLRPC_EPI_PHP, test "$have_xmlrpc_epi_php" = yes)
274
275 dnl *******************************
276 dnl *** curl (for regression tests)
277 dnl *******************************
278 AC_PATH_PROG(CURL, curl, no)
279 if test "$CURL" != no; then
280     AC_DEFINE(HAVE_CURL, 1, [Whether or not curl can be used for tests])
281 fi
282 AM_CONDITIONAL(HAVE_CURL, test "$CURL" != no)
283
284 dnl *************************
285 dnl *** Output Everything ***
286 dnl *************************
287
288 AC_OUTPUT([
289         libsoup.pc
290         Makefile
291         libsoup-zip
292         libsoup/Makefile
293         tests/Makefile
294         tests/httpd.conf
295         docs/Makefile
296         docs/reference/Makefile
297         ])