0010-configure-Add-pkg-config-handling-for-libgcrypt.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. From c207607cdf3996ad9783c3bffbcd3d65e74c0158 Mon Sep 17 00:00:00 2001
  2. From: He Zhe <zhe.he@windriver.com>
  3. Date: Wed, 28 Aug 2019 19:56:28 +0800
  4. Subject: [PATCH] configure: Add pkg-config handling for libgcrypt
  5. libgcrypt may also be controlled by pkg-config, this patch adds pkg-config
  6. handling for libgcrypt.
  7. Upstream-Status: Denied [https://lists.nongnu.org/archive/html/qemu-devel/2019-08/msg06333.html]
  8. Signed-off-by: He Zhe <zhe.he@windriver.com>
  9. ---
  10. configure | 48 ++++++++++++++++++++++++++++++++++++++++--------
  11. 1 file changed, 40 insertions(+), 8 deletions(-)
  12. Index: qemu-6.0.0/configure
  13. ===================================================================
  14. --- qemu-6.0.0.orig/configure
  15. +++ qemu-6.0.0/configure
  16. @@ -2847,6 +2847,30 @@ has_libgcrypt() {
  17. return 0
  18. }
  19. +has_libgcrypt_pkgconfig() {
  20. + if ! has $pkg_config ; then
  21. + return 1
  22. + fi
  23. +
  24. + if ! $pkg_config --list-all | grep libgcrypt > /dev/null 2>&1 ; then
  25. + return 1
  26. + fi
  27. +
  28. + if test -n "$cross_prefix" ; then
  29. + host=$($pkg_config --variable=host libgcrypt)
  30. + if test "${host%-gnu}-" != "${cross_prefix%-gnu}" ; then
  31. + print_error "host($host) does not match cross_prefix($cross_prefix)"
  32. + return 1
  33. + fi
  34. + fi
  35. +
  36. + if ! $pkg_config --atleast-version=1.5.0 libgcrypt ; then
  37. + print_error "libgcrypt version is $($pkg_config --modversion libgcrypt)"
  38. + return 1
  39. + fi
  40. +
  41. + return 0
  42. +}
  43. if test "$nettle" != "no"; then
  44. pass="no"
  45. @@ -2885,7 +2909,14 @@ fi
  46. if test "$gcrypt" != "no"; then
  47. pass="no"
  48. - if has_libgcrypt; then
  49. + if has_libgcrypt_pkgconfig; then
  50. + gcrypt_cflags=$($pkg_config --cflags libgcrypt)
  51. + if test "$static" = "yes" ; then
  52. + gcrypt_libs=$($pkg_config --libs --static libgcrypt)
  53. + else
  54. + gcrypt_libs=$($pkg_config --libs libgcrypt)
  55. + fi
  56. + elif has_libgcrypt; then
  57. gcrypt_cflags=$(libgcrypt-config --cflags)
  58. gcrypt_libs=$(libgcrypt-config --libs)
  59. # Debian has removed -lgpg-error from libgcrypt-config
  60. @@ -2895,12 +2926,12 @@ if test "$gcrypt" != "no"; then
  61. then
  62. gcrypt_libs="$gcrypt_libs -lgpg-error"
  63. fi
  64. + fi
  65. - # Link test to make sure the given libraries work (e.g for static).
  66. - write_c_skeleton
  67. - if compile_prog "" "$gcrypt_libs" ; then
  68. + # Link test to make sure the given libraries work (e.g for static).
  69. + write_c_skeleton
  70. + if compile_prog "" "$gcrypt_libs" ; then
  71. pass="yes"
  72. - fi
  73. fi
  74. if test "$pass" = "yes"; then
  75. gcrypt="yes"