fixed typo
[platform/upstream/libsoup.git] / configure.ac
1 dnl *******************************************
2 dnl *** Initialize automake and set version ***
3 dnl *******************************************
4
5 m4_define([soup_major_version], [2])
6 m4_define([soup_minor_version], [46])
7 m4_define([soup_micro_version], [0])
8
9 AC_PREREQ(2.63)
10 AC_INIT([libsoup],[soup_major_version.soup_minor_version.soup_micro_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=libsoup])
11 AC_CONFIG_SRCDIR([libsoup-2.4.pc.in])
12 AC_CONFIG_MACRO_DIR([m4])
13 AC_CONFIG_AUX_DIR([build-aux])
14
15 AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz -Wno-portability])
16 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
17
18 AC_PROG_MAKE_SET
19
20 SOUP_MAJOR_VERSION=soup_major_version
21 SOUP_MINOR_VERSION=soup_minor_version
22 SOUP_MICRO_VERSION=soup_micro_version
23 AC_SUBST(SOUP_MAJOR_VERSION)
24 AC_SUBST(SOUP_MINOR_VERSION)
25 AC_SUBST(SOUP_MICRO_VERSION)
26
27 SOUP_API_VERSION=2.4
28 AC_SUBST(SOUP_API_VERSION)
29
30 # Increment on interface addition. Reset on removal.
31 SOUP_AGE=7
32
33 # Increment on interface add, remove, or change.
34 SOUP_CURRENT=8
35
36 # Increment on source change. Reset when CURRENT changes.
37 SOUP_REVISION=0
38
39 AC_SUBST(SOUP_CURRENT)
40 AC_SUBST(SOUP_REVISION)
41 AC_SUBST(SOUP_AGE)
42
43 dnl ***************************
44 dnl *** Set debugging flags ***
45 dnl ***************************
46
47 debug_default=minimum
48
49 # Declare --enable-* args and collect ac_help strings
50 AC_ARG_ENABLE(debug, 
51               AS_HELP_STRING([--enable-debug=[no/minimum/yes]],
52                              [turn on debugging (default=$debug_default)]),,
53               enable_debug=$debug_default)
54
55 # Set the debug flags
56 if test "x$enable_debug" = "xyes"; then
57         test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
58         SOUP_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
59 else
60         if test "x$enable_debug" = "xno"; then
61                 SOUP_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
62         fi
63 fi
64
65 AC_SUBST(SOUP_DEBUG_FLAGS)
66
67 dnl ***************************
68 dnl *** Checks for programs ***
69 dnl ***************************
70
71 AC_PROG_CC
72 AC_PROG_INSTALL
73
74 # Initialize libtool
75 LT_INIT([win32-dll])
76
77 dnl ***********************
78 dnl *** Checks for glib ***
79 dnl ***********************
80
81 GLIB_REQUIRED=2.38.0
82 AM_PATH_GLIB_2_0($GLIB_REQUIRED,,,gobject gio)
83 if test "$GLIB_LIBS" = ""; then
84    AC_MSG_ERROR(GLIB $GLIB_REQUIRED or later is required to build libsoup)
85 fi
86 GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38"
87
88 GLIB_MAKEFILE='$(top_srcdir)/Makefile.glib'
89 AC_SUBST(GLIB_MAKEFILE)
90
91 GLIB_TESTS
92
93 PKG_CHECK_MODULES(XML, libxml-2.0)
94 AC_SUBST(XML_CFLAGS)
95 AC_SUBST(XML_LIBS)
96
97 PKG_CHECK_MODULES(SQLITE, sqlite3)
98 AC_SUBST(SQLITE_CFLAGS)
99 AC_SUBST(SQLITE_LIBS)
100
101 dnl ***********************
102 dnl *** Check for Win32 ***
103 dnl ***********************
104
105 AC_MSG_CHECKING([for Win32])
106 case "$host" in
107   *-*-mingw*)
108     os_win32=yes
109     CFLAGS="$CFLAGS -D_REENTRANT"
110     ;;
111   *)
112     os_win32=no
113     ;;
114 esac
115 AC_MSG_RESULT([$os_win32])
116 AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
117
118 dnl ************************
119 dnl *** gettext/intltool ***
120 dnl ************************
121 IT_PROG_INTLTOOL([0.35.0])
122 GETTEXT_PACKAGE=libsoup
123 AC_SUBST([GETTEXT_PACKAGE])
124 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[The gettext domain name])
125
126 dnl *******************
127 dnl *** Misc checks ***
128 dnl *******************
129 AC_CHECK_FUNCS(gmtime_r)
130
131 dnl *************************
132 dnl *** SQL Lite support independently of gnome for Tizen  ***
133 dnl *************************
134
135 AC_ARG_ENABLE(sqlite,
136          AS_HELP_STRING([--enable-sqlite], [Enable SQL lite support ]),        ,
137          enable_sqlite=no)
138
139 if test "$enable_sqlite" != "no"; then
140    PKG_CHECK_MODULES(SQLITE, sqlite3, :, [AC_MSG_ERROR(dnl
141 [Could not find sqlite3 devel files:
142
143 $SQLITE_PKG_ERRORS
144
145 Pass "--without-sqlite" to configure if you want to build libsoup
146 without sql lite support.])])
147
148 fi
149
150 AC_SUBST(SQLITE_CFLAGS)
151 AC_SUBST(SQLITE_LIBS)
152
153 AM_CONDITIONAL(SQLITE_SUPPORT, [test $enable_sqllite = yes])
154
155 dnl *********************
156 dnl *** GNOME support ***
157 dnl *********************
158 AC_MSG_CHECKING(whether to build libsoup-gnome)
159 AC_ARG_WITH(gnome,
160             AS_HELP_STRING([--without-gnome], [Do not build libsoup-gnome]),
161             :, [if test $os_win32 = yes; then with_gnome=no; else with_gnome=yes; fi])
162 AC_MSG_RESULT($with_gnome)
163
164 AM_CONDITIONAL(BUILD_LIBSOUP_GNOME, test $with_gnome != no)
165
166 if test $with_gnome != no; then
167         AC_DEFINE(HAVE_GNOME, 1, [Defined if GNOME support is enabled])
168 fi
169 AC_SUBST(HAVE_GNOME)
170
171
172 dnl ***************
173 dnl *** gtk-doc ***
174 dnl ***************
175 dnl GTK_DOC_CHECK([1.10])
176
177 dnl *****************************
178 dnl *** gobject-introspection ***
179 dnl *****************************
180 GOBJECT_INTROSPECTION_CHECK([0.9.5])
181
182 AC_MSG_CHECKING([for glib-networking (glib TLS implementation)])
183 save_CFLAGS="$CFLAGS"
184 save_LIBS="$LIBS"
185 CFLAGS="$CFLAGS $GLIB_CFLAGS"
186 LIBS="$LIBS $GLIB_LIBS"
187 AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <gio/gio.h>],
188                                [return !g_tls_backend_supports_tls (g_tls_backend_get_default ());])],
189               [have_glib_networking=yes],
190               [have_glib_networking=no],
191               [have_glib_networking="unknown (cross-compiling)"])
192 CFLAGS="$save_CFLAGS"
193 LIBS="$save_LIBS"
194 AC_MSG_RESULT($have_glib_networking)
195
196 AC_ARG_ENABLE(tls-check,
197               AS_HELP_STRING([--disable-tls-check], [Don't error out if glib-networking is unavailable]))
198 if test "$enable_tls_check" != "no" -a "$have_glib_networking" = "no"; then
199         AC_MSG_ERROR([libsoup requires glib-networking for TLS support.
200
201 If you are building a package, you can pass --disable-tls-check to
202 allow building libsoup anyway (since glib-networking is not actually
203 required at compile time), but you should be sure to add a runtime
204 dependency on it.])
205 fi
206
207 dnl ******************************
208 dnl *** Stuff for regression tests
209 dnl ******************************
210 AC_MSG_NOTICE([checking for programs needed for regression tests])
211
212 AC_ARG_WITH(apache-httpd,
213             AS_HELP_STRING([--with-apache-httpd], [Path to apache httpd (for tests)]),
214             APACHE_HTTPD="$withval",
215             [AC_PATH_PROGS(APACHE_HTTPD, httpd2 httpd apache2 apache, no, ${PATH}:/usr/sbin)])
216 if test "$APACHE_HTTPD" != "no"; then
217     AC_MSG_CHECKING([Apache version])
218     apache_version=`$APACHE_HTTPD -v 2>/dev/null | sed -ne 's/Server version: Apache\///p'`
219     case $apache_version in
220     2.2.*)
221         AC_MSG_RESULT([$apache_version (ok)])
222         apache_version=2.2
223         ;;
224     2.4.*)
225         AC_MSG_RESULT([$apache_version (ok)])
226         apache_version=2.4
227         ;;
228     *)
229         AC_MSG_RESULT([$apache_version (ignoring)])
230         APACHE_HTTPD="no"
231         ;;
232     esac
233 fi
234 AC_SUBST(APACHE_HTTPD)
235 AC_DEFINE_UNQUOTED(APACHE_HTTPD, "$APACHE_HTTPD", [Apache httpd])
236
237 if test "$APACHE_HTTPD" != "no"; then
238     AC_MSG_CHECKING([for Apache module directory])
239     AC_ARG_WITH(apache-module-dir,
240                 AS_HELP_STRING([--with-apache-module-dir], [Apache modules dirs (for tests)]),
241                 apache_module_dirs="$withval",
242                 [apache_prefix=`dirname \`dirname $APACHE_HTTPD\``
243                 mpm=`$APACHE_HTTPD -V -C "ServerName localhost" | sed -ne 's/^Server MPM: */-/p' | tr 'A-Z' 'a-z'`
244                 # This only works with bash, but should fail harmlessly in sh
245                 apache_module_dirs=`echo $apache_prefix/lib{64,}/{apache,apache2,http,http2,httpd}{$mpm,}{/modules,}`])
246     for dir in $apache_module_dirs; do
247         if test -f $dir/mod_auth_digest.so; then
248             APACHE_MODULE_DIR="$dir"
249         fi
250         if test -f $dir/mod_ssl.so; then
251             APACHE_SSL_MODULE_DIR="$dir"
252             IF_HAVE_APACHE_SSL=""
253         fi
254         if test -f $dir/mod_php5.so; then
255             APACHE_PHP_MODULE_DIR="$dir"
256             APACHE_PHP_MODULE=mod_php5.so
257         fi
258         if test -f $dir/libphp5.so; then
259             APACHE_PHP_MODULE_DIR="$dir"
260             APACHE_PHP_MODULE=libphp5.so
261         fi
262     done
263     AC_MSG_RESULT($APACHE_MODULE_DIR)
264     AC_SUBST(APACHE_MODULE_DIR)
265     AC_SUBST(APACHE_SSL_MODULE_DIR)
266     AC_SUBST(APACHE_PHP_MODULE_DIR)
267     AC_SUBST(APACHE_PHP_MODULE)
268 fi
269
270 if test "$APACHE_HTTPD" != "no" -a -n "$APACHE_MODULE_DIR" -a -n "$APACHE_SSL_MODULE_DIR"; then
271     AC_DEFINE(HAVE_APACHE, 1, [Whether or not apache can be used for tests])
272     if test $apache_version = 2.2; then
273         AC_DEFINE(HAVE_APACHE_2_2, 1, [Apache is 2.2.x])
274     else
275         AC_DEFINE(HAVE_APACHE_2_4, 1, [Apache is 2.4.x])
276     fi
277     have_apache=1
278 else
279     have_apache=0
280 fi
281 AM_CONDITIONAL(HAVE_APACHE, test "$have_apache" = 1)
282 AM_CONDITIONAL(HAVE_APACHE_2_2, test "$apache_version" = 2.2)
283 AM_CONDITIONAL(HAVE_APACHE_2_4, test "$apache_version" = 2.4)
284
285 if test "$have_apache" = 1; then
286     AC_CHECK_PROGS(PHP, php php5)
287
288     AC_MSG_CHECKING([for Apache PHP module])
289     if test -f $APACHE_PHP_MODULE_DIR/$APACHE_PHP_MODULE; then
290         have_php=yes
291         IF_HAVE_PHP=""
292     else
293         have_php=no
294         IF_HAVE_PHP="\#"
295     fi
296     AC_MSG_RESULT($have_php)
297     AC_SUBST(IF_HAVE_PHP)
298
299     if test "$have_php" = yes; then
300         AC_MSG_CHECKING([for php-xmlrpc])
301         if $PHP --rf xmlrpc_server_create | grep -q "does not exist"; then
302             have_php_xmlrpc=no
303         else
304             have_php_xmlrpc=yes
305             AC_DEFINE(HAVE_PHP_XMLRPC, 1, [Have php-xmlrpc])
306         fi
307         AC_MSG_RESULT($have_php_xmlrpc)
308     fi
309 fi
310
311 AC_PATH_PROG(CURL, curl, no)
312 if test "$CURL" != no; then
313     AC_DEFINE(HAVE_CURL, 1, [Whether or not curl can be used for tests])
314 fi
315
316 dnl **********************************************************
317 dnl *** path of NTLM single-sign-on helper ntlm_auth
318 dnl **********************************************************
319 AC_ARG_WITH(ntlm-auth,
320             AC_HELP_STRING([--with-ntlm-auth=PATH],[Where to look for ntlm_auth, path points to ntlm_auth installation (default: /usr/bin/ntlm_auth)]),
321             ntlm_auth="$withval",
322             [if test $os_win32 = yes; then ntlm_auth="no"; else ntlm_auth="/usr/bin/ntlm_auth"; fi])
323 if test "$ntlm_auth" != "no"; then
324     AC_DEFINE(USE_NTLM_AUTH, 1, [Whether or not use Samba's 'winbind' daemon helper 'ntlm_auth' for NTLM single-sign-on])
325     if test "$ntlm_auth" = "yes"; then
326         dnl --with-ntlm-auth (without path) used, use default path
327         ntlm_auth="/usr/bin/ntlm_auth"
328     fi
329 fi
330 AC_SUBST(ntlm_auth)
331 AC_DEFINE_UNQUOTED(NTLM_AUTH, "$ntlm_auth", [Samba's 'winbind' daemon helper 'ntlm_auth' which can be used for NTLM single-sign-on])
332
333 dnl ****************************************************
334 dnl *** Warnings to show if using GCC                ***
335 dnl *** (do this last so -Werror won't mess up tests ***
336 dnl ****************************************************
337
338 AC_ARG_ENABLE(more-warnings,
339               AS_HELP_STRING([--disable-more-warnings], [Inhibit compiler warnings]),
340               set_more_warnings=no)
341
342 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
343         CFLAGS="$CFLAGS \
344                 -Wall -Wstrict-prototypes -Werror=missing-prototypes \
345                 -Werror=implicit-function-declaration \
346                 -Werror=pointer-arith -Werror=init-self -Werror=format=2 \
347                 -Wno-format-zero-length \
348                 -Werror=missing-include-dirs -Werror=aggregate-return \
349                 -Werror=declaration-after-statement"
350 fi
351
352 dnl *************************
353 dnl *** Output Everything ***
354 dnl *************************
355
356 AC_CONFIG_HEADERS([config.h])
357 AC_CONFIG_FILES([
358         libsoup-2.4.pc
359         libsoup-gnome-2.4.pc
360         Makefile
361         libsoup-zip
362         libsoup/Makefile
363         po/Makefile.in
364         po/Makefile
365         tests/Makefile
366         examples/Makefile
367         docs/Makefile
368         docs/reference/Makefile
369         libsoup/soup-version.h
370         ])
371 AC_OUTPUT