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.

86 lines
3.0KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_lib_crypto.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_LIB_CRYPTO([yes|no|auto])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Searches for the 'crypto' library with the --with... option.
  12. #
  13. # If found, define HAVE_CRYPTO and macro CRYPTO_LIBS. Also defines
  14. # CRYPTO_WITH_<algo> for the algorithms found available. Possible
  15. # algorithms: AES BF CAMELLIA CAST DES IDEA RC2 RC5 MD2 MD4 MD5 SHA RIPEMD
  16. # RSA DSA DH
  17. #
  18. # The argument is used if no --with...-crypto 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 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_CRYPTO_LIB([algo-name],[function])
  34. AC_DEFUN([AX_CHECK_CRYPTO_LIB],[
  35. AC_CHECK_LIB([crypto], $2, [
  36. AC_DEFINE([CRYPTO_WITH_$1],[1],[Algorithm $1 in openssl crypto library])
  37. ])
  38. ])
  39. # AX_LIB_CRYPTO([yes|no|auto])
  40. AC_DEFUN([AX_LIB_CRYPTO],[
  41. AC_MSG_CHECKING([whether openssl crypto is enabled])
  42. AC_ARG_WITH([crypto],[ --with-crypto requite crypto library
  43. --without-crypto disable crypto library],[
  44. AC_MSG_RESULT([$withval])
  45. ac_with_crypto=$withval
  46. ],[
  47. AC_MSG_RESULT([$1])
  48. ac_with_crypto=$1
  49. ])
  50. if test "$ac_with_crypto" = "yes" -o "$ac_with_crypto" = "auto" ; then
  51. AC_CHECK_HEADERS([openssl/opensslconf.h],[
  52. AC_CHECK_LIB([crypto], [CRYPTO_lock],[
  53. AC_DEFINE([HAVE_CRYPTO],[1],[Openssl crypto library is available])
  54. HAVE_CRYPTO=1
  55. AC_SUBST([CRYPTO_LIBS],[-lcrypto])
  56. # ciphers
  57. AX_CHECK_CRYPTO_LIB([AES],[AES_ecb_encrypt])
  58. AX_CHECK_CRYPTO_LIB([BF],[BF_ecb_encrypt])
  59. AX_CHECK_CRYPTO_LIB([CAST],[CAST_ecb_encrypt])
  60. AX_CHECK_CRYPTO_LIB([CAMELLIA],[Camellia_ecb_encrypt])
  61. AX_CHECK_CRYPTO_LIB([DES],[DES_ecb_encrypt])
  62. AX_CHECK_CRYPTO_LIB([IDEA],[idea_ecb_encrypt])
  63. AX_CHECK_CRYPTO_LIB([RC2],[RC2_ecb_encrypt])
  64. AX_CHECK_CRYPTO_LIB([RC5],[RC5_32_ecb_encrypt])
  65. # digests
  66. AX_CHECK_CRYPTO_LIB([MD2],[MD2])
  67. AX_CHECK_CRYPTO_LIB([MD4],[MD4])
  68. AX_CHECK_CRYPTO_LIB([MD5],[MD5])
  69. AX_CHECK_CRYPTO_LIB([RIPEMD],[RIPEMD160])
  70. AX_CHECK_CRYPTO_LIB([SHA],[SHA1])
  71. # others
  72. AX_CHECK_CRYPTO_LIB([RSA],[RSA_set_method])
  73. AX_CHECK_CRYPTO_LIB([DSA],[DSA_set_method])
  74. AX_CHECK_CRYPTO_LIB([DH],[DH_set_method])
  75. ])
  76. ])
  77. # complain only if crypto as *explicitly* required
  78. if test "$ac_with_crypto" = "yes" -a "x$HAVE_CRYPTO" = "x" ; then
  79. AC_MSG_ERROR([cannot configure required openssl crypto library])
  80. fi
  81. fi
  82. ])