Fix isds_log_message() conditionaled by old cURL
[libisds.git] / configure.ac
blobab20ac2464ecd6dec4662f72b49f6a5e0c4e76bd
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ([2.63])
5 AC_INIT([libisds], [0.2.1], [petr.pisar@atlas.cz])
6 AM_INIT_AUTOMAKE(libisds, 0.2.1)
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
18 # Enable example clients
19 AC_ARG_ENABLE(example, [AS_HELP_STRING([--enable-example],
20                               [Build library usage examples])])
21 AM_CONDITIONAL([BUILD_EXAMPLE], [test "$enable_example" = "yes"])
23 # Enable tests
24 AC_ARG_ENABLE(test, [AS_HELP_STRING([--enable-test],
25                               [Enable internal library tests])])
26 AM_CONDITIONAL([BUILD_TEST], [test "$enable_test" = "yes"])
28 # Enable on-line test
29 AC_ARG_ENABLE(online-test, [AS_HELP_STRING([--enable-online-test],
30                               [Enable on-line internal library tests])])
31 AM_CONDITIONAL([BUILD_ONLINE_TEST],
32                [test "$enable_test" = "yes" -a "$enable_online_test" = "yes"])
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 AC_CHECK_DECLS([CURLOPT_TIMEOUT_MS], [],
56     AC_MSG_WARN([Your libcurl does not support subsecond timeout resolution.
57                  Consider upgrade to 7.16.2 version.]),
58     [[#include <curl/curl.h>]])
59 AC_CHECK_DECLS([CURLOPT_USERNAME], [],
60     AC_MSG_WARN([Your libcurl does not support separate username and password.
61                  Your ISDS username could not contain colon.
62                  Consider upgrade to 7.19.1 version.]),
63     [[#include <curl/curl.h>]])
64 AC_CHECK_DECLS([CURLOPT_SSLCERTTYPE], [],
65     AC_MSG_WARN([Your libcurl does not support client certificate format
66                  declaration (PEM vs. DER).
67                  Consider upgrade to 7.9.3 version.]),
68     [[#include <curl/curl.h>]])
69 AC_CHECK_DECLS([CURLOPT_CRLFILE], [],
70     AC_MSG_WARN([Your libcurl does not support certificate revocation list
71                  declaration.
72                  Consider upgrade to 7.19.0 version.]),
73     [[#include <curl/curl.h>]])
74 AC_CHECK_DECLS([CURLOPT_KEYPASSWD], [], [], [[#include <curl/curl.h>]])
75 AC_CHECK_DECLS([CURLOPT_SSLKEYPASSWD], [], [], [[#include <curl/curl.h>]])
77 #TODO: Determine minimal version
78 AM_PATH_LIBGCRYPT([1:1.4.0])
80 # GPGME is compiled with large file support by default. We need to follow not
81 # to break ABI.
82 AC_SYS_LARGEFILE
83 #TODO: Determine minimal version
84 AM_PATH_GPGME()
86 # Check for expat
87 AC_CHECK_LIB([expat], [XML_ExpatVersionInfo],
88              EXPAT_LIBS=-lexpat
89              AC_SUBST(EXPAT_LIBS))
90 # Verify minimal version. See src/phys.c: init_expat()
91 expat_min_major="2"
92 expat_min_minor="0"
93 expat_min_micro="0"
94 expat_min_version="${expat_min_major}.${expat_min_minor}.${expat_min_micro}"
95 AC_MSG_CHECKING([for expat library version >= ${expat_min_version}])
96 AC_COMPILE_IFELSE(
97         AC_LANG_PROGRAM(
98             [#define MIN_MAJOR ${expat_min_major}
99             #define MIN_MINOR ${expat_min_minor}
100             #define MIN_MICRO ${expat_min_micro}
101             #include <expat.h>],
102             [[#if (XML_MAJOR_VERSION < MIN_MAJOR) || \
103     (XML_MAJOR_VERSION == MIN_MAJOR && XML_MINOR_VERSION < MIN_MINOR) || \
104     (XML_MAJOR_VERSION == MIN_MAJOR && XML_MINOR_VERSION == MIN_MINOR && \
105         XML_MICRO_VERSION < MIN_MICRO)
106 #error "Expat library is too old"
107 #endif]]),
108         AC_MSG_RESULT([yes]),
109         AC_MSG_FAILURE([Upgrade your expat to ${expat_min_version}])
113 # Do not consider compiler warnings as errors
114 # This harms libxml confgure test
115 AC_ARG_ENABLE(fatalwarnings, [AS_HELP_STRING([--disable-fatalwarnings],
116                         [Do not consider compiler warnings as errors])])
117 AS_IF([test "$enable_fatalwarnings" = "no"], , CFLAGS="${CFLAGS} -Werror")
120 # Checks for header files.
121 AC_CHECK_HEADERS([fcntl.h locale.h stdint.h stdlib.h string.h unistd.h])
123 # Checks for typedefs, structures, and compiler characteristics.
124 AC_TYPE_SIZE_T
125 #AC_TYPE_SSIZE_T
126 AC_TYPE_UINT8_T
128 # Checks for library functions.
129 AC_FUNC_MALLOC
130 AC_FUNC_MKTIME
131 AC_FUNC_MMAP
132 AC_CHECK_FUNCS([localtime_r memset munmap setlocale strdup strerror])
134 # Default CFLAGS
135 CFLAGS="${CFLAGS} -std=c99 -Wall"
137 AC_CONFIG_FILES([Makefile src/Makefile po/Makefile.in client/Makefile
138                  test/Makefile test/online/Makefile libisds.pc])
140 #AC_CONFIG_SUBDIRS([src])
141 AC_OUTPUT