You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.2 KiB

  1. dnl Check to find the libsodium headers/libraries
  2. AC_DEFUN([ss_SODIUM],
  3. [
  4. AC_ARG_WITH(sodium,
  5. AS_HELP_STRING([--with-sodium=DIR], [The Sodium crypto library base directory, or:]),
  6. [sodium="$withval"
  7. CFLAGS="$CFLAGS -I$withval/include"
  8. LDFLAGS="$LDFLAGS -L$withval/lib"]
  9. )
  10. AC_ARG_WITH(sodium-include,
  11. AS_HELP_STRING([--with-sodium-include=DIR], [The Sodium crypto library headers directory (without trailing /sodium)]),
  12. [sodium_include="$withval"
  13. CFLAGS="$CFLAGS -I$withval"]
  14. )
  15. AC_ARG_WITH(sodium-lib,
  16. AS_HELP_STRING([--with-sodium-lib=DIR], [The Sodium crypto library library directory]),
  17. [sodium_lib="$withval"
  18. LDFLAGS="$LDFLAGS -L$withval"]
  19. )
  20. AC_CHECK_LIB(sodium, sodium_init,
  21. [LIBS="-lsodium $LIBS"],
  22. [AC_MSG_ERROR([The Sodium crypto library libraries not found.])]
  23. )
  24. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
  25. #include <sodium.h>
  26. ], [
  27. #if SODIUM_LIBRARY_VERSION_MAJOR < 7 || SODIUM_LIBRARY_VERSION_MAJOR ==7 && SODIUM_LIBRARY_VERSION_MINOR < 6
  28. # error
  29. #endif
  30. ])],
  31. [AC_MSG_RESULT([checking for version of libsodium... yes])],
  32. [AC_MSG_ERROR([Wrong libsodium: version >= 1.0.4 required])])
  33. ])