diff --git a/configure.ac b/configure.ac index dbab2cf0..fcd7aa09 100644 --- a/configure.ac +++ b/configure.ac @@ -162,6 +162,14 @@ fi AC_CHECK_HEADERS([linux/futex.h]) AM_CONDITIONAL([HAVE_LINUX_FUTEX], [test $ac_cv_header_linux_futex_h = yes]) +HITCH_CHECK_FUNC([SSL_get0_alpn_selected], [$SSL_LIBS], [ + AC_DEFINE([OPENSSL_WITH_ALPN], [1], [OpenSSL supports ALPN]) +]) + +HITCH_CHECK_FUNC([SSL_get0_next_proto_negotiated], [$SSL_LIBS], [ + AC_DEFINE([OPENSSL_WITH_NPN], [1], [OpenSSL supports NPN]) +]) + SH_TESTS="$(cd $srcdir/src && echo tests/test*.sh)" AC_SUBST(SH_TESTS) diff --git a/hitch.m4 b/hitch.m4 index f20d927f..927cd353 100644 --- a/hitch.m4 +++ b/hitch.m4 @@ -1,11 +1,20 @@ # HITCH_SEARCH_LIBS(VAR, LIBS, FUNC, NOTFOUND) # -------------------------------------------- AC_DEFUN([HITCH_SEARCH_LIBS], [ - hitch_save_LIBS="${LIBS}" + hitch_save_LIBS=$LIBS LIBS="" AC_SEARCH_LIBS([$3], [$2], [], [$4]) AC_SUBST([$1_LIBS], [$LIBS]) - LIBS="${hitch_save_LIBS}" + LIBS=$hitch_save_LIBS +]) + +# HITCH_CHECK_FUNC(FUNC, LIBS, FOUND, NOTFOUND) +# -------------------------------------------- +AC_DEFUN([HITCH_CHECK_FUNC], [ + hitch_save_LIBS=$LIBS + LIBS="$2" + AC_CHECK_FUNC([$1], [$3], [$4]) + LIBS=$hitch_save_LIBS ]) # _HITCH_CHECK_FLAG(VAR, FLAG) @@ -13,13 +22,13 @@ AC_DEFUN([HITCH_SEARCH_LIBS], [ AC_DEFUN([_HITCH_CHECK_FLAG], [ AC_MSG_CHECKING([whether the compiler accepts $2]) - _cflags="$CFLAGS" + hitch_save_CFLAGS=$CFLAGS CFLAGS="[$]$1 $2 $CFLAGS" AC_RUN_IFELSE( [AC_LANG_SOURCE([int main(void) { return (0); }])], [AC_MSG_RESULT([yes]); $1="[$]$1 $2"], [AC_MSG_RESULT([no])]) - CFLAGS="$_cflags" + CFLAGS=$hitch_save_CFLAGS ]) # HITCH_CHECK_FLAGS(VAR, FLAGS) diff --git a/src/configuration.h b/src/configuration.h index 352a63dc..af7bf269 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -13,16 +13,9 @@ #include "foreign/uthash.h" -/* Is NPN available? See openssl/opensslv.h for explanation. */ -#ifndef OPENSSL_NO_NEXTPROTONEG -# if OPENSSL_VERSION_NUMBER >= 0x1000100fL -# define OPENSSL_WITH_NPN -# endif -#endif - -/* Is ALPN available? See openssl/opensslv.h for explanation. */ -#if OPENSSL_VERSION_NUMBER >= 0x1000200fL -# define OPENSSL_WITH_ALPN +/* This macro disables NPN even in openssl/ssl.h */ +#ifdef OPENSSL_NO_NEXTPROTONEG +# undef OPENSSL_WITH_NPN #endif #ifdef OPENSSL_WITH_ALPN