configure: Set PKG_CONFIG_PATH to get the right settings for the target host.

Francois Gouget fgouget at codeweavers.com
Tue Jun 6 07:51:35 CDT 2017


As pointed out by Henri we should not override PKG_CONFIG_PATH in case 
it's already set. Here we still override it if it is set to an empty 
string but that can be worked around by setting it to a nonexistent path 
or maybe even a single colon.

Ideally we would use the right <triplet>-pkg-config tool for the target
host. However Red Hat and SUSE respectively add '-redhat' and '-suse' to
the triplet which makes it hard to find the right tool. Furthermore on
Debian and derivatives a lot of development packages do not support
multiarch so that the required .pc files would not be found.

Setting PKG_CONFIG_PATH side-steps the non-standard Red Hat and SUSE
triplets. It also lets pkg-config fall back to the 'wrong' .pc files
on Debian which is fine in most cases, which using the right one in
cases where it matters (GStreamer 1.0), assuming they are actually
present.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 configure.ac | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/configure.ac b/configure.ac
index 71bf7ca2bf7..b7e4eff3b11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,6 +151,11 @@ case $host in
       host_cpu="i386"
       notice_platform="32-bit "
       AC_SUBST(TARGETFLAGS,"-m32")
+      if test "x$PKG_CONFIG_PATH" = "x"
+      then
+        PKG_CONFIG_PATH="/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig"
+        export PKG_CONFIG_PATH
+      fi
       enable_win16=${enable_win16:-yes}
     else
       if test "x${GCC}" = "xyes"
@@ -166,6 +171,11 @@ case $host in
       host_cpu="x86_64"
       notice_platform="64-bit "
       AC_SUBST(TARGETFLAGS,"-m64")
+      if test "x$PKG_CONFIG_PATH" = "x"
+      then
+        PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib64/pkgconfig"
+        export PKG_CONFIG_PATH
+      fi
     fi
     ;;
   arm*)
-- 
2.11.0



More information about the wine-devel mailing list