summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/gnutls/gnutls/use-pkg-config-to-locate-zlib.patch
blob: ae141a5bcd28fd343dca6779003da7e7aada920f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
From 18081068a97c00015aabc5fa321664951458ea0d Mon Sep 17 00:00:00 2001
From: Fan Xin <fan.xin@jp.fujitsu.com>
Date: Fri, 9 Jun 2017 15:20:31 +0900
Subject: [PATCH] From cee80af1fe93f5b76765afeebfcc3b902768f5d6 Mon Sep 17
 00:00:00 2001 From: Andre McCurdy <armccurdy@gmail.com> Date: Tue, 26 May
 2015 21:41:24 -0700 Subject: [PATCH] use pkg-config to locate zlib

AC_LIB_HAVE_LINKFLAGS can sometimes find host libs and is therefore not
robust when cross-compiling. Remove it for zlib and use PKG_CHECK_MODULES
instead.

Removing AC_LIB_HAVE_LINKFLAGS for zlib also removes the --with-libz-prefix
configure option. If zlib support is enabled, then failure to find zlib via
pkg-config is now treated as a fatal error.

Change based on ChromeOS gnutls 2.12.23 cross-compile fixes patch:

  https://chromium-review.googlesource.com/#/c/271661/

Upstream-Status: Inappropriate [configuration]

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>

Rebase on gnutls 3.5.13

Signed-off-by: Fan Xin <fan.xin@jp.fujitsu.com>
---
 configure.ac | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/configure.ac b/configure.ac
index c65268e..f6a18aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -735,28 +735,21 @@ AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib],
 AC_MSG_CHECKING([whether to include zlib compression support])
 if test x$ac_zlib != xno; then
  AC_MSG_RESULT(yes)
- AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
- if test x$ac_cv_libz != xyes; then
-   AC_MSG_WARN(
-*** 
-*** ZLIB was not found. You will not be able to use ZLIB compression.)
- fi
 else
  AC_MSG_RESULT(no)
 fi
 
-PKG_CHECK_EXISTS(zlib, ZLIB_HAS_PKGCONFIG=y, ZLIB_HAS_PKGCONFIG=n)
-
 if test x$ac_zlib != xno; then
-  if test "$ZLIB_HAS_PKGCONFIG" = "y" ; then
-    if test "x$GNUTLS_REQUIRES_PRIVATE" = x; then
-      GNUTLS_REQUIRES_PRIVATE="Requires.private: zlib"
-    else
-      GNUTLS_REQUIRES_PRIVATE="$GNUTLS_REQUIRES_PRIVATE, zlib"
-    fi
-    LIBZ_PC=""
+  PKG_CHECK_MODULES(ZLIB, zlib)
+  HAVE_LIBZ=yes
+  AC_DEFINE([HAVE_LIBZ], [1], [zlib is enabled])
+  AC_SUBST(HAVE_LIBZ)
+  LTLIBZ=$ZLIB_LIBS
+  AC_SUBST(LTLIBZ)
+  if test "x$GNUTLS_REQUIRES_PRIVATE" = x; then
+    GNUTLS_REQUIRES_PRIVATE="Requires.private: zlib"
   else
-    LIBZ_PC=$LIBZ
+    GNUTLS_REQUIRES_PRIVATE="$GNUTLS_REQUIRES_PRIVATE, zlib"
   fi
 fi
 AC_SUBST(LIBZ_PC)
-- 
1.9.1