qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Rossi <nathan@nathanrossi.com>
To: qemu-devel@nongnu.org
Cc: Nathan Rossi <nathan@nathanrossi.com>,
	Alistair Francis <alistair.francis@xilinx.com>
Subject: [Qemu-devel] [PATCH] configure: For libgcrypt if pkg-config is available use it
Date: Thu, 05 Jan 2017 00:56:52 +1000	[thread overview]
Message-ID: <20170104145652.30442-1-nathan@nathanrossi.com> (raw)

If libgcrypt info is available with pkg-config use it over using the
libgcrypt-config. pkg-config is preferred due to is compatibility with
cross-compilation (where you cannot execute the targets version of
libgcrypt-config).

This change makes configure check for libgcrypt in pkg-config first,
then falling back to use libgcrypt-config if available. This follows a
similar process to how libsdl is handled.

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
---
 configure | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 218df87d21..6558121de8 100755
--- a/configure
+++ b/configure
@@ -2386,9 +2386,17 @@ has_libgcrypt_config() {
 }
 
 if test "$gcrypt" != "no"; then
-    if has_libgcrypt_config; then
-        gcrypt_cflags=$(libgcrypt-config --cflags)
-        gcrypt_libs=$(libgcrypt-config --libs)
+    gcrypt_config=""
+    # If libgcrypt in pkg-config use it over using libgcrypt-config
+    if $pkg_config --exists "libgcrypt"; then
+      gcrypt_config="$pkg_config libgcrypt"
+    elif has_libgcrypt_config; then
+      gcrypt_config="libgcrypt-config"
+    fi
+
+    if test -n "$gcrypt_config"; then
+        gcrypt_cflags=$($gcrypt_config --cflags)
+        gcrypt_libs=$($gcrypt_config --libs)
         # Debian has remove -lgpg-error from libgcrypt-config
         # as it "spreads unnecessary dependencies" which in
         # turn breaks static builds...
-- 
2.11.0

             reply	other threads:[~2017-01-04 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-04 14:56 Nathan Rossi [this message]
2017-01-04 15:27 ` [Qemu-devel] [PATCH] configure: For libgcrypt if pkg-config is available use it Daniel P. Berrange
2017-01-04 16:01   ` Nathan Rossi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170104145652.30442-1-nathan@nathanrossi.com \
    --to=nathan@nathanrossi.com \
    --cc=alistair.francis@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).