lighttpd 1.4.x https://www.lighttpd.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1823 lines
48 KiB

dnl -*- Autoconf -*-
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Indentation rules:
dnl - closing braces not at the beginning of a line must match opening
dnl braces earlier on that line
dnl - closing braces at the beginning of a line:
dnl - must not be followed by anything else apart from "," or comments
dnl - must match opening braces from another line and indented the
dnl same as that other line
dnl - if one argument was put on a new line, all following arguments
dnl must be on their own line too
dnl - if an argument uses more than one line and is not a single
dnl function call, the argument should be on different lines than the
dnl wrapping braces
AC_PREREQ(2.60)
AC_INIT([lighttpd], [1.4.56], [https://redmine.lighttpd.net/projects/lighttpd/boards/2], [lighttpd], [https://www.lighttpd.net/])
AC_CONFIG_SRCDIR([src/server.c])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.13 -Wall -Wno-portability -Wno-override foreign dist-xz tar-ustar serial-tests silent-rules subdir-objects])
dnl @synopsis TRY_CFLAGS [compiler flags]
dnl @summary check whether compiler supports given flags and adds them to CFLAGS
AC_DEFUN([TRY_CFLAGS],
[dnl
AC_MSG_CHECKING([if $CC supports $1])
AC_LANG_PUSH([C])
ac_try_cflags_saved_cflags="${CFLAGS}"
CFLAGS="${CFLAGS} $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[
AC_MSG_ERROR([no])
CFLAGS="${ac_try_cflags_saved_cflags}"
]
)
AC_LANG_POP([C])
])
dnl @synopsis TRY_LDFLAGS [linker flags]
dnl @summary check whether linker supports given flags and adds them to LDFLAGS
AC_DEFUN([TRY_LDFLAGS],
[dnl
AC_MSG_CHECKING([if $LD supports $1])
AC_LANG_PUSH([C])
ac_try_ldflags_saved_ldflags="${LDFLAGS}"
LDFLAGS="${LDFLAGS} $1"
AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])],
[
AC_MSG_ERROR([no])
LDFLAGS="${ac_try_ldflags_saved_cflags}"
]
)
AC_LANG_POP([C])
])
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CC_STDC
AX_PROG_CC_FOR_BUILD
AC_PROG_LD
AC_PROG_INSTALL
AC_PROG_CPP
AC_PROG_MAKE_SET
AC_USE_SYSTEM_EXTENSIONS
AM_PROG_AR
dnl AC_CANONICAL_HOST
case "$host_os" in
*darwin*|*cygwin*|*aix*|*mingw*|*midipix* ) NO_RDYNAMIC=yes ;;
* ) NO_RDYNAMIC=no ;;
esac
AM_CONDITIONAL([NO_RDYNAMIC], [test "$NO_RDYNAMIC" = yes])
AM_CONDITIONAL([LIGHTTPD_STATIC], [test "$LIGHTTPD_STATIC" = yes])
AC_EXEEXT
dnl libtool
AC_DISABLE_STATIC
AC_ENABLE_SHARED
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
dnl for solaris
CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
dnl Checks for header files.
dnl check for:
dnl inttypes.h => HAVE_INTTYPES_H
dnl stdint.h => HAVE_STDINT_H
dnl and maybe more (which shouldn't be relied on)
AC_HEADER_STDC
dnl checks for sys/wait.h => HAVE_SYS_WAIT_H
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([\
getopt.h \
poll.h \
port.h \
pwd.h \
stdlib.h \
strings.h \
sys/devpoll.h \
sys/epoll.h \
sys/event.h \
sys/filio.h \
sys/inotify.h \
sys/loadavg.h \
sys/mman.h \
sys/poll.h \
sys/prctl.h \
sys/resource.h \
sys/select.h \
sys/sendfile.h \
sys/time.h \
sys/uio.h \
sys/un.h \
syslog.h \
uuid/uuid.h \
])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_MEMBER([struct tm.tm_gmtoff],
[AC_DEFINE([HAVE_STRUCT_TM_GMTOFF], [1], [gmtoff in struct tm])],
[],
[#include <time.h>]
)
AC_CHECK_TYPES([socklen_t],
[], dnl defines HAVE_SOCKLEN_T
[],
[
#include <sys/types.h>
#include <sys/socket.h>
]
)
dnl openssl on solaris needs -lsocket -lnsl
AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([gethostbyname], [nsl socket])
dnl On Haiku accept() and friends are in libnetwork
AC_SEARCH_LIBS([accept], [network])
dnl clock_gettime() needs -lrt with glibc < 2.17, and possibly other platforms
AC_SEARCH_LIBS([clock_gettime], [rt])
dnl FreeBSD elftc_copyfile()
save_LIBS=$LIBS
LIBS=
AC_SEARCH_LIBS([elftc_copyfile], [elftc], [
AC_CHECK_HEADERS([libelftc.h], [
ELFTC_LIB=$LIBS
AC_DEFINE([HAVE_LIBELFTC], [1], [libelftc])
AC_DEFINE([HAVE_ELFTC_COPYFILE], [1], [elftc_copyfile])
])
])
LIBS=$save_LIBS
AC_SUBST([ELFTC_LIB])
dnl need dlopen/-ldl to load plugins (when not on windows)
save_LIBS=$LIBS
LIBS=
AC_SEARCH_LIBS([dlopen], [dl], [
AC_CHECK_HEADERS([dlfcn.h], [
DL_LIB=$LIBS
AC_DEFINE([HAVE_LIBDL], [1], [libdl])
AC_DEFINE([HAVE_DLFCN_H], [1])
])
])
LIBS=$save_LIBS
AC_SUBST([DL_LIB])
dnl prepare pkg-config usage below
PKG_PROG_PKG_CONFIG
dnl checking for libev
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for libev support])
AC_ARG_WITH([libev],
[AC_HELP_STRING([--with-libev@<:@=PATH@:>@],
[Include libev support for fdevent handlers in PATH/include and PATH/lib]
)],
[WITH_LIBEV=$withval],
[WITH_LIBEV=no]
)
AC_MSG_RESULT([$WITH_LIBEV])
LIBEV_CFLAGS=
LIBEV_LIBS=
if test "$WITH_LIBEV" != no; then
PKG_CHECK_MODULES([LIBEV], [libev], [], [
dnl no pkg-config for libev, searching manually:
if test "$WITH_LIBEV" != yes; then
LIBEV_CFLAGS="-I$WITH_LIBEV/include"
LIBEV_LIBS="-L$WITH_LIBEV/lib -lev"
else
AC_CHECK_HEADERS([ev.h],
[AC_CHECK_LIB([ev], [ev_time],
[
LIBEV_CFLAGS=
LIBEV_LIBS="-lev"
],
[AC_MSG_ERROR([libev not found])]
)],
[AC_MSG_ERROR([libev header not found])]
)
fi
])
AC_DEFINE([HAVE_LIBEV], [1], [libev support])
fi
AC_SUBST([LIBEV_CFLAGS])
AC_SUBST([LIBEV_LIBS])
dnl Checks for mysql
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for MySQL support])
AC_ARG_WITH([mysql],
[AC_HELP_STRING([--with-mysql@<:@=PATH@:>@],
[Include MySQL support. PATH is the path to 'mysql_config']
)],
[WITH_MYSQL=$withval],
[WITH_MYSQL=no]
)
AC_MSG_RESULT([$WITH_MYSQL])
MYSQL_CFLAGS=
MYSQL_LIBS=
if test "$WITH_MYSQL" != no; then
if test "$WITH_MYSQL" = yes; then
PKG_CHECK_MODULES([MYSQL],[mariadb],[
MYSQL_CONFIG=$PKG_CONFIG
],[
PKG_CHECK_MODULES([MYSQL],[mysqlclient],[
MYSQL_CONFIG=$PKG_CONFIG
],[
AC_PATH_PROG([MYSQL_CONFIG], [mysql_config])
])
])
else
MYSQL_CONFIG=$WITH_MYSQL
fi
if test "$MYSQL_CONFIG" != "$PKG_CONFIG"; then
if test -z "$MYSQL_CONFIG"; then
AC_MSG_ERROR([mysql_config is not found])
fi
if test ! -x "$MYSQL_CONFIG"; then
AC_MSG_ERROR([mysql_config not exists or not executable, use --with-mysql=path-to-mysql_config])
fi
if "$MYSQL_CONFIG" | grep -- '--include' > /dev/null ; then
MYSQL_CFLAGS=`"$MYSQL_CONFIG" --include | sed s/\'//g`
else
MYSQL_CFLAGS=`"$MYSQL_CONFIG" --cflags | sed s/\'//g`
fi
MYSQL_LIBS=`"$MYSQL_CONFIG" --libs | sed s/\'//g`
fi
AC_MSG_CHECKING([for MySQL includes at])
AC_MSG_RESULT([$MYSQL_CFLAGS])
AC_MSG_CHECKING([for MySQL libraries at])
AC_MSG_RESULT([$MYSQL_LIBS])
AC_DEFINE([HAVE_MYSQL], [1], [mysql support])
fi
AM_CONDITIONAL([BUILD_WITH_MYSQL], [test "$WITH_MYSQL" != no])
AC_SUBST([MYSQL_LIBS])
AC_SUBST([MYSQL_CFLAGS])
dnl Checks for pgsql
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for PgSQL support])
AC_ARG_WITH([pgsql],
[AC_HELP_STRING([--with-pgsql@<:@=PATH@:>@],
[Include PgSQL support. PATH is the path to 'pg_config']
)],
[WITH_PGSQL=$withval],
[WITH_PGSQL=no]
)
AC_MSG_RESULT([$WITH_PGSQL])
PGSQL_CFLAGS=
PGSQL_LIBS=
if test "$WITH_PGSQL" != no; then
if test "$WITH_PGSQL" = yes; then
PKG_CHECK_MODULES([PGSQL],[libpq],[
PGSQL_CONFIG=$PKG_CONFIG
],[
AC_PATH_PROG([PGSQL_CONFIG], [pg_config])
])
else
PGSQL_CONFIG=$WITH_PGSQL
fi
if test "$PGSQL_CONFIG" != "$PKG_CONFIG"; then
if test -z "$PGSQL_CONFIG"; then
AC_MSG_ERROR([pg_config is not found])
fi
if test ! -x "$PGSQL_CONFIG"; then
AC_MSG_ERROR([pg_config not exists or not executable, use --with-pgsql=path-to-pg_config])
fi
PGSQL_CFLAGS="-I`"$PGSQL_CONFIG" --includedir`"
PGSQL_LIBS="-L`"$PGSQL_CONFIG" --libdir` -lpq"
fi
AC_MSG_CHECKING([for PgSQL includes at])
AC_MSG_RESULT([$PGSQL_CFLAGS])
AC_MSG_CHECKING([for PgSQL libraries at])
AC_MSG_RESULT([$PGSQL_LIBS])
AC_DEFINE([HAVE_PGSQL], [1], [pgsql support])
fi
AM_CONDITIONAL([BUILD_WITH_PGSQL], [test "$WITH_PGSQL" != no])
AC_SUBST([PGSQL_LIBS])
AC_SUBST([PGSQL_CFLAGS])
dnl Checks for libdbi library
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for LibDBI support])
AC_ARG_WITH([dbi],
[AC_HELP_STRING([--with-dbi@<:@=PATH@:>@],
[Include DBI support in PATH/include/dbi.h and PATH/lib]
)],
[WITH_DBI=$withval],
[WITH_DBI=no]
)
AC_MSG_RESULT([$WITH_DBI])
DBI_INCLUDE=
DBI_LIBS=
if test "$WITH_DBI" != no; then
if test "$WITH_DBI" != yes; then
DBI_CFLAGS="-I$WITH_DBI/include"
DBI_LIBS="-L$WITH_DBI/lib -ldbi"
else
AC_CHECK_HEADERS([dbi/dbi.h],
[AC_CHECK_LIB([dbi], [dbi_version],
[
DBI_CFLAGS=
DBI_LIBS="-ldbi"
],
[AC_MSG_ERROR([LibDBI not found])]
)],
[AC_MSG_ERROR([LibDBI header not found])]
)
fi
AC_DEFINE([HAVE_DBI], [1], [LibDBI support])
fi
AM_CONDITIONAL([BUILD_WITH_DBI], [test "$WITH_DBI" != no])
AC_SUBST([DBI_LIBS])
AC_SUBST([DBI_CFLAGS])
dnl Checks for libsasl2 library
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for LibSASL support])
AC_ARG_WITH([sasl],
[AC_HELP_STRING([--with-sasl@<:@=PATH@:>@],
[Include SASL support in PATH/include/sasl/sasl.h and PATH/lib]
)],
[WITH_SASL=$withval],
[WITH_SASL=no]
)
AC_MSG_RESULT([$WITH_SASL])
SASL_INCLUDE=
SASL_LIBS=
if test "$WITH_SASL" != no; then
if test "$WITH_SASL" != yes; then
SASL_CFLAGS="-I$WITH_SASL/include"
SASL_LIBS="-L$WITH_SASL/lib -lsasl2"
else
AC_CHECK_HEADERS([sasl/sasl.h],
[AC_CHECK_LIB([sasl2], [sasl_server_init],
[
SASL_CFLAGS=
SASL_LIBS="-lsasl2"
],
[AC_MSG_ERROR([libsasl2 not found])]
)],
[AC_MSG_ERROR([SASL header not found])]
)
fi
AC_DEFINE([HAVE_SASL], [1], [LibSASL support])
fi
AM_CONDITIONAL([BUILD_WITH_SASL], [test "$WITH_SASL" != no])
AC_SUBST([SASL_LIBS])
AC_SUBST([SASL_CFLAGS])
dnl Check for LDAP
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for LDAP support])
AC_ARG_WITH([ldap],
[AC_HELP_STRING([--with-ldap], [enable LDAP support])],
[WITH_LDAP=$withval],
[WITH_LDAP=no]
)
AC_MSG_RESULT([$WITH_LDAP])
if test "$WITH_LDAP" != no; then
AC_CHECK_LIB([ldap], [ldap_sasl_bind_s],
[AC_CHECK_HEADERS([ldap.h],
[
LDAP_LIB=-lldap
AC_DEFINE([HAVE_LIBLDAP], [1], [libldap])
AC_DEFINE([HAVE_LDAP_H], [1])
],
[AC_MSG_ERROR([ldap headers not found, install them or build without --with-ldap])]
)],
[AC_MSG_ERROR([ldap library not found, install it or build without --with-ldap])]
)
AC_SUBST([LDAP_LIB])
AC_CHECK_LIB([lber], [ber_printf],
[AC_CHECK_HEADERS([lber.h],
[
LBER_LIB=-llber
AC_DEFINE([HAVE_LIBLBER], [1], [liblber])
AC_DEFINE([HAVE_LBER_H], [1])
],
[AC_MSG_ERROR([lber headers not found, install them or build without --with-ldap])]
)],
[AC_MSG_ERROR([lber library not found, install it or build without --with-ldap])]
)
AC_SUBST([LBER_LIB])
fi
AM_CONDITIONAL([BUILD_WITH_LDAP], [test "$WITH_LDAP" != no])
dnl Check for PAM
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING(for PAM support)
AC_ARG_WITH([pam],
[AC_HELP_STRING([--with-pam],[enable PAM support])],
[WITH_PAM=$withval],
[WITH_PAM=no]
)
AC_MSG_RESULT([$withval])
if test "$WITH_PAM" != "no"; then
AC_CHECK_LIB([pam], [pam_start],
[AC_CHECK_HEADERS([security/pam_appl.h],[
PAM_LIB=-lpam
AC_DEFINE([HAVE_PAM], [1], [libpam])
AC_DEFINE([HAVE_SECURITY_PAM_APPL_H], [1])
],
[AC_MSG_ERROR([pam headers not found, install them or build without --with-pam])]
)],
[AC_MSG_ERROR([pam library not found, install it or build without --with-pam])]
)
AC_SUBST(PAM_LIB)
fi
AM_CONDITIONAL([BUILD_WITH_PAM], [test "$WITH_PAM" != no])
dnl Check for xattr
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for extended attributes support])
AC_ARG_WITH([attr],
[AC_HELP_STRING([--with-attr], [enable extended attribute support])],
[WITH_ATTR=$withval],
[WITH_ATTR=no]
)
AC_MSG_RESULT([$WITH_ATTR])
if test "$WITH_ATTR" != no; then
have_xattr=no
# libattr (linux only?)
AC_CHECK_LIB([attr], [attr_get], [
AC_CHECK_HEADERS([attr/attributes.h], [
ATTR_LIB=-lattr
AC_DEFINE([HAVE_XATTR], [1], [libattr])
AC_DEFINE([HAVE_ATTR_ATTRIBUTES_H], [1])
have_xattr=yes
])
])
AC_SUBST([ATTR_LIB])
# Linux getxattr
AC_CHECK_FUNC([getxattr], [
AC_CHECK_HEADERS([sys/xattr.h], [
AC_DEFINE([HAVE_XATTR], [1], [Linux extended attributes])
AC_DEFINE([HAVE_SYS_XATTR_H], [1])
have_xattr=yes
])
])
# (Free)BSD extattr
AC_CHECK_FUNC([extattr_get_file], [
AC_CHECK_HEADERS([sys/extattr.h], [
AC_DEFINE([HAVE_EXTATTR], [1], [BSD extended attributes])
AC_DEFINE([HAVE_SYS_EXTATTR_H], [1])
have_xattr=yes
])
])
if test "$have_xattr" = no; then
AC_MSG_ERROR([no backend found implementing extended attributes])
fi
fi
dnl Check for valgrind
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for valgrind])
AC_ARG_WITH([valgrind],
[AC_HELP_STRING([--with-valgrind],
[enable internal support for valgrind]
)],
[WITH_VALGRIND=$withval],
[WITH_VALGRIND=no]
)
AC_MSG_RESULT([$WITH_VALGRIND])
if test "$WITH_VALGRIND" != no; then
AC_CHECK_HEADERS([valgrind/valgrind.h], [], [
AC_MSG_ERROR([valgrind headers not found. install them or build without --with-valgrind])
])
fi
dnl Checking for libunwind
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for libunwind])
AC_ARG_WITH([libunwind],
[AC_HELP_STRING([--with-libunwind],
[Include libunwind support for backtraces on assert failures]
)],
[WITH_LIBUNWIND=$withval],
[WITH_LIBUNWIND=no]
)
AC_MSG_RESULT([$WITH_LIBUNWIND])
if test "$WITH_LIBUNWIND" != no; then
PKG_CHECK_MODULES([LIBUNWIND], [libunwind], [], [
AC_MSG_ERROR([libunwind not found. install it or build without --with-libunwind])
])
AC_DEFINE([HAVE_LIBUNWIND], [1], [Have libunwind support])
fi
dnl Checking for kerberos5
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for kerberos5])
AC_ARG_WITH([krb5],
[AC_HELP_STRING([--with-krb5@<:@=DIR@:>@], [Use Kerberos 5])],
[WITH_KRB5=$withval],
[WITH_KRB5=no]
)
AC_MSG_RESULT([$WITH_KRB5])
if test "$WITH_KRB5" != no; then
if test "$WITH_KRB5" != yes; then
krb5_append_CPPFLAGS=" -I$WITH_KRB5/include"
krb5_append_LDFLAGS=" -L$WITH_KRB5/lib"
fi
fi
AC_MSG_CHECKING([custom include directory for kerberos5])
AC_ARG_WITH([krb5-includes],
[AC_HELP_STRING([--with-krb5-includes=DIR], [Kerberos includes])],
[
if test "$WITH_KRB5" = no; then
AC_MSG_ERROR([build --with-krb5 to use --with-krb5-includes])
fi
krb5_append_CPPFLAGS=" -I$withval"
AC_MSG_RESULT([$withval])
],
[AC_MSG_RESULT([no])]
)
AC_MSG_CHECKING([custom lib directory for kerberos5])
AC_ARG_WITH([krb5-libs],
[AC_HELP_STRING([--with-krb5-libs=DIR], [Kerberos libraries])],
[
if test "$WITH_KRB5" = no; then
AC_MSG_ERROR([build --with-krb5 to use --with-krb5-libs])
fi
krb5_append_LDFLAGS=" -L$withval"
AC_MSG_RESULT([$withval])
],
[AC_MSG_RESULT([no])]
)
if test "$WITH_KRB5" != no; then
CPPFLAGS="${CPPFLAGS}${krb5_append_CPPFLAGS}"
LDFLAGS="${LDFLAGS}${krb5_append_LDFLAGS}"
AC_CHECK_LIB([gssapi_krb5], [gss_acquire_cred],
[AC_CHECK_HEADERS([gssapi/gssapi_krb5.h],
[
KRB5_LIB="-lkrb5 -lgssapi_krb5"
AC_DEFINE([HAVE_KRB5], [1], [libgssapi_krb5])
],
[AC_MSG_ERROR([gssapi_krb5 headers were not found, install them or build without --with-krb5])]
)],
[AC_MSG_ERROR([gssapi_krb5 libs were not found, install them or build without --with-krb5])]
)
case "$host_os" in
*darwin*|*cygwin* ) KRB5_LIB="$KRB5_LIB -lcom_err" ;;
* ) ;;
esac
fi
AM_CONDITIONAL([BUILD_WITH_KRB5], [test "$WITH_KRB5" != no])
AC_SUBST([KRB5_LIB])
dnl Check for openssl
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for OpenSSL])
AC_ARG_WITH([openssl],
[AC_HELP_STRING([--with-openssl@<:@=DIR@:>@],
[Include openssl support (default no)]
)],
[WITH_OPENSSL=$withval],
[WITH_OPENSSL=no]
)
AC_MSG_RESULT([$WITH_OPENSSL])
AM_CONDITIONAL([BUILD_WITH_OPENSSL], test ! "$WITH_OPENSSL" = no)
if test "$WITH_OPENSSL" != no; then
if test "$WITH_OPENSSL" != yes; then
openssl_append_CPPFLAGS=" -I$WITH_OPENSSL/include"
openssl_append_LDFLAGS=" -L$WITH_OPENSSL/lib"
fi
fi
AC_MSG_CHECKING([custom include directory for openssl])
AC_ARG_WITH([openssl-includes],
[AC_HELP_STRING([--with-openssl-includes=DIR], [OpenSSL includes])],
[
if test "$WITH_OPENSSL" = no; then
AC_MSG_ERROR([build --with-openssl to use --with-openssl-includes])
fi
openssl_append_CPPFLAGS=" -I$withval"
AC_MSG_RESULT([$withval])
],
[AC_MSG_RESULT([no])]
)
AC_MSG_CHECKING([custom lib directory for openssl])
AC_ARG_WITH([openssl-libs],
[AC_HELP_STRING([--with-openssl-libs=DIR], [OpenSSL libraries])],
[
if test "$WITH_OPENSSL" = no; then
AC_MSG_ERROR([build --with-openssl to use --with-openssl-libs])
fi
openssl_append_LDFLAGS=" -L$withval"
AC_MSG_RESULT([$withval])
],
[AC_MSG_RESULT([no])]
)
if test "$WITH_OPENSSL" != no; then
if test "$WITH_KRB5" != no; then
AC_DEFINE([USE_OPENSSL_KERBEROS], [1], [with kerberos])
fi
CPPFLAGS="${CPPFLAGS}${openssl_append_CPPFLAGS}"
LDFLAGS="${LDFLAGS}${openssl_append_LDFLAGS}"
AC_CHECK_HEADERS([openssl/ssl.h], [], [
AC_MSG_ERROR([openssl headers not found. install them or build without --with-openssl])
])
AC_CHECK_LIB([crypto], [BIO_f_base64],
[CRYPTO_LIB="-lcrypto"],
[AC_MSG_ERROR([openssl crypto library not found. install it or build without --with-openssl])]
)
AC_CHECK_LIB([ssl], [SSL_new],
[OPENSSL_LIBS="${openssl_append_LDFLAGS} -lssl -lcrypto"],
[AC_MSG_ERROR([openssl ssl library not found. install it or build without --with-openssl])],
[ -lcrypto "$DL_LIB" ]
)
AC_DEFINE([HAVE_LIBSSL], [1], [Have libssl])
OPENSSL_CFLAGS="${openssl_append_CPPFLAGS}"
AC_SUBST([OPENSSL_CFLAGS])
AC_SUBST([OPENSSL_LIBS])
AC_SUBST([CRYPTO_LIB])
fi
dnl Check for wolfSSL
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for wolfSSL])
AC_ARG_WITH([wolfssl],
[AC_HELP_STRING([--with-wolfssl@<:@=DIR@:>@],
[Include wolfSSL support (default no)]
)],
[WITH_WOLFSSL=$withval],
[WITH_WOLFSSL=no]
)
AC_MSG_RESULT([$WITH_WOLFSSL])
AM_CONDITIONAL([BUILD_WITH_WOLFSSL], test ! "$WITH_WOLFSSL" = no)
if test "$WITH_WOLFSSL" != no; then
CPPFLAGS_SAVE="${CPPFLAGS}"
LDFLAGS_SAVE="${LDFLAGS}"
if test "$WITH_WOLFSSL" != yes; then
WOLFSSL_CFLAGS="-I$WITH_WOLFSSL/include -I$WITH_WOLFSSL/include/wolfssl"
WOLFSSL_LIBS="-L$WITH_WOLFSSL/lib -lwolfssl"
LDFLAGS="${LDFLAGS} -L$WITH_WOLFSSL/lib"
else
PKG_CHECK_MODULES([WOLFSSL], [wolfssl], [], [
AC_MSG_ERROR([wolfssl not found, install it or build without --with-wolfssl])
])
if test "$WOLFSSL_LIBS" != "-lwolfssl"; then
LDFLAGS="${LDFLAGS} ${WOLFSSL_LIBS% -lwolfssl}"
fi
fi
CPPFLAGS="${CPPFLAGS} $WOLFSSL_CFLAGS"
AC_CHECK_HEADERS([wolfssl/ssl.h], [], [
AC_MSG_ERROR([wolfssl headers not found. install them or build without --with-wolfssl])
])
AC_CHECK_LIB([wolfssl], [wolfSSL_Init],
[WOLFSSL_CRYPTO_LIB="-lwolfssl"],
[AC_MSG_ERROR([wolfssl crypto library not found. install it or build without --with-wolfssl])]
)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <wolfssl/options.h>
#if !defined(HAVE_LIGHTY) && !defined(OPENSSL_EXTRA)
#error HAVE_LIGHTY macro not defined
#endif
]])], [], [AC_MSG_ERROR([wolfssl must be built with ./configure --enable-lighty])])
AC_SUBST([WOLFSSL_CFLAGS])
AC_SUBST([WOLFSSL_LIBS])
if test "$WITH_OPENSSL" = no; then
CRYPTO_LIB="$WOLFSSL_CRYPTO_LIB"
AC_SUBST([CRYPTO_LIB])
else
CPPFLAGS="${CPPFLAGS_SAVE}"
LDFLAGS="${LDFLAGS_SAVE}"
fi
fi
dnl Check for mbedTLS
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for mbedTLS])
AC_ARG_WITH([mbedtls],
AC_HELP_STRING([--with-mbedtls@<:@=DIR@:>@],[Include mbedTLS support. DIR points to the installation root. (default no)]),
[WITH_MBEDTLS=$withval],
[WITH_MBEDTLS=no]
)
if test "$WITH_MBEDTLS" != "no"; then
use_mbedtls=yes
if test "$WITH_MBEDTLS" != "yes"; then
CPPFLAGS="$CPPFLAGS -I$WITH_MBEDTLS/include"
LDFLAGS="$LDFLAGS -L$WITH_MBEDTLS/lib"
fi
else
use_mbedtls=no
fi
AC_MSG_RESULT([$use_mbedtls])
AM_CONDITIONAL(BUILD_WITH_MBEDTLS, test ! $WITH_MBEDTLS = no)
if test "x$use_mbedtls" = "xyes"; then
AC_CHECK_HEADERS([mbedtls/ssl.h])
OLDLIBS="$LIBS"
AC_CHECK_LIB(mbedcrypto,mbedtls_base64_encode,
[AC_CHECK_LIB(mbedx509, mbedtls_x509_get_name,
[AC_CHECK_LIB(mbedtls, mbedtls_cipher_info_from_type,
[MTLS_LIBS="-lmbedtls -lmbedx509 -lmbedcrypto"
CRYPTO_LIB="-lmbedcrypto"
AC_DEFINE(HAVE_LIBMBEDTLS, [1], [Have libmbedtls library])
AC_DEFINE(HAVE_LIBMBEDX509, [1], [Have libmbedx509 library])
AC_DEFINE(HAVE_LIBMBEDCRYPTO, [1], [Have libmbedcrypto library]) ],
[],[-lmbedcrypto "$DL_LIB"])
],[],[-lmbedcrypto "$DL_LIB"])
],[],[])
LIBS="$OLDLIBS"
AC_SUBST(MTLS_LIBS)
AC_SUBST(CRYPTO_LIB)
fi
dnl Check for Nettle (and overwrite CRYPTO_LIB if set by OpenSSL or wolfSSL)
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for Nettle])
AC_ARG_WITH([nettle],
[AC_HELP_STRING([--with-nettle@<:@=DIR@:>@],
[Include Nettle support (default no)]
)],
[WITH_NETTLE=$withval],
[WITH_NETTLE=no]
)
AC_MSG_RESULT([$WITH_NETTLE])
if test "$WITH_NETTLE" != no; then
if test "$WITH_NETTLE" != yes; then
CPPFLAGS="${CPPFLAGS} -I$WITH_NETTLE/include"
LDFLAGS="${LDFLAGS} -L$WITH_NETTLE/lib"
fi
AC_CHECK_HEADERS([nettle/nettle-types.h], [], [
AC_MSG_ERROR([nettle headers not found. install them or build without --with-nettle])
])
AC_CHECK_LIB([nettle], [nettle_md5_init],
[CRYPTO_LIB="-lnettle"],
[AC_MSG_ERROR([nettle crypto library not found. install it or build without --with-nettle])]
)
AC_SUBST([CRYPTO_LIB])
fi
dnl Check for GnuTLS
AC_MSG_NOTICE([----------------------------------------])
AC_MSG_CHECKING([for GnuTLS])
AC_ARG_WITH([gnutls],
AC_HELP_STRING([--with-gnutls@<:@=DIR@:>@],[Include GnuTLS support. DIR points to the installation root. (default no)]),
[WITH_GNUTLS=$withval],
[WITH_GNUTLS=no]
)
if test "$WITH_GNUTLS" != "no"; then
use_gnutls=yes
else
use_gnutls=no
fi
AC_MSG_RESULT([$use_gnutls])
AM_CONDITIONAL(BUILD_WITH_GNUTLS, test ! $WITH_GNUTLS = no)
GNUTLS_CFLAGS=
GNUTLS_LIBS=
if test "x$use_gnutls" = "xyes"; then
if test "$WITH_GNUTLS" != "yes"; then
GNUTLS_CFLAGS="-I$WITH_GNUTLS/include"
GNUTLS_LIBS="-L$WITH_GNUTLS/lib -lgnutls"
else
dnl oldest GnuTLS supported release is 3.3.x at time this is being written
PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3.0])
fi
AC_SUBST([GNUTLS_CFLAGS])
AC_SUBST([GNUTLS_LIBS])
AC_DEFINE([HAVE_GNUTLS_CRYPTO_H], [1], [gnutls/crypto.h])
if test "$WITH_OPENSSL" = no && test "$WITH_WOLFSSL" = no && \
test "$WITH_MBEDTLS" = no && test "$WITH_NETTLE" = no; then
AC_SUBST([CRYPTO_LIB],[$GNUTLS_LIBS])