openssl.m4 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. dnl Check to find the OpenSSL headers/libraries
  2. AC_DEFUN(tinc_OPENSSL,
  3. [
  4. tinc_ac_save_CPPFLAGS="$CPPFLAGS"
  5. AC_ARG_WITH(openssl-include,
  6. [ --with-openssl-include=DIR OpenSSL headers directory (without trailing /openssl)],
  7. [openssl_include="$withval"
  8. CFLAGS="$CFLAGS -I$withval"
  9. CPPFLAGS="$CPPFLAGS -I$withval"]
  10. )
  11. AC_ARG_WITH(openssl-lib,
  12. [ --with-openssl-lib=DIR OpenSSL library directory],
  13. [openssl_lib="$withval"
  14. LIBS="$LIBS -L$withval"]
  15. )
  16. AC_CHECK_HEADERS(openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h,
  17. [],
  18. [AC_MSG_ERROR("OpenSSL header files not found."); break]
  19. )
  20. CPPFLAGS="$tinc_ac_save_CPPFLAGS"
  21. AC_CHECK_LIB(crypto, SHA1_version,
  22. [LIBS="$LIBS -lcrypto"],
  23. [AC_MSG_ERROR("OpenSSL libraries not found.")]
  24. )
  25. AC_CHECK_FUNCS(RAND_pseudo_bytes)
  26. AC_CHECK_FUNC(OpenSSL_add_all_algorithms,
  27. [],
  28. AC_CHECK_FUNC(SSLeay_add_all_algorithms,
  29. [AC_DEFINE(HAVE_SSLEAY_ADD_ALL_ALGORITHMS)],
  30. [AC_MSG_ERROR("Missing required OpenSSL functionality!")]
  31. )
  32. )
  33. AC_CHECK_FUNC(dlopen,
  34. [],
  35. AC_CHECK_LIB(dl, dlopen,
  36. [LIBS="$LIBS -ldl"],
  37. [AC_MSG_ERROR("OpenSSL depends on libdl.")]
  38. )
  39. )
  40. ])