Disable gtk-doc
[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.37.92],[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([1.11 foreign no-dist-gzip dist-xz -Wno-portability])
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=5
20
21 # Increment on interface add, remove, or change.
22 SOUP_CURRENT=6
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 GLIB_REQUIRED=2.31.7
76 AM_PATH_GLIB_2_0($GLIB_REQUIRED,,,gobject gio)
77 if test "$GLIB_LIBS" = ""; then
78    AC_MSG_ERROR(GLIB $GLIB_REQUIRED or later is required to build libsoup)
79 fi
80 GLIB_CFLAGS="$GLIB_CFLAGS -DG_DISABLE_SINGLE_INCLUDES"
81
82 GLIB_MAKEFILE='$(top_srcdir)/Makefile.glib'
83 AC_SUBST(GLIB_MAKEFILE)
84
85 PKG_CHECK_MODULES(XML, libxml-2.0)
86 AC_SUBST(XML_CFLAGS)
87 AC_SUBST(XML_LIBS)
88
89 dnl ***********************
90 dnl *** Check for Win32 ***
91 dnl ***********************
92
93 AC_MSG_CHECKING([for Win32])
94 case "$host" in
95   *-*-mingw*)
96     os_win32=yes
97     CFLAGS="$CFLAGS -D_REENTRANT"
98     ;;
99   *)
100     os_win32=no
101     ;;
102 esac
103 AC_MSG_RESULT([$os_win32])
104 AM_CONDITIONAL(OS_WIN32, [test $os_win32 = yes])
105
106 dnl *******************
107 dnl *** Misc checks ***
108 dnl *******************
109 AC_CHECK_FUNCS(gmtime_r)
110 AC_CHECK_FUNCS(mmap)
111 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
112
113 dnl *********************
114 dnl *** GNOME support ***
115 dnl *********************
116 AC_MSG_CHECKING(whether to build libsoup-gnome)
117 AC_ARG_WITH(gnome,
118             AS_HELP_STRING([--without-gnome], [Do not build libsoup-gnome]),
119             :, [if test $os_win32 = yes; then with_gnome=no; else with_gnome=yes; fi])
120 AC_MSG_RESULT($with_gnome)
121
122 if test $with_gnome != no -a $os_win32 != yes; then
123         PKG_CHECK_MODULES(GNOME_KEYRING, gnome-keyring-1, :,
124                           AC_MSG_ERROR(
125 [Could not find gnome-keyring devel files.
126 Configure with --without-gnome if you wish to build only libsoup
127 without GNOME-specific features.]))
128 fi
129 AC_SUBST(GNOME_KEYRING_CFLAGS)
130 AC_SUBST(GNOME_KEYRING_LIBS)
131
132 AM_CONDITIONAL(BUILD_LIBSOUP_GNOME, test $with_gnome != no)
133
134 if test $with_gnome != no; then
135         AC_DEFINE(HAVE_GNOME, 1, [Defined if GNOME support is enabled])
136
137         PKG_CHECK_MODULES(SQLITE, sqlite3, :, [AC_MSG_ERROR(dnl
138 [Could not find sqlite3 devel files:
139
140 $SQLITE_PKG_ERRORS
141
142 Pass "--without-gnome" to configure if you want to build libsoup
143 without GNOME support.])])
144 fi
145 AC_SUBST(HAVE_GNOME)
146 AC_SUBST(SQLITE_CFLAGS)
147 AC_SUBST(SQLITE_LIBS)
148
149
150 dnl ***************
151 dnl *** gtk-doc ***
152 dnl ***************
153 dnl GTK_DOC_CHECK([1.10])
154
155 dnl *****************************
156 dnl *** gobject-introspection ***
157 dnl *****************************
158 GOBJECT_INTROSPECTION_CHECK([0.9.5])
159
160 AC_MSG_CHECKING([for glib-networking (glib TLS implementation)])
161 save_CFLAGS="$CFLAGS"
162 save_LIBS="$LIBS"
163 CFLAGS="$CFLAGS $GLIB_CFLAGS"
164 LIBS="$LIBS $GLIB_LIBS"
165 AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <gio/gio.h>],
166                                [g_type_init (); return !g_tls_backend_supports_tls (g_tls_backend_get_default ());])],
167               [have_glib_networking=yes],
168               [have_glib_networking=no],
169               [have_glib_networking="unknown (cross-compiling)"])
170 CFLAGS="$save_CFLAGS"
171 LIBS="$save_LIBS"
172 AC_MSG_RESULT($have_glib_networking)
173
174 AC_ARG_ENABLE(tls-check,
175               AS_HELP_STRING([--disable-tls-check], [Don't error out if glib-networking is unavailable]))
176 if test "$enable_tls_check" != "no" -a "$have_glib_networking" = "no"; then
177         AC_MSG_ERROR([libsoup requires glib-networking for TLS support.
178
179 If you are building a package, you can pass --disable-tls-check to
180 allow building libsoup anyway (since glib-networking is not actually
181 required at compile time), but you should be sure to add a runtime
182 dependency on it.])
183 fi
184
185 dnl ******************************
186 dnl *** Stuff for regression tests
187 dnl ******************************
188 AC_MSG_NOTICE([checking for programs needed for regression tests])
189 MISSING_REGRESSION_TEST_PACKAGES=""
190
191 if test "$have_glib_networking" = "no"; then
192         MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES glib-networking"
193 fi
194
195 AC_ARG_WITH(apache-httpd,
196             AS_HELP_STRING([--with-apache-httpd], [Path to apache httpd (for tests)]),
197             APACHE_HTTPD="$withval",
198             [AC_PATH_PROGS(APACHE_HTTPD, httpd2 httpd apache2 apache, no, ${PATH}:/usr/sbin)])
199 if test "$APACHE_HTTPD" != "no"; then
200     AC_MSG_CHECKING([Apache version])
201     apache_version=`$APACHE_HTTPD -v 2>/dev/null | sed -ne 's/Server version: Apache\///p'`
202     case $apache_version in
203     2.2.*)
204         AC_MSG_RESULT([$apache_version (ok)])
205         ;;
206     *)
207         AC_MSG_RESULT([$apache_version (ignoring)])
208         APACHE_HTTPD="no"
209         ;;
210     esac
211 fi
212 AC_SUBST(APACHE_HTTPD)
213 AC_DEFINE_UNQUOTED(APACHE_HTTPD, "$APACHE_HTTPD", [Apache httpd])
214
215 if test "$APACHE_HTTPD" != "no"; then
216     AC_MSG_CHECKING([for Apache module directory])
217     AC_ARG_WITH(apache-module-dir,
218                 AS_HELP_STRING([--with-apache-module-dir], [Apache modules dirs (for tests)]),
219                 apache_module_dirs="$withval",
220                 [apache_prefix=`dirname \`dirname $APACHE_HTTPD\``
221                 mpm=`$APACHE_HTTPD -V | sed -ne 's/^Server MPM: */-/p' | tr 'A-Z' 'a-z'`
222                 # This only works with bash, but should fail harmlessly in sh
223                 apache_module_dirs=`echo $apache_prefix/lib{64,}/{apache,apache2,http,http2,httpd}{$mpm,}{/modules,}`])
224     for dir in $apache_module_dirs; do
225         if test -f $dir/mod_auth_digest.so; then
226             APACHE_MODULE_DIR="$dir"
227         fi
228         if test -f $dir/mod_ssl.so; then
229             APACHE_SSL_MODULE_DIR="$dir"
230             IF_HAVE_APACHE_SSL=""
231         fi
232         if test -f $dir/mod_php5.so; then
233             APACHE_PHP_MODULE_DIR="$dir"
234             APACHE_PHP_MODULE=mod_php5.so
235         fi
236         if test -f $dir/libphp5.so; then
237             APACHE_PHP_MODULE_DIR="$dir"
238             APACHE_PHP_MODULE=libphp5.so
239         fi
240     done
241     AC_MSG_RESULT($APACHE_MODULE_DIR)
242     AC_SUBST(APACHE_MODULE_DIR)
243     AC_SUBST(APACHE_SSL_MODULE_DIR)
244     AC_SUBST(APACHE_PHP_MODULE_DIR)
245     AC_SUBST(APACHE_PHP_MODULE)
246 fi
247
248 if test "$APACHE_HTTPD" != "no" -a -n "$APACHE_MODULE_DIR" -a -n "$APACHE_SSL_MODULE_DIR"; then
249     AC_DEFINE(HAVE_APACHE, 1, [Whether or not apache can be used for tests])
250     have_apache=1
251     if test -z "$APACHE_PHP_MODULE_DIR"; then
252         MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES mod_php5"
253     fi
254 else
255     have_apache=0
256     if test "$APACHE_HTTPD" = "no" -o -z "$APACHE_MODULE_DIR"; then
257         MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES apache"
258     else
259         MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES mod_ssl"
260     fi
261 fi
262 AM_CONDITIONAL(HAVE_APACHE, test $have_apache = 1)
263
264 if test "$have_apache" = 1; then
265     AC_CHECK_PROGS(PHP, php php5)
266
267     AC_MSG_CHECKING([for Apache PHP module])
268     if test -f $APACHE_PHP_MODULE_DIR/$APACHE_PHP_MODULE; then
269         have_php=yes
270         IF_HAVE_PHP=""
271     else
272         have_php=no
273         IF_HAVE_PHP="#"
274         MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php5"
275     fi
276     AC_MSG_RESULT($have_php)
277
278     if test "$have_php" = yes; then
279         AC_MSG_CHECKING([for xmlrpc-epi-php])
280         if $PHP --rf xmlrpc_server_create | grep -q "does not exist"; then
281             have_xmlrpc_epi_php=no
282             MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php-xmlrpc"
283         else
284             have_xmlrpc_epi_php=yes
285         fi
286         AC_MSG_RESULT($have_xmlrpc_epi_php)
287     fi
288 fi
289
290 AC_SUBST(IF_HAVE_PHP)
291 AM_CONDITIONAL(HAVE_XMLRPC_EPI_PHP, test "$have_xmlrpc_epi_php" = yes)
292
293 AC_PATH_PROG(CURL, curl, no)
294 if test "$CURL" != no; then
295     AC_DEFINE(HAVE_CURL, 1, [Whether or not curl can be used for tests])
296 else
297     MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES curl"
298 fi
299 AM_CONDITIONAL(HAVE_CURL, test "$CURL" != no)
300
301 AC_SUBST(MISSING_REGRESSION_TEST_PACKAGES)
302 AM_CONDITIONAL(MISSING_REGRESSION_TEST_PACKAGES, test -n "$MISSING_REGRESSION_TEST_PACKAGES")
303
304 dnl **********************************************************
305 dnl *** path of NTLM single-sign-on helper ntlm_auth
306 dnl **********************************************************
307 AC_ARG_WITH(ntlm-auth,
308             AC_HELP_STRING([--with-ntlm-auth=PATH],[Where to look for ntlm_auth, path points to ntlm_auth installation (default: /usr/bin/ntlm_auth)]),
309             ntlm_auth="$withval",
310             [if test $os_win32 = yes; then ntlm_auth="no"; else ntlm_auth="/usr/bin/ntlm_auth"; fi])
311 if test "$ntlm_auth" != "no"; then
312     AC_DEFINE(USE_NTLM_AUTH, 1, [Whether or not use Samba's 'winbind' daemon helper 'ntlm_auth' for NTLM single-sign-on])
313     if test "$ntlm_auth" = "yes"; then
314         dnl --with-ntlm-auth (without path) used, use default path
315         ntlm_auth="/usr/bin/ntlm_auth"
316     fi
317 fi
318 AC_SUBST(ntlm_auth)
319 AC_DEFINE_UNQUOTED(NTLM_AUTH, "$ntlm_auth", [Samba's 'winbind' daemon helper 'ntlm_auth' which can be used for NTLM single-sign-on])
320
321 dnl ****************************************************
322 dnl *** Warnings to show if using GCC                ***
323 dnl *** (do this last so -Werror won't mess up tests ***
324 dnl ****************************************************
325
326 AC_ARG_ENABLE(more-warnings,
327               AS_HELP_STRING([--disable-more-warnings], [Inhibit compiler warnings]),
328               set_more_warnings=no)
329
330 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
331         CFLAGS="$CFLAGS \
332                 -Wall -Wstrict-prototypes -Werror=missing-prototypes \
333                 -Werror=implicit-function-declaration \
334                 -Werror=pointer-arith -Werror=init-self -Werror=format=2 \
335                 -Werror=missing-include-dirs -Werror=aggregate-return \
336                 -Werror=declaration-after-statement"
337 fi
338
339 dnl *************************
340 dnl *** Output Everything ***
341 dnl *************************
342
343 AC_CONFIG_HEADERS([config.h])
344 AC_CONFIG_FILES([
345         libsoup-2.4.pc
346         libsoup-gnome-2.4.pc
347         Makefile
348         libsoup-zip
349         libsoup/Makefile
350         tests/Makefile
351         tests/httpd.conf
352         docs/Makefile
353         docs/reference/Makefile
354         ])
355 AC_OUTPUT
356
357 if test -n "$MISSING_REGRESSION_TEST_PACKAGES"; then
358     echo ""
359     echo Some regression tests will not be run due to missing packages:
360     echo $MISSING_REGRESSION_TEST_PACKAGES
361     echo ""
362 fi