Collection of DPF-based plugins for packaging
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.

81 lines
2.9KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_lib_nettle.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_LIB_NETTLE([yes|no|auto])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Searches for the 'nettle' library with the --with... option.
  12. #
  13. # If found, define HAVE_NETTLE and macro NETTLE_LIBS. Also defines
  14. # NETTLE_WITH_<algo> for the algorithms found available. Possible
  15. # algorithms: AES ARCTWO BLOWFISH CAST128 DES DES3 SERPENT TWOFISH MD2 MD4
  16. # MD5 SHA1 SHA256.
  17. #
  18. # The argument is used if no --with...-nettle option is set. Value "yes"
  19. # requires the configuration by default. Value "no" does not require it by
  20. # default. Value "auto" configures the library only if available.
  21. #
  22. # See also AX_LIB_BEECRYPT, AX_LIB_CRYPTO, and AX_LIB_GCRYPT.
  23. #
  24. # LICENSE
  25. #
  26. # Copyright (c) 2009 Fabien Coelho <autoconf.archive@coelho.net>
  27. #
  28. # Copying and distribution of this file, with or without modification, are
  29. # permitted in any medium without royalty provided the copyright notice
  30. # and this notice are preserved. This file is offered as-is, without any
  31. # warranty.
  32. #serial 10
  33. # AX_CHECK_NETTLE_ALGO([name],[function])
  34. AC_DEFUN([AX_CHECK_NETTLE_ALGO],[
  35. AC_CHECK_LIB([nettle], [nettle_$2],
  36. AC_DEFINE([NETTLE_WITH_$1],[1],[Algorithm $1 in nettle library]))
  37. ])
  38. # AX_LIB_NETTLE([yes|no|auto])
  39. AC_DEFUN([AX_LIB_NETTLE],[
  40. AC_MSG_CHECKING([whether nettle is enabled])
  41. AC_ARG_WITH([nettle],[ --with-nettle require nettle library
  42. --without-nettle disable nettle library],[
  43. AC_MSG_RESULT([$withval])
  44. ax_with_nettle=$withval
  45. ],[
  46. AC_MSG_RESULT([$1])
  47. ax_with_nettle=$1
  48. ])
  49. if test "$ax_with_nettle" = "yes" -o "$ax_with_nettle" = "auto" ; then
  50. AC_CHECK_HEADERS([nettle/nettle-meta.h],[
  51. AC_CHECK_LIB([nettle],[nettle_base64_encode_final],[
  52. AC_DEFINE([HAVE_NETTLE],[1],[Nettle library is available])
  53. HAVE_NETTLE=1
  54. AC_SUBST([NETTLE_LIBS],[-lnettle])
  55. # ciphers
  56. AX_CHECK_NETTLE_ALGO([AES],[aes_encrypt])
  57. AX_CHECK_NETTLE_ALGO([ARCTWO],[arctwo_encrypt])
  58. AX_CHECK_NETTLE_ALGO([BLOWFISH],[blowfish_encrypt])
  59. AX_CHECK_NETTLE_ALGO([CAST128],[cast128_encrypt])
  60. AX_CHECK_NETTLE_ALGO([DES],[des_encrypt])
  61. AX_CHECK_NETTLE_ALGO([DES3],[des3_encrypt])
  62. AX_CHECK_NETTLE_ALGO([SERPENT],[serpent_encrypt])
  63. AX_CHECK_NETTLE_ALGO([TWOFISH],[twofish_encrypt])
  64. # digests
  65. AX_CHECK_NETTLE_ALGO([MD2],[md2_digest])
  66. AX_CHECK_NETTLE_ALGO([MD4],[md4_digest])
  67. AX_CHECK_NETTLE_ALGO([MD5],[md5_digest])
  68. AX_CHECK_NETTLE_ALGO([SHA1],[sha1_digest])
  69. AX_CHECK_NETTLE_ALGO([SHA256],[sha256_digest])
  70. ])
  71. ])
  72. # complain only if explicitly required
  73. if test "$ax_with_nettle" = "yes" -a "x$HAVE_NETTLE" = "x" ; then
  74. AC_MSG_ERROR([cannot configure required nettle library])
  75. fi
  76. fi
  77. ])