1 AC_DEFUN([ACX_OPENSSL],[
3 AC_HELP_STRING([--with-openssl=PATH],[Specify prefix of path of OpenSSL]),
5 OPENSSL_INCLUDES="-I$withval/include"
6 OPENSSL_LIBDIRS="-L$withval/lib"
13 AC_MSG_CHECKING(what are the OpenSSL includes)
14 AC_MSG_RESULT($OPENSSL_INCLUDES)
16 AC_MSG_CHECKING(what are the OpenSSL libs)
17 OPENSSL_LIBS="$OPENSSL_LIBDIRS -lcrypto"
18 AC_MSG_RESULT($OPENSSL_LIBS)
20 tmp_CPPFLAGS=$CPPFLAGS
23 CPPFLAGS="$CPPFLAGS $OPENSSL_INCLUDES"
24 LIBS="$OPENSSL_LIBS $LIBS"
26 AC_CHECK_HEADERS([openssl/ssl.h],,[AC_MSG_ERROR([Can't find OpenSSL headers])])
27 AC_CHECK_LIB(crypto, BN_new,,[AC_MSG_ERROR([Can't find OpenSSL library])])
29 AC_MSG_CHECKING([for OpenSSL version])
30 CHECK_OPENSSL_VERSION=m4_format(0x%02x%02x%02x000L, $1, $2, $3)
32 AC_CACHE_VAL([acx_cv_lib_openssl_sufficient],[
33 acx_cv_lib_openssl_sufficient=no
36 #include <openssl/ssl.h>
37 #include <openssl/opensslv.h>
40 #ifndef OPENSSL_VERSION_NUMBER
41 #error "OpenSSL version undefined"
43 #if OPENSSL_VERSION_NUMBER >= $CHECK_OPENSSL_VERSION
46 #error "OpenSSL too old"
51 AC_MSG_RESULT([>= $1.$2.$3])
52 acx_cv_lib_openssl_sufficient=yes
54 AC_MSG_RESULT([< $1.$2.$3])
55 AC_MSG_ERROR([OpenSSL library too old ($1.$2.$3 or later required)])
60 CPPFLAGS=$tmp_CPPFLAGS
63 AC_SUBST(OPENSSL_INCLUDES)
64 AC_SUBST(OPENSSL_LIBS)