sac-openssl.m4 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. dnl ======================================================================
  2. dnl SAC_OPENSSL
  3. dnl ======================================================================
  4. AC_DEFUN([SAC_OPENSSL], [
  5. AC_ARG_WITH(openssl,
  6. [ --with-openssl use OpenSSL [[enabled]]],, with_openssl=pkg-config)
  7. dnl SOSXXX:SAC_ASSERT_DEF([openssl libraries])
  8. if test "$with_openssl" = no ;then
  9. : # No openssl
  10. else
  11. if test "$with_openssl" = "pkg-config" ; then
  12. PKG_CHECK_MODULES(openssl, openssl,
  13. [HAVE_TLS=1 HAVE_OPENSSL=1 LIBS="$openssl_LIBS $LIBS"],
  14. [HAVE_OPENSSL=0])
  15. fi
  16. if test x$HAVE_OPENSSL = x1 ; then
  17. AC_DEFINE([HAVE_LIBCRYPTO], 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
  18. AC_DEFINE([HAVE_LIBSSL], 1, [Define to 1 if you have the `ssl' library (-lssl).])
  19. else
  20. AC_CHECK_HEADERS([openssl/tls1.h], [
  21. HAVE_OPENSSL=1 HAVE_TLS=1
  22. AC_CHECK_LIB(crypto, BIO_new,,
  23. HAVE_OPENSSL=0
  24. AC_MSG_WARN(OpenSSL crypto library was not found))
  25. AC_CHECK_LIB(ssl, TLSv1_method,,
  26. HAVE_TLS=0
  27. AC_MSG_WARN(OpenSSL protocol library was not found))
  28. ],[AC_MSG_WARN(OpenSSL include files were not found)],[#include <openssl/safestack.h>])
  29. fi
  30. if test x$HAVE_OPENSSL = x1; then
  31. AC_DEFINE([HAVE_OPENSSL], 1, [Define to 1 if you have OpenSSL])
  32. fi
  33. if test x$HAVE_TLS = x1; then
  34. AC_DEFINE([HAVE_TLS], 1, [Define to 1 if you have TLS])
  35. fi
  36. fi
  37. AM_CONDITIONAL(HAVE_TLS, test x$HAVE_TLS = x1)
  38. ])