From 29408da8540e49079332ff8eb57e63da0f907a08 Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@qt.io>
Date: Tue, 9 Oct 2018 13:54:13 +0200
Subject: [PATCH] Fix configure check for freetype version

Unfortunately the versions reported by system freetype packages with
pkg-config are not always consistent with the actual freetype version.

Instead, we now use a compile time check, similar to what the
corresponding check for qtgui does.

Change-Id: I3316f5dfe423ffead5fd9cfec1542407c2b21bd8
Fixes: QTBUG-71033
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
---
 configure.json | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/configure.json b/configure.json
index 1c01c80ca..4201d1ff0 100644
--- a/configure.json
+++ b/configure.json
@@ -205,8 +205,21 @@
         },
         "webengine-freetype": {
             "label": "freetype >= 2.4.2",
+            "test": {
+                "head": [
+                    "#include <ft2build.h>",
+                    "#include FT_FREETYPE_H",
+                    "#if ((FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) < 20402)",
+                    "#  error This version of freetype is too old.",
+                    "#endif"
+                ],
+                "main": [
+                   "FT_Face ft_face = 0;",
+                   "FT_Reference_Face(ft_face);"
+                ]
+            },
             "sources": [
-                { "type": "pkgConfig", "args": "freetype2 >= 2.4.2" }
+                { "type": "pkgConfig", "args": "freetype2" }
             ]
         }
     },
-- 
GitLab