test: Fix a typo
[libisds.git] / configure.ac
blob1f1cd4e14121b4e8a15571407e4a8631c2f74dd0
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ([2.63])
5 AC_INIT([libisds], [0.6.2], [petr.pisar@atlas.cz])
6 AM_INIT_AUTOMAKE(libisds, 0.6.2)
7 AC_LANG([C])
8 AC_CONFIG_SRCDIR([src/isds.c])
9 AC_CONFIG_MACRO_DIR([m4])
10 AC_CONFIG_HEADERS([config.h])
12 # Checks for programs.
13 AC_PROG_CC
14 AC_PROG_CPP
15 #AC_PROG_MAKE_SET
16 LT_INIT
17 # For libtool < 1.9b (Debian lenny).
18 # AC_PROG_LIBTOOL has been obsoleted by LT_INIT
19 AC_PROG_LIBTOOL
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"])
27 # Enable tests
28 AC_ARG_ENABLE(test, [AS_HELP_STRING([--enable-test],
29                               [Enable internal library tests])])
30 AM_CONDITIONAL([BUILD_TEST], [test "$enable_test" = "yes"])
32 # Enable on-line test
33 AC_ARG_ENABLE(online-test, [AS_HELP_STRING([--enable-online-test],
34                               [Enable on-line internal library tests])])
35 # Enable gettext
36 AM_GNU_GETTEXT_VERSION([0.18.1])
37 AM_GNU_GETTEXT([external])
39 # Enable debug
40 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],
41                         [Compile in debugging mode])])
42 AS_IF([test "$enable_debug" = "yes"],
43       CFLAGS="${CFLAGS} -g"
44       dnl AC_SUBST(DEBUG_CFLAGS)
45       AC_DEFINE([ENABLE_DEBUG], [1],
46                 [Define if you want include debugging code])
47       )
50 # Checks for libraries.
51 #TODO: Verify minimal version. libxml2-2.6.26 is just a guess.
52 AM_PATH_XML2([2.6.26])
54 # Checks for CURL 
55 LIBCURL_CHECK_CONFIG()
56 AS_IF([test -z "$LIBCURL"],
57       AC_MSG_WARN([libcurl disabled or not found. Network features will be
58                    disabled.]),
59     [
60     cppflags_orig="$CPPFLAGS"
61     CPPFLAGS="${CPPFLAGS} ${LIBCURL_CPPFLAGS}"
62     AC_CHECK_DECLS([CURLOPT_TIMEOUT_MS], [],
63         AC_MSG_WARN([Your libcurl does not support subsecond timeout resolution.
64                      Consider upgrade to 7.16.2 version.]),
65         [[#include <curl/curl.h>]])
66     AC_CHECK_DECLS([CURLOPT_USERNAME], [],
67         AC_MSG_WARN([Your libcurl does not support separate username and password.
68                      Your ISDS username could not contain colon.
69                      Consider upgrade to 7.19.1 version.]),
70         [[#include <curl/curl.h>]])
71     AC_CHECK_DECLS([CURLOPT_SSLCERTTYPE], [],
72         AC_MSG_WARN([Your libcurl does not support client certificate format
73                      declaration (PEM vs. DER).
74                      Consider upgrade to 7.9.3 version.]),
75         [[#include <curl/curl.h>]])
76     AC_CHECK_DECLS([CURLOPT_CRLFILE], [],
77         AC_MSG_WARN([Your libcurl does not support certificate revocation list
78                      declaration.
79                      Consider upgrade to 7.19.0 version.]),
80         [[#include <curl/curl.h>]])
81     AC_CHECK_DECLS([CURLINFO_REDIRECT_URL], [],
82         AC_MSG_ERROR([Your libcurl does not support getting redirected URL.
83                      You must upgrade to 7.18.2 version.]),
84         [[#include <curl/curl.h>]])
85     AC_CHECK_DECLS([CURLOPT_KEYPASSWD], [], [], [[#include <curl/curl.h>]])
86     AC_CHECK_DECLS([CURLOPT_SSLKEYPASSWD], [], [], [[#include <curl/curl.h>]])
87     CPPFLAGS="$cppflags_orig"
88     ])
89 AM_CONDITIONAL([BUILD_CURL], [test -n "$LIBCURL"])
91 dnl libcurl < 7.28.0 suffers from re-authorization bug, unfortunally there is
92 dnl no way how to re-check libcurl version. Thus we use explicit switch.
93 AC_ARG_ENABLE(curlreauthorizationbug,
94               [AS_HELP_STRING([--enable-curlreauthorizationbug],
95                         [Compile in work-around for re-authorization bug in
96                          curl < 7.28.0. Fixed by libcurl commit
97                          ce8311c7e49eca93c136b58efa6763853541ec97.])])
98 AS_IF([test "$enable_curlreauthorizationbug" = "yes"],
99       AC_DEFINE([HAVE_CURL_REAUTHORIZATION_BUG], [1],
100                 [Define if you want work-aroung re-autorization bug in libcurl])
101       )
103 dnl On-line tests requires libcurl
104 AM_CONDITIONAL([BUILD_ONLINE_TEST],
105                [test -n "$LIBCURL" -a "$enable_test" = "yes" \
106                     -a "$enable_online_test" = "yes"])
108 dnl Simulated tests require gnutls
109 PKG_PROG_PKG_CONFIG()
110 AS_IF([test "$enable_test" = "yes"], [
111     PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.12.0])
112     AC_SUBST(LIBGNUTLS_CFLAGS)
113     AC_SUBST(LIBGNUTLS_LIBS)
114     ])
116 #TODO: Determine minimal version
117 AM_PATH_LIBGCRYPT([1:1.4.0])
119 # GPGME is compiled with large file support by default. We need to follow not
120 # to break ABI.
121 AC_SYS_LARGEFILE
122 #TODO: Determine minimal version
123 AM_PATH_GPGME()
125 # Check for expat
126 AC_CHECK_LIB([expat], [XML_ExpatVersionInfo],
127              EXPAT_LIBS=-lexpat
128              AC_SUBST(EXPAT_LIBS))
129 # Verify minimal version. See src/phys.c: init_expat()
130 expat_min_major="2"
131 expat_min_minor="0"
132 expat_min_micro="0"
133 expat_min_version="${expat_min_major}.${expat_min_minor}.${expat_min_micro}"
134 AC_MSG_CHECKING([for expat library version >= ${expat_min_version}])
135 AC_COMPILE_IFELSE(
136         [AC_LANG_PROGRAM(
137             [[#define MIN_MAJOR ${expat_min_major}
138             #define MIN_MINOR ${expat_min_minor}
139             #define MIN_MICRO ${expat_min_micro}
140             #include <expat.h>]],
141             [[#if (XML_MAJOR_VERSION < MIN_MAJOR) || \
142     (XML_MAJOR_VERSION == MIN_MAJOR && XML_MINOR_VERSION < MIN_MINOR) || \
143     (XML_MAJOR_VERSION == MIN_MAJOR && XML_MINOR_VERSION == MIN_MINOR && \
144             XML_MICRO_VERSION < MIN_MICRO)
145             #error "Expat library is too old"
146             #endif]])],
147         AC_MSG_RESULT([yes]),
148         AC_MSG_FAILURE([Upgrade your expat to ${expat_min_version}])
152 # Do not consider compiler warnings as errors
153 # This harms libxml configure test
154 AC_ARG_ENABLE(fatalwarnings, [AS_HELP_STRING([--disable-fatalwarnings],
155                         [Do not consider compiler warnings as errors])])
156 AS_IF([test "$enable_fatalwarnings" = "no"], , CFLAGS="${CFLAGS} -Werror")
159 # Checks for header files.
160 AC_CHECK_HEADERS([fcntl.h locale.h stdint.h stdlib.h string.h unistd.h])
162 # Checks for typedefs, structures, and compiler characteristics.
163 AC_TYPE_SIZE_T
164 #AC_TYPE_SSIZE_T
165 AC_TYPE_UINT8_T
167 # Checks for library functions.
168 AC_FUNC_MALLOC
169 AC_FUNC_MKTIME
170 AC_FUNC_MMAP
171 AC_CHECK_FUNCS([localtime_r memset munmap setlocale strdup strerror])
173 # Default CFLAGS
174 CFLAGS="${CFLAGS} -std=c99 -Wall"
176 AC_CONFIG_FILES([Makefile src/Makefile po/Makefile.in client/Makefile
177                  test/Makefile test/offline/Makefile test/simline/Makefile
178                  test/online/Makefile libisds.pc])
180 #AC_CONFIG_SUBDIRS([src])
181 AC_OUTPUT