source: box/trunk/infrastructure/m4/ax_check_ssl.m4 @ 3094

Revision 3094, 1.3 KB checked in by chris, 4 weeks ago (diff)

Check for -lcrypto before -lssl, to ensure correct order in LIBS and successful link.

  • Property svn:eol-style set to native
Line 
1dnl @synopsis AX_CHECK_SSL([ACTION-IF-TRUE], [ACTION-IF-FALSE])
2dnl
3dnl This macro will check for OpenSSL in the standard path, allowing the user
4dnl to specify a directory if it is not found. The user uses
5dnl '--with-ssl-headers=/path/to/headers' or
6dnl '--with-ssl-lib=/path/to/lib' as arguments to configure.
7dnl
8dnl If OpenSSL is found the include directory gets added to CPPFLAGS,
9dnl '-lcrypto', '-lssl', and the libraries directory are added to LDFLAGS.
10dnl Also HAVE_SSL is defined to 1, and ACTION-IF-TRUE and ACTION-IF-FALSE are
11dnl run as appropriate
12dnl
13dnl @category InstalledPackages
14dnl @author Martin Ebourne
15dnl @version 2005/07/01
16dnl @license AllPermissive
17
18AC_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
Note: See TracBrowser for help on using the repository browser.