1dnl Check for OpenSSL 2AC_MSG_CHECKING([for OpenSSL installation]) 3 4AC_ARG_WITH([openssl], 5[AS_HELP_STRING([--with-openssl@<:@=DIR@:>@], [path to directory containing openssl 6 @<:@default=/usr/local or /usr if not found in /usr/local@:>@])], 7[ 8if test "$withval"; then 9 LIBSSL_HOME="$withval" 10fi 11], [ 12LIBSSL_HOME=/usr/local 13if test ! -f "$LIBSSL_HOME/include/openssl/ssl.h" 14then 15 LIBSSL_HOME=/usr 16fi 17AC_MSG_RESULT([$LIBSSL_HOME]) 18]) 19 20if test ! -f "$LIBSSL_HOME/include/openssl/ssl.h" 21then 22 AC_MSG_ERROR([OpenSSL not found.]) 23fi 24 25save_LDFLAGS="$LDFLAGS" 26save_CFLAGS="$CFLAGS" 27save_LIBS="$LIBS" 28 29SSL_LIBS="$LIBS -lssl -lcrypto -lz" 30LIBS="$LIBS $SSL_LIBS" 31 32if test "$LIBSSL_HOME" != "/usr"; then 33 SSL_LDFLAGS="-L$LIBSSL_HOME/lib" 34 SSL_CPPFLAGS="-I$LIBSSL_HOME/include" 35 LDFLAGS="-L$LIBSSL_HOME/lib" 36 CFLAGS="$SSL_CPPFLAGS" 37else 38 SSL_LDFLAGS="" 39 SSL_CPPFLAGS="" 40fi 41 42have_ssl="no" 43have_crypto="no" 44 45AC_LINK_IFELSE( 46 [AC_LANG_PROGRAM([[#include <openssl/bn.h>]], 47 [[BN_CTX_new();]])], 48 [have_ssl="yes";], 49 [AC_MSG_ERROR([Your OpenSSL installation is misconfigured or missing])]) 50 51 52AC_CHECK_LIB([crypto], [CRYPTO_free], [have_crypto="yes"], [AC_MSG_ERROR([Your OpenSSL installation is misconfigured or missing])], [-lcrypto -lz]) 53 54dnl OpenSSL 0.9.8 is the minimum required version due to X509_VERIFY_PARAM 55AC_CHECK_LIB([ssl], [X509_VERIFY_PARAM_new], [], [AC_MSG_ERROR([Your OpenSSL installation is missing the X509_VERIFY_PARAM function. Please upgrade to a more recent version of OpenSSL.])], [-lcrypto -lz]) 56 57LDFLAGS="$save_LDFLAGS" 58CFLAGS="$save_CFLAGS" 59LIBS="$save_LIBS" 60