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.

109 lines
3.7KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_lib_gcrypt.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_LIB_GCRYPT([yes|no|auto])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Searches for the 'gcrypt' library with the --with... option.
  12. #
  13. # If found, define HAVE_GCRYPT and macro GCRYPT_LIBS and GCRYPT_CFLAGS.
  14. # Also defines GCRYPT_WITH_<algo> for the algorithms found available.
  15. # Possible algorithms are: AES ARCFOUR BLOWFISH CAST5 DES IDEA RFC2268
  16. # SERPENT TWOFISH CRC HAVAL MD2 MD4 MD5 RMD160 SHA0 SHA1 SHA224 SHA256
  17. # SHA384 SHA512 TIGER WHIRLPOOL DSA ELGAMAL RSA
  18. #
  19. # The argument is used if no --with...-gcrypt option is set. Value "yes"
  20. # requires the configuration by default. Value "no" does not require it by
  21. # default. Value "auto" configures the library only if available.
  22. #
  23. # See also AX_LIB_BEECRYPT and AX_LIB_CRYPTO.
  24. #
  25. # LICENSE
  26. #
  27. # Copyright (c) 2009 Fabien Coelho <autoconf.archive@coelho.net>
  28. #
  29. # Copying and distribution of this file, with or without modification, are
  30. # permitted in any medium without royalty provided the copyright notice
  31. # and this notice are preserved. This file is offered as-is, without any
  32. # warranty.
  33. #serial 12
  34. # AX_CHECK_GCRYPT_ALGO([algo])
  35. # generate convenient defines for each algorithm
  36. AC_DEFUN([AX_CHECK_GCRYPT_ALGO],[
  37. AC_REQUIRE([AC_PROG_EGREP])
  38. AC_MSG_CHECKING([for $1 in gcrypt])
  39. if echo $gcrypt_algos | $EGREP -i ":.*( $1 | $1$)" > /dev/null ; then
  40. AC_DEFINE([GCRYPT_WITH_$1],[1],[Algorithm $1 in gcrypt library])
  41. AC_MSG_RESULT([yes])
  42. else
  43. AC_MSG_RESULT([no])
  44. fi
  45. ])
  46. # AX_LIB_GCRYPT([yes|no|auto])
  47. AC_DEFUN([AX_LIB_GCRYPT],[
  48. AC_MSG_CHECKING([whether gcrypt is enabled])
  49. AC_ARG_WITH([gcrypt],[ --with-gcrypt require gcrypt library
  50. --without-gcrypt disable gcrypt library],[
  51. AC_MSG_RESULT([$withval])
  52. ac_with_gcrypt=$withval
  53. ],[
  54. AC_MSG_RESULT($1)
  55. ac_with_gcrypt=$1
  56. ])
  57. if test "$ac_with_gcrypt" = "yes" -o "$ac_with_gcrypt" = "auto" ; then
  58. AM_PATH_LIBGCRYPT([1.2.0],[
  59. AC_DEFINE([HAVE_GCRYPT],[1],[Gcrypt library is available])
  60. HAVE_GCRYPT=1
  61. # checking for available algorithms...
  62. gcrypt_algos=`$LIBGCRYPT_CONFIG --algorithms`
  63. # ciphers
  64. # this does not work with a "for" loop: nothing generated in config.h:-(
  65. AX_CHECK_GCRYPT_ALGO([AES])
  66. AX_CHECK_GCRYPT_ALGO([ARCFOUR])
  67. AX_CHECK_GCRYPT_ALGO([BLOWFISH])
  68. AX_CHECK_GCRYPT_ALGO([CAST5])
  69. AX_CHECK_GCRYPT_ALGO([DES])
  70. AX_CHECK_GCRYPT_ALGO([IDEA])
  71. AX_CHECK_GCRYPT_ALGO([RFC2268])
  72. AX_CHECK_GCRYPT_ALGO([SERPENT])
  73. AX_CHECK_GCRYPT_ALGO([TWOFISH])
  74. # digests
  75. AX_CHECK_GCRYPT_ALGO([CRC])
  76. AX_CHECK_GCRYPT_ALGO([HAVAL])
  77. AX_CHECK_GCRYPT_ALGO([MD2])
  78. AX_CHECK_GCRYPT_ALGO([MD4])
  79. AX_CHECK_GCRYPT_ALGO([MD5])
  80. AX_CHECK_GCRYPT_ALGO([RMD160])
  81. AX_CHECK_GCRYPT_ALGO([SHA0])
  82. AX_CHECK_GCRYPT_ALGO([SHA1])
  83. AX_CHECK_GCRYPT_ALGO([SHA224])
  84. AX_CHECK_GCRYPT_ALGO([SHA256])
  85. AX_CHECK_GCRYPT_ALGO([SHA384])
  86. AX_CHECK_GCRYPT_ALGO([SHA512])
  87. AX_CHECK_GCRYPT_ALGO([TIGER])
  88. AX_CHECK_GCRYPT_ALGO([WHIRLPOOL])
  89. # others
  90. AX_CHECK_GCRYPT_ALGO([DSA])
  91. AX_CHECK_GCRYPT_ALGO([ELGAMAL])
  92. AX_CHECK_GCRYPT_ALGO([RSA])
  93. # conclusion
  94. GCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
  95. GCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
  96. AC_SUBST(GCRYPT_CFLAGS)
  97. AC_SUBST(GCRYPT_LIBS)
  98. ],[
  99. # complain only if explicitly required
  100. if test "$ac_with_gcrypt" = "yes" ; then
  101. AC_MSG_ERROR([cannot configure required gcrypt library])
  102. fi
  103. ])
  104. fi
  105. ])