2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([libisds], [0.10], [petr.pisar@atlas.cz])
8 AC_CONFIG_SRCDIR([src/isds.c])
9 AC_CONFIG_MACRO_DIR([m4])
10 AC_CONFIG_HEADERS([config.h])
12 # Checks for programs.
17 # For libtool < 1.9b (Debian lenny).
18 # AC_PROG_LIBTOOL has been obsoleted by LT_INIT
22 # Enable example clients
23 AC_ARG_ENABLE(example, [AS_HELP_STRING([--enable-example],
24 [Build library usage examples])])
25 AM_CONDITIONAL([BUILD_EXAMPLE], [test "$enable_example" = "yes"])
28 AC_ARG_ENABLE(test, [AS_HELP_STRING([--enable-test],
29 [Enable internal library tests])])
30 AM_CONDITIONAL([BUILD_TEST], [test "$enable_test" = "yes"])
33 AC_ARG_ENABLE(online-test, [AS_HELP_STRING([--enable-online-test],
34 [Enable on-line internal library tests])])
36 AM_GNU_GETTEXT_VERSION([0.18.2])
37 AM_GNU_GETTEXT([external])
40 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],
41 [Compile in debugging mode])])
42 AS_IF([test "$enable_debug" = "yes"],
44 dnl AC_SUBST(DEBUG_CFLAGS)
45 AC_DEFINE([ENABLE_DEBUG], [1],
46 [Define if you want include debugging code])
49 AC_CHECK_DECL([_WIN32])
50 AM_CONDITIONAL([WIN32], [test "$ac_cv_have_decl__WIN32" = "yes"])
52 # Checks for libraries.
53 #TODO: Verify minimal version. libxml2-2.6.26 is just a guess.
54 AM_PATH_XML2([2.6.26])
57 LIBCURL_CHECK_CONFIG()
58 AS_IF([test -z "$LIBCURL"],
59 AC_MSG_WARN([libcurl disabled or not found. Network features will be
62 cppflags_orig="$CPPFLAGS"
63 CPPFLAGS="${CPPFLAGS} ${LIBCURL_CPPFLAGS}"
64 AC_CHECK_DECLS([CURLOPT_HEADEROPT], [],
65 AC_MSG_WARN([Your libcurl does not support not sending custom HTTP
67 Consider upgrade to 7.37.0 version.]),
68 [[#include <curl/curl.h>]])
69 AC_CHECK_DECLS([CURLOPT_TIMEOUT_MS], [],
70 AC_MSG_WARN([Your libcurl does not support subsecond timeout resolution.
71 Consider upgrade to 7.16.2 version.]),
72 [[#include <curl/curl.h>]])
73 AC_CHECK_DECLS([CURLOPT_USERNAME], [],
74 AC_MSG_WARN([Your libcurl does not support separate username and password.
75 Your ISDS username could not contain colon.
76 Consider upgrade to 7.19.1 version.]),
77 [[#include <curl/curl.h>]])
78 AC_CHECK_DECLS([CURLOPT_SSLCERTTYPE], [],
79 AC_MSG_WARN([Your libcurl does not support client certificate format
80 declaration (PEM vs. DER).
81 Consider upgrade to 7.9.3 version.]),
82 [[#include <curl/curl.h>]])
83 AC_CHECK_DECLS([CURLOPT_CRLFILE], [],
84 AC_MSG_WARN([Your libcurl does not support certificate revocation list
86 Consider upgrade to 7.19.0 version.]),
87 [[#include <curl/curl.h>]])
88 AC_CHECK_DECLS([CURLINFO_REDIRECT_URL], [],
89 AC_MSG_ERROR([Your libcurl does not support getting redirected URL.
90 You must upgrade to 7.18.2 version.]),
91 [[#include <curl/curl.h>]])
92 AC_CHECK_DECLS([CURLOPT_KEYPASSWD], [], [], [[#include <curl/curl.h>]])
93 AC_CHECK_DECLS([CURLOPT_SSLKEYPASSWD], [], [], [[#include <curl/curl.h>]])
94 CPPFLAGS="$cppflags_orig"
96 AM_CONDITIONAL([BUILD_CURL], [test -n "$LIBCURL"])
98 dnl libcurl < 7.28.0 suffers from re-authorization bug, unfortunally there is
99 dnl no way how to re-check libcurl version. Thus we use explicit switch.
100 AC_ARG_ENABLE(curlreauthorizationbug,
101 [AS_HELP_STRING([--enable-curlreauthorizationbug],
102 [Compile in work-around for re-authorization bug in
103 curl < 7.28.0. Fixed by libcurl commit
104 ce8311c7e49eca93c136b58efa6763853541ec97.])])
105 AS_IF([test "$enable_curlreauthorizationbug" = "yes"],
106 AC_DEFINE([HAVE_CURL_REAUTHORIZATION_BUG], [1],
107 [Define if you want work-around re-authorization bug in libcurl])
110 dnl On-line tests requires libcurl
111 AM_CONDITIONAL([BUILD_ONLINE_TEST],
112 [test -n "$LIBCURL" -a "$enable_test" = "yes" \
113 -a "$enable_online_test" = "yes"])
115 dnl Simulated tests require gnutls
116 PKG_PROG_PKG_CONFIG()
117 AS_IF([test "$enable_test" = "yes"], [
118 PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.12.0])
119 AC_SUBST(LIBGNUTLS_CFLAGS)
120 AC_SUBST(LIBGNUTLS_LIBS)
123 AC_ARG_ENABLE([openssl-backend],
124 AS_HELP_STRING([--enable-openssl-backend], [Enable OpenSSL as cryptographic back-end.]))
125 AS_IF([test "x${enable_openssl_backend}" = "xyes"], [
126 dnl Use OpenSSL cryptographic back-end.
128 AC_DEFINE([USE_OPENSSL_BACKEND], [1], [Define if you want to use OpenSSL as cryptographic back-end.])
129 AC_SEARCH_LIBS([CMS_get0_content], [crypto], [], [AC_MSG_ERROR([OpenSSL librypto not found.])])
131 dnl Use default cryptographic back-end.
133 #TODO: Determine minimal version
134 AM_PATH_LIBGCRYPT([1:1.4.0])
136 # GPGME is compiled with large file support by default. We need to follow not
139 #TODO: Determine minimal version
142 AM_CONDITIONAL([USE_OPENSSL_BACKEND], [test "x${enable_openssl_backend}" = "xyes"])
145 AC_CHECK_LIB([expat], [XML_ExpatVersionInfo],
147 AC_SUBST(EXPAT_LIBS))
148 # Verify minimal version. See src/phys.c: init_expat()
152 expat_min_version="${expat_min_major}.${expat_min_minor}.${expat_min_micro}"
153 AC_MSG_CHECKING([for expat library version >= ${expat_min_version}])
156 [[#define MIN_MAJOR ${expat_min_major}
157 #define MIN_MINOR ${expat_min_minor}
158 #define MIN_MICRO ${expat_min_micro}
159 #include <expat.h>]],
160 [[#if (XML_MAJOR_VERSION < MIN_MAJOR) || \
161 (XML_MAJOR_VERSION == MIN_MAJOR && XML_MINOR_VERSION < MIN_MINOR) || \
162 (XML_MAJOR_VERSION == MIN_MAJOR && XML_MINOR_VERSION == MIN_MINOR && \
163 XML_MICRO_VERSION < MIN_MICRO)
164 #error "Expat library is too old"
166 AC_MSG_RESULT([yes]),
167 AC_MSG_FAILURE([Upgrade your expat to ${expat_min_version}])
170 # Do not consider compiler warnings as errors
171 # This harms libxml configure test
172 AC_ARG_ENABLE(fatalwarnings, [AS_HELP_STRING([--disable-fatalwarnings],
173 [Do not consider compiler warnings as errors])])
174 AS_IF([test "$enable_fatalwarnings" = "no"], , CFLAGS="${CFLAGS} -Werror")
177 # Build and install documentation
178 AC_ARG_ENABLE(doc, [AS_HELP_STRING([--disable-doc],
179 [Do not build and install documentation])])
180 AS_IF([test "$enable_doc" = "no"], , [
181 AC_CHECK_PROG([HAVE_XSLTPROC], [xsltproc], [yes])
182 AS_IF([test "$HAVE_XSLTPROC" != "yes"],
183 AC_MSG_FAILURE([Missing xsltproc!])
186 # Find DocBook XSLT sheets
187 AC_ARG_WITH(docbook-xsl-stylesheets,
188 [AS_HELP_STRING([--with-docbook-xsl-stylesheets=DIR],
189 [Specify XSL style sheet root directory for manual page
190 generation from DocBook source])],
191 , with_docbook_xsl_stylesheets=yes)
193 DOCBOOK_STYLE="/usr/share/sgml/docbook/xsl-stylesheets"
194 AS_IF([test "$with_docbook_xsl_stylesheets" != "yes"],
195 [DOCBOOK_STYLE="$with_docbook_xsl_stylesheets"])
196 AC_MSG_CHECKING([for DocBook XSLT stylesheet location in "$DOCBOOK_STYLE"])
197 AS_IF([echo '<para/>' |
198 xsltproc "${DOCBOOK_STYLE}/manpages/docbook.xsl" - 2>/dev/null],
199 AC_MSG_RESULT([ok]) AC_SUBST(DOCBOOK_STYLE),
201 AC_MSG_FAILURE([missing!])
206 AM_CONDITIONAL([BUILD_MAN], [test -n "$DOCBOOK_STYLE"])
209 # Checks for header files.
210 AC_CHECK_HEADERS([fcntl.h locale.h stdint.h stdlib.h string.h unistd.h])
212 # Checks for typedefs, structures, and compiler characteristics.
217 # Checks for library functions.
221 AC_CHECK_FUNCS([localtime_r memset munmap setlocale strdup strerror])
224 CFLAGS="${CFLAGS} -std=c99 -Wall"
226 dnl Check for strdup() feature test macros
227 dnl strdup() is provided since SUSv2, thus _XOPEN_SOURCE >= 500 has to be
228 dnl defined with -std=c99. However Mac OS X requires 600. Reported as
229 dnl <rdar://problem/19363342>.
230 AC_MSG_CHECKING([Checking for _XOPEN_SOURCE level needed for strdup()])
232 [AC_LANG_PROGRAM([[#define _XOPEN_SOURCE 500
233 #include <string.h>]], [[(void)strdup("");]])],
234 [xopen_source_level_for_strdup=500],
236 [AC_LANG_PROGRAM([[#define _XOPEN_SOURCE 600
237 #include <string.h>]], [[(void)strdup("");]])],
238 [xopen_source_level_for_strdup=600],
239 [AC_MSG_FAILURE([Cannot determine _XOPEN_SOURCE level for strdup()])]
241 AC_MSG_RESULT([$xopen_source_level_for_strdup])
242 AC_DEFINE_UNQUOTED([XOPEN_SOURCE_LEVEL_FOR_STRDUP],
243 [$xopen_source_level_for_strdup],
244 [_XOPEN_SOURCE level needed for strdup()])
247 AC_CONFIG_FILES([Makefile src/Makefile po/Makefile.in client/Makefile
249 test/Makefile test/offline/Makefile test/simline/Makefile
250 test/online/Makefile libisds.pc])
252 #AC_CONFIG_SUBDIRS([src])