test: server: Fix reading line
[libisds.git] / configure.ac
blob477632e8ee7562e4eec42281a64552f0fa868fe3
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([CURLOPT_KEYPASSWD], [], [], [[#include <curl/curl.h>]])
81     AC_CHECK_DECLS([CURLOPT_SSLKEYPASSWD], [], [], [[#include <curl/curl.h>]])
82     CPPFLAGS="$cppflags_orig"
83     ])
84 AM_CONDITIONAL([BUILD_CURL], [test -n "$LIBCURL"])
86 dnl On-line tests requires libcurl
87 AM_CONDITIONAL([BUILD_ONLINE_TEST],
88                [test -n "$LIBCURL" -a "$enable_test" = "yes" \
89                     -a "$enable_online_test" = "yes"])
91 #TODO: Determine minimal version
92 AM_PATH_LIBGCRYPT([1:1.4.0])
94 # GPGME is compiled with large file support by default. We need to follow not
95 # to break ABI.
96 AC_SYS_LARGEFILE
97 #TODO: Determine minimal version
98 AM_PATH_GPGME()
100 # Check for expat
101 AC_CHECK_LIB([expat], [XML_ExpatVersionInfo],
102              EXPAT_LIBS=-lexpat
103              AC_SUBST(EXPAT_LIBS))
104 # Verify minimal version. See src/phys.c: init_expat()
105 expat_min_major="2"
106 expat_min_minor="0"
107 expat_min_micro="0"
108 expat_min_version="${expat_min_major}.${expat_min_minor}.${expat_min_micro}"
109 AC_MSG_CHECKING([for expat library version >= ${expat_min_version}])
110 AC_COMPILE_IFELSE(
111         AC_LANG_PROGRAM(
112             [#define MIN_MAJOR ${expat_min_major}
113             #define MIN_MINOR ${expat_min_minor}
114             #define MIN_MICRO ${expat_min_micro}
115             #include <expat.h>],
116             [[#if (XML_MAJOR_VERSION < MIN_MAJOR) || \
117     (XML_MAJOR_VERSION == MIN_MAJOR && XML_MINOR_VERSION < MIN_MINOR) || \
118     (XML_MAJOR_VERSION == MIN_MAJOR && XML_MINOR_VERSION == MIN_MINOR && \
119         XML_MICRO_VERSION < MIN_MICRO)
120 #error "Expat library is too old"
121 #endif]]),
122         AC_MSG_RESULT([yes]),
123         AC_MSG_FAILURE([Upgrade your expat to ${expat_min_version}])
127 # Do not consider compiler warnings as errors
128 # This harms libxml configure test
129 AC_ARG_ENABLE(fatalwarnings, [AS_HELP_STRING([--disable-fatalwarnings],
130                         [Do not consider compiler warnings as errors])])
131 AS_IF([test "$enable_fatalwarnings" = "no"], , CFLAGS="${CFLAGS} -Werror")
134 # Checks for header files.
135 AC_CHECK_HEADERS([fcntl.h locale.h stdint.h stdlib.h string.h unistd.h])
137 # Checks for typedefs, structures, and compiler characteristics.
138 AC_TYPE_SIZE_T
139 #AC_TYPE_SSIZE_T
140 AC_TYPE_UINT8_T
142 # Checks for library functions.
143 AC_FUNC_MALLOC
144 AC_FUNC_MKTIME
145 AC_FUNC_MMAP
146 AC_CHECK_FUNCS([localtime_r memset munmap setlocale strdup strerror])
148 # Default CFLAGS
149 CFLAGS="${CFLAGS} -std=c99 -Wall"
151 AC_CONFIG_FILES([Makefile src/Makefile po/Makefile.in client/Makefile
152                  test/Makefile test/simline/Makefile test/online/Makefile
153                  libisds.pc])
155 #AC_CONFIG_SUBDIRS([src])
156 AC_OUTPUT