1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
|
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([libisds], [0.10.7], [petr.pisar@atlas.cz])
AM_INIT_AUTOMAKE
AC_LANG([C])
AC_CONFIG_SRCDIR([src/isds.c])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC
AC_PROG_CPP
#AC_PROG_MAKE_SET
LT_INIT
# For libtool < 1.9b (Debian lenny).
# AC_PROG_LIBTOOL has been obsoleted by LT_INIT
AC_PROG_LIBTOOL
# Enable example clients
AC_ARG_ENABLE(example, [AS_HELP_STRING([--enable-example],
[Build library usage examples])])
AM_CONDITIONAL([BUILD_EXAMPLE], [test "$enable_example" = "yes"])
# Enable tests
AC_ARG_ENABLE(test, [AS_HELP_STRING([--enable-test],
[Enable internal library tests])])
AM_CONDITIONAL([BUILD_TEST], [test "$enable_test" = "yes"])
# Enable on-line test
AC_ARG_ENABLE(online-test, [AS_HELP_STRING([--enable-online-test],
[Enable on-line internal library tests])])
# Enable gettext
AM_GNU_GETTEXT_VERSION([0.18.2])
AM_GNU_GETTEXT([external])
# Enable debug
AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],
[Compile in debugging mode])])
AS_IF([test "$enable_debug" = "yes"],
CFLAGS="${CFLAGS} -g"
dnl AC_SUBST(DEBUG_CFLAGS)
AC_DEFINE([ENABLE_DEBUG], [1],
[Define if you want include debugging code])
)
AC_CHECK_DECL([_WIN32])
AM_CONDITIONAL([WIN32], [test "$ac_cv_have_decl__WIN32" = "yes"])
# Checks for libraries.
#TODO: Verify minimal version. libxml2-2.6.26 is just a guess.
AM_PATH_XML2([2.6.26])
# Checks for CURL
LIBCURL_CHECK_CONFIG()
AS_IF([test -z "$LIBCURL"],
AC_MSG_WARN([libcurl disabled or not found. Network features will be
disabled.]),
[
cppflags_orig="$CPPFLAGS"
CPPFLAGS="${CPPFLAGS} ${LIBCURL_CPPFLAGS}"
AC_CHECK_DECLS([CURLOPT_TIMEOUT_MS], [],
AC_MSG_WARN([Your libcurl does not support subsecond timeout resolution.
Consider upgrade to 7.16.2 version.]),
[[#include <curl/curl.h>]])
AC_CHECK_DECLS([CURLOPT_USERNAME], [],
AC_MSG_WARN([Your libcurl does not support separate username and password.
Your ISDS username could not contain colon.
Consider upgrade to 7.19.1 version.]),
[[#include <curl/curl.h>]])
AC_CHECK_DECLS([CURLOPT_SSLCERTTYPE], [],
AC_MSG_WARN([Your libcurl does not support client certificate format
declaration (PEM vs. DER).
Consider upgrade to 7.9.3 version.]),
[[#include <curl/curl.h>]])
AC_CHECK_DECLS([CURLOPT_CRLFILE], [],
AC_MSG_WARN([Your libcurl does not support certificate revocation list
declaration.
Consider upgrade to 7.19.0 version.]),
[[#include <curl/curl.h>]])
AC_CHECK_DECLS([CURLINFO_REDIRECT_URL], [],
AC_MSG_ERROR([Your libcurl does not support getting redirected URL.
You must upgrade to 7.18.2 version.]),
[[#include <curl/curl.h>]])
AC_CHECK_DECLS([CURLOPT_KEYPASSWD], [], [], [[#include <curl/curl.h>]])
AC_CHECK_DECLS([CURLOPT_SSLKEYPASSWD], [], [], [[#include <curl/curl.h>]])
CPPFLAGS="$cppflags_orig"
])
AM_CONDITIONAL([BUILD_CURL], [test -n "$LIBCURL"])
dnl libcurl < 7.28.0 suffers from re-authorization bug, unfortunally there is
dnl no way how to re-check libcurl version. Thus we use explicit switch.
AC_ARG_ENABLE(curlreauthorizationbug,
[AS_HELP_STRING([--enable-curlreauthorizationbug],
[Compile in work-around for re-authorization bug in
curl < 7.28.0. Fixed by libcurl commit
ce8311c7e49eca93c136b58efa6763853541ec97.])])
AS_IF([test "$enable_curlreauthorizationbug" = "yes"],
AC_DEFINE([HAVE_CURL_REAUTHORIZATION_BUG], [1],
[Define if you want work-around re-authorization bug in libcurl])
)
dnl On-line tests requires libcurl
AM_CONDITIONAL([BUILD_ONLINE_TEST],
[test -n "$LIBCURL" -a "$enable_test" = "yes" \
-a "$enable_online_test" = "yes"])
dnl Simulated tests require gnutls
PKG_PROG_PKG_CONFIG()
AS_IF([test "$enable_test" = "yes"], [
PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.12.0])
AC_SUBST(LIBGNUTLS_CFLAGS)
AC_SUBST(LIBGNUTLS_LIBS)
])
AC_ARG_ENABLE([openssl-backend],
AS_HELP_STRING([--enable-openssl-backend], [Enable OpenSSL as cryptographic back-end.]))
AS_IF([test "x${enable_openssl_backend}" = "xyes"], [
dnl Use OpenSSL cryptographic back-end.
AC_DEFINE([USE_OPENSSL_BACKEND], [1], [Define if you want to use OpenSSL as cryptographic back-end.])
AC_SEARCH_LIBS([CMS_get0_content], [crypto], [], [AC_MSG_ERROR([OpenSSL librypto not found.])])
], [
dnl Use default cryptographic back-end.
#TODO: Determine minimal version
AM_PATH_LIBGCRYPT([1:1.4.0])
# GPGME is compiled with large file support by default. We need to follow not
# to break ABI.
AC_SYS_LARGEFILE
#TODO: Determine minimal version
AM_PATH_GPGME()
])
AM_CONDITIONAL([USE_OPENSSL_BACKEND], [test "x${enable_openssl_backend}" = "xyes"])
# Check for expat
AC_CHECK_LIB([expat], [XML_ExpatVersionInfo],
EXPAT_LIBS=-lexpat
AC_SUBST(EXPAT_LIBS))
# Verify minimal version. See src/phys.c: init_expat()
expat_min_major="2"
expat_min_minor="0"
expat_min_micro="0"
expat_min_version="${expat_min_major}.${expat_min_minor}.${expat_min_micro}"
AC_MSG_CHECKING([for expat library version >= ${expat_min_version}])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#define MIN_MAJOR ${expat_min_major}
#define MIN_MINOR ${expat_min_minor}
#define MIN_MICRO ${expat_min_micro}
#include <expat.h>]],
[[#if (XML_MAJOR_VERSION < MIN_MAJOR) || \
(XML_MAJOR_VERSION == MIN_MAJOR && XML_MINOR_VERSION < MIN_MINOR) || \
(XML_MAJOR_VERSION == MIN_MAJOR && XML_MINOR_VERSION == MIN_MINOR && \
XML_MICRO_VERSION < MIN_MICRO)
#error "Expat library is too old"
#endif]])],
AC_MSG_RESULT([yes]),
AC_MSG_FAILURE([Upgrade your expat to ${expat_min_version}])
)
# Do not consider compiler warnings as errors
# This harms libxml configure test
AC_ARG_ENABLE(fatalwarnings, [AS_HELP_STRING([--disable-fatalwarnings],
[Do not consider compiler warnings as errors])])
AS_IF([test "$enable_fatalwarnings" = "no"], , CFLAGS="${CFLAGS} -Werror")
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h locale.h stdint.h stdlib.h string.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
#AC_TYPE_SSIZE_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_MMAP
AC_CHECK_FUNCS([localtime_r memset munmap setlocale strdup strerror])
# Default CFLAGS
CFLAGS="${CFLAGS} -std=c99 -Wall"
dnl Check for strdup() feature test macros
dnl strdup() is provided since SUSv2, thus _XOPEN_SOURCE >= 500 has to be
dnl defined with -std=c99. However Mac OS X requires 600. Reported as
dnl <rdar://problem/19363342>.
AC_MSG_CHECKING([Checking for _XOPEN_SOURCE level needed for strdup()])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#define _XOPEN_SOURCE 500
#include <string.h>]], [[(void)strdup("");]])],
[xopen_source_level_for_strdup=500],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#define _XOPEN_SOURCE 600
#include <string.h>]], [[(void)strdup("");]])],
[xopen_source_level_for_strdup=600],
[AC_MSG_FAILURE([Cannot determine _XOPEN_SOURCE level for strdup()])]
)])
AC_MSG_RESULT([$xopen_source_level_for_strdup])
AC_DEFINE_UNQUOTED([XOPEN_SOURCE_LEVEL_FOR_STRDUP],
[$xopen_source_level_for_strdup],
[_XOPEN_SOURCE level needed for strdup()])
AC_CONFIG_FILES([Makefile src/Makefile po/Makefile.in client/Makefile
test/Makefile test/offline/Makefile test/simline/Makefile
test/online/Makefile libisds.pc])
#AC_CONFIG_SUBDIRS([src])
AC_OUTPUT
|