diff --git a/configure.json b/configure.json
index 7ef1f5003ec6d1085087b8675ba3a1596b5314bc..fecd83ed4482d7ea2d997dc6487f7d68e0fcb016 100644
--- a/configure.json
+++ b/configure.json
@@ -223,6 +223,11 @@
             "type": "detectPython2",
             "log": "location"
         },
+        "webengine-host-pkg-config": {
+            "label": "host pkg-config",
+            "type": "detectHostPkgConfig",
+            "log": "path"
+        },
         "webengine-gperf": {
             "label": "gperf",
             "type": "detectGperf"
@@ -355,6 +360,14 @@
                 { "type": "varAssign", "name": "QMAKE_PYTHON2", "value": "tests.webengine-python2.location" }
             ]
         },
+        "webengine-host-pkg-config": {
+            "label": "host-pkg-config",
+            "condition": "config.unix && tests.webengine-host-pkg-config",
+            "output": [
+                "privateFeature",
+                { "type": "varAssign", "name": "QMAKE_PKG_CONFIG_HOST", "value": "tests.webengine-host-pkg-config.path" }
+            ]
+        },
         "webengine-gperf": {
             "label": "gperf",
             "condition": "tests.webengine-gperf",
@@ -566,6 +579,11 @@
             "type": "warning",
             "condition": "config.sanitizer && !tests.webengine-sanitizer && !features.webengine-sanitizer",
             "message": "Qt WebEngine cannot be built with the chosen sanitizer configuration. Check config.log for details or use -feature-webengine-sanitizer to force the build."
+        },
+        {
+            "type": "warning",
+            "condition": "config.unix && !features.webengine-host-pkg-config",
+            "message": "host pkg-config not found"
         }
     ],
 
diff --git a/configure.pri b/configure.pri
index 497557262ee86f6d587c6bef192b3852a6c010c8..ecf2ce4d36856c90ea81eb0354fe3fffa8a42c18 100644
--- a/configure.pri
+++ b/configure.pri
@@ -157,6 +157,20 @@ defineTest(qtConfTest_detectIcuuc) {
    return(false)
 }
 
+defineTest(qtConfTest_detectHostPkgConfig) {
+   PKG_CONFIG = $$qtConfPkgConfig(true)
+   isEmpty(PKG_CONFIG) {
+       qtLog("Could not find host pkg-config")
+       return(false)
+   }
+   qtLog("Found host pkg-config: $$PKG_CONFIG")
+   $${1}.path = $$PKG_CONFIG
+   export($${1}.path)
+   $${1}.cache += path
+   export($${1}.cache)
+   return(true)
+}
+
 defineTest(qtConfTest_isSanitizerSupported) {
   sanitizer_combo_supported = true
 
diff --git a/mkspecs/features/configure.prf b/mkspecs/features/configure.prf
index 8b8fd3efe931d37ea2bffcc9e0f58a9e5783a838..2c09085985146e0fe12c438f89f59aacecf910f7 100644
--- a/mkspecs/features/configure.prf
+++ b/mkspecs/features/configure.prf
@@ -53,6 +53,12 @@ defineTest(runConfigure) {
     }
 
     linux {
+
+        !qtConfig(webengine-host-pkg-config) {
+            skipBuild("Host pkg-config is required")
+            return(false)
+        }
+
         !qtConfig(webengine-system-glibc) {
             skipBuild("A suitable version of libc could not be found. See: https://sourceware.org/bugzilla/show_bug.cgi?id=14898")
             return(false)
diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf
index 3b9a400b1204f96dfa40305096dc66f0a6e79f9a..8564bad8adaf7798daa4959e5d8da0fff26f24c1 100644
--- a/mkspecs/features/functions.prf
+++ b/mkspecs/features/functions.prf
@@ -115,3 +115,18 @@ defineTest(skipBuild) {
     skipBuildReason = "$$skipBuildReason $${EOL}$$1"
     export(skipBuildReason)
 }
+
+defineReplace(pkgConfigHostExecutable) {
+    wrapper_name = $$OUT_PWD/pkg-config-host_wrapper.sh
+    wrapper_cmd = $$QMAKE_PKG_CONFIG_HOST
+    isEmpty(wrapper_cmd): wrapper_cmd = pkg-config
+    wrapper_content = \
+        "$$LITERAL_HASH!/bin/sh" \
+        "unset PKG_CONFIG_LIBDIR" \
+        "unset PKG_CONFIG_SYSROOT_DIR" \
+        "exec $$wrapper_cmd \"$@\""
+    !build_pass:!write_file($$wrapper_name, wrapper_content, exe): error()
+    QMAKE_DISTCLEAN += $$wrapper_name
+    export(QMAKE_DISTCLEAN)
+    return($$system_quote($$system_path($$wrapper_name)))
+}
diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri
index 6f7b27f103a7614f4c83515a321383dc8b1a860b..d337f686f9e5dd126afde9697f15991e81969f85 100644
--- a/src/core/config/linux.pri
+++ b/src/core/config/linux.pri
@@ -113,7 +113,14 @@ host_build {
         PKGCONFIG = $$first($$list($$pkgConfigExecutable()))
         gn_args += pkg_config=\"$$PKGCONFIG\"
         PKG_CONFIG_HOST = $$(GN_PKG_CONFIG_HOST)
-        isEmpty(PKG_CONFIG_HOST): PKG_CONFIG_HOST = pkg-config
+        pkgConfigLibDir = $$(PKG_CONFIG_LIBDIR)
+        pkgConfigSysrootDir = $$(PKG_CONFIG_SYSROOT_DIR)
+        isEmpty(PKG_CONFIG_HOST): PKG_CONFIG_HOST = $$QMAKE_PKG_CONFIG_HOST
+        cross_compile {
+            !isEmpty(pkgConfigLibDir)|!isEmpty(pkgConfigSysrootDir) {
+                PKG_CONFIG_HOST = $$pkgConfigHostExecutable()
+            }
+        }
         gn_args += host_pkg_config=\"$$PKG_CONFIG_HOST\"
     }