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