Move offline tests to subdirectory
[libisds.git] / configure.ac
blob096be6e9fb66c8cc1951d989782ce3e9306dc307
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ([2.63])
5 AC_INIT([libisds], [0.5], [petr.pisar@atlas.cz])
6 AM_INIT_AUTOMAKE(libisds, 0.5)
7 AC_CONFIG_SRCDIR([src/isds.c])
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_HEADERS([config.h])
11 # Checks for programs.
12 AC_PROG_CC
13 AC_PROG_CPP
14 #AC_PROG_MAKE_SET
15 LT_INIT
16 # For libtool < 1.9b (Debian lenny).
17 # AC_PROG_LIBTOOL has been obsoleted by LT_INIT
18 AC_PROG_LIBTOOL
21 # Enable example clients
22 AC_ARG_ENABLE(example, [AS_HELP_STRING([--enable-example],
23                               [Build library usage examples])])
24 AM_CONDITIONAL([BUILD_EXAMPLE], [test "$enable_example" = "yes"])
26 # Enable tests
27 AC_ARG_ENABLE(test, [AS_HELP_STRING([--enable-test],
28                               [Enable internal library tests])])
29 AM_CONDITIONAL([BUILD_TEST], [test "$enable_test" = "yes"])
31 # Enable on-line test
32 AC_ARG_ENABLE(online-test, [AS_HELP_STRING([--enable-online-test],
33                               [Enable on-line internal library tests])])
34 # Enable gettext
35 AM_GNU_GETTEXT_VERSION([0.17])
36 AM_GNU_GETTEXT([external])
38 # Enable debug
39 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],
40                         [Compile in debugging mode])])
41 AS_IF([test "$enable_debug" = "yes"],
42       CFLAGS="${CFLAGS} -g"
43       dnl AC_SUBST(DEBUG_CFLAGS)
44       AC_DEFINE([ENABLE_DEBUG], [1],
45                 [Define if you want include debugging code])
46       )
49 # Checks for libraries.
50 #TODO: Verify minimal version. libxml2-2.6.26 is just a guess.
51 AM_PATH_XML2([2.6.26])
53 # Checks for CURL 
54 LIBCURL_CHECK_CONFIG()
55 AS_IF([test -z "$LIBCURL"],
56       AC_MSG_WARN([libcurl disabled or not found. Network features will be
57                    disabled.]),
58     [
59     cppflags_orig="$CPPFLAGS"
60     CPPFLAGS="${CPPFLAGS} ${LIBCURL_CPPFLAGS}"
61     AC_CHECK_DECLS([CURLOPT_TIMEOUT_MS], [],
62         AC_MSG_WARN([Your libcurl does not support subsecond timeout resolution.
63                      Consider upgrade to 7.16.2 version.]),
64         [[#include <curl/curl.h>]])
65     AC_CHECK_DECLS([CURLOPT_USERNAME], [],
66         AC_MSG_WARN([Your libcurl does not support separate username and password.
67                      Your ISDS username could not contain colon.
68                      Consider upgrade to 7.19.1 version.]),
69         [[#include <curl/curl.h>]])
70     AC_CHECK_DECLS([CURLOPT_SSLCERTTYPE], [],
71         AC_MSG_WARN([Your libcurl does not support client certificate format
72                      declaration (PEM vs. DER).
73                      Consider upgrade to 7.9.3 version.]),
74         [[#include <curl/curl.h>]])
75     AC_CHECK_DECLS([CURLOPT_CRLFILE], [],
76         AC_MSG_WARN([Your libcurl does not support certificate revocation list
77                      declaration.
78                      Consider upgrade to 7.19.0 version.]),
79         [[#include <curl/curl.h>]])
80     AC_CHECK_DECLS([CURLINFO_REDIRECT_URL], [],
81         AC_MSG_ERROR([Your libcurl does not support getting redirected URL.
82                      You must upgrade to 7.18.2 version.]),
83         [[#include <curl/curl.h>]])
84     AC_CHECK_DECLS([CURLOPT_KEYPASSWD], [], [], [[#include <curl/curl.h>]])
85     AC_CHECK_DECLS([CURLOPT_SSLKEYPASSWD], [], [], [[#include <curl/curl.h>]])
86     CPPFLAGS="$cppflags_orig"
87     ])
88 AM_CONDITIONAL([BUILD_CURL], [test -n "$LIBCURL"])
90 dnl On-line tests requires libcurl
91 AM_CONDITIONAL([BUILD_ONLINE_TEST],
92                [test -n "$LIBCURL" -a "$enable_test" = "yes" \
93                     -a "$enable_online_test" = "yes"])
95 #TODO: Determine minimal version
96 AM_PATH_LIBGCRYPT([1:1.4.0])
98 # GPGME is compiled with large file support by default. We need to follow not
99 # to break ABI.
100 AC_SYS_LARGEFILE
101 #TODO: Determine minimal version
102 AM_PATH_GPGME()
104 # Check for expat
105 AC_CHECK_LIB([expat], [XML_ExpatVersionInfo],
106              EXPAT_LIBS=-lexpat
107              AC_SUBST(EXPAT_LIBS))
108 # Verify minimal version. See src/phys.c: init_expat()
109 expat_min_major="2"
110 expat_min_minor="0"
111 expat_min_micro="0"
112 expat_min_version="${expat_min_major}.${expat_min_minor}.${expat_min_micro}"
113 AC_MSG_CHECKING([for expat library version >= ${expat_min_version}])
114 AC_COMPILE_IFELSE(
115         AC_LANG_PROGRAM(
116             [#define MIN_MAJOR ${expat_min_major}
117             #define MIN_MINOR ${expat_min_minor}
118             #define MIN_MICRO ${expat_min_micro}
119             #include <expat.h>],
120             [[#if (XML_MAJOR_VERSION < MIN_MAJOR) || \
121     (XML_MAJOR_VERSION == MIN_MAJOR && XML_MINOR_VERSION < MIN_MINOR) || \
122     (XML_MAJOR_VERSION == MIN_MAJOR && XML_MINOR_VERSION == MIN_MINOR && \
123         XML_MICRO_VERSION < MIN_MICRO)
124 #error "Expat library is too old"
125 #endif]]),
126         AC_MSG_RESULT([yes]),
127         AC_MSG_FAILURE([Upgrade your expat to ${expat_min_version}])
131 # Do not consider compiler warnings as errors
132 # This harms libxml configure test
133 AC_ARG_ENABLE(fatalwarnings, [AS_HELP_STRING([--disable-fatalwarnings],
134                         [Do not consider compiler warnings as errors])])
135 AS_IF([test "$enable_fatalwarnings" = "no"], , CFLAGS="${CFLAGS} -Werror")
138 # Checks for header files.
139 AC_CHECK_HEADERS([fcntl.h locale.h stdint.h stdlib.h string.h unistd.h])
141 # Checks for typedefs, structures, and compiler characteristics.
142 AC_TYPE_SIZE_T
143 #AC_TYPE_SSIZE_T
144 AC_TYPE_UINT8_T
146 # Checks for library functions.
147 AC_FUNC_MALLOC
148 AC_FUNC_MKTIME
149 AC_FUNC_MMAP
150 AC_CHECK_FUNCS([localtime_r memset munmap setlocale strdup strerror])
152 # Default CFLAGS
153 CFLAGS="${CFLAGS} -std=c99 -Wall"
155 AC_CONFIG_FILES([Makefile src/Makefile po/Makefile.in client/Makefile
156                  test/Makefile test/offline/Makefile test/simline/Makefile
157                  test/online/Makefile libisds.pc])
159 #AC_CONFIG_SUBDIRS([src])
160 AC_OUTPUT