2
0

openssl.m4 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. dnl Check to find the OpenSSL headers/libraries
  2. AC_DEFUN([tinc_OPENSSL],
  3. [
  4. case $host_os in
  5. *mingw*)
  6. ;;
  7. *)
  8. AC_CHECK_FUNC(dlopen,
  9. [],
  10. [AC_CHECK_LIB(dl, dlopen,
  11. [LIBS="$LIBS -ldl"],
  12. [AC_MSG_ERROR([OpenSSL depends on libdl.]); break]
  13. )]
  14. )
  15. ;;
  16. esac
  17. AC_ARG_WITH(openssl,
  18. AS_HELP_STRING([--with-openssl=DIR], [OpenSSL base directory, or:]),
  19. [openssl="$withval"
  20. CPPFLAGS="$CPPFLAGS -I$withval/include"
  21. LDFLAGS="$LDFLAGS -L$withval/lib"]
  22. )
  23. AC_ARG_WITH(openssl-include,
  24. AS_HELP_STRING([--with-openssl-include=DIR], [OpenSSL headers directory (without trailing /openssl)]),
  25. [openssl_include="$withval"
  26. CPPFLAGS="$CPPFLAGS -I$withval"]
  27. )
  28. AC_ARG_WITH(openssl-lib,
  29. AS_HELP_STRING([--with-openssl-lib=DIR], [OpenSSL library directory]),
  30. [openssl_lib="$withval"
  31. LDFLAGS="$LDFLAGS -L$withval"]
  32. )
  33. AC_CHECK_HEADERS([openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h openssl/engine.h openssl/ecdh.h openssl/ec.h],
  34. [],
  35. [AC_MSG_ERROR([OpenSSL header files not found.]); break]
  36. )
  37. AC_CHECK_LIB(crypto, EVP_EncryptInit_ex,
  38. [LIBS="-lcrypto $LIBS"],
  39. [AC_MSG_ERROR([OpenSSL libraries not found.])]
  40. )
  41. AC_CHECK_FUNCS([RAND_pseudo_bytes EVP_EncryptInit_ex ECDH_compute_key ECDSA_verify], ,
  42. [AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break],
  43. )
  44. AC_CHECK_DECLS([OpenSSL_add_all_algorithms, EVP_CTRL_GCM_GET_TAG], ,
  45. [AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break],
  46. [#include <openssl/evp.h>]
  47. )
  48. ])