| 1 | dnl @synopsis AX_CHECK_SSL([ACTION-IF-TRUE], [ACTION-IF-FALSE]) |
|---|
| 2 | dnl |
|---|
| 3 | dnl This macro will check for OpenSSL in the standard path, allowing the user |
|---|
| 4 | dnl to specify a directory if it is not found. The user uses |
|---|
| 5 | dnl '--with-ssl-headers=/path/to/headers' or |
|---|
| 6 | dnl '--with-ssl-lib=/path/to/lib' as arguments to configure. |
|---|
| 7 | dnl |
|---|
| 8 | dnl If OpenSSL is found the include directory gets added to CPPFLAGS, |
|---|
| 9 | dnl '-lcrypto', '-lssl', and the libraries directory are added to LDFLAGS. |
|---|
| 10 | dnl Also HAVE_SSL is defined to 1, and ACTION-IF-TRUE and ACTION-IF-FALSE are |
|---|
| 11 | dnl run as appropriate |
|---|
| 12 | dnl |
|---|
| 13 | dnl @category InstalledPackages |
|---|
| 14 | dnl @author Martin Ebourne |
|---|
| 15 | dnl @version 2005/07/01 |
|---|
| 16 | dnl @license AllPermissive |
|---|
| 17 | |
|---|
| 18 | AC_DEFUN([AX_CHECK_SSL], [ |
|---|
| 19 | AC_ARG_WITH( |
|---|
| 20 | [ssl-headers], |
|---|
| 21 | [AC_HELP_STRING([--with-ssl-headers=DIR], [SSL include files location])], |
|---|
| 22 | [CPPFLAGS="$CPPFLAGS -I$withval"]) |
|---|
| 23 | AC_ARG_WITH( |
|---|
| 24 | [ssl-lib], |
|---|
| 25 | [AC_HELP_STRING([--with-ssl-lib=DIR], [SSL library location])], |
|---|
| 26 | [LDFLAGS="$LDFLAGS -L$withval"]) |
|---|
| 27 | |
|---|
| 28 | ax_check_ssl_found=yes |
|---|
| 29 | AC_CHECK_HEADERS([openssl/ssl.h],, [ax_check_ssl_found=no]) |
|---|
| 30 | AC_CHECK_LIB([crypto], [HMAC_CTX_init]) |
|---|
| 31 | AC_CHECK_LIB([ssl], [SSL_read],, [ax_check_ssl_found=no]) |
|---|
| 32 | |
|---|
| 33 | if test "x$ax_check_ssl_found" = "xyes"; then |
|---|
| 34 | AC_DEFINE([HAVE_SSL], 1, [Define to 1 if SSL is available]) |
|---|
| 35 | m4_ifvaln([$1],[$1],[:])dnl |
|---|
| 36 | m4_ifvaln([$2],[else $2])dnl |
|---|
| 37 | fi |
|---|
| 38 | ])dnl |
|---|