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