From 1691d2298a8adf511ed95d5aa5d4410adcbdd1e3 Mon Sep 17 00:00:00 2001
From: Michal Klocek <michal.klocek@qt.io>
Date: Wed, 13 Sep 2017 19:12:38 +0200
Subject: [PATCH] Remove WEBENGINE_CONFIG from configure

Do not store flags in qmake.cache with WEBENGINE_CONFIG.
Use directly qtConfig values insted. This makes configuration
more consistent, simplifies handling and avoids passing
values from qtConfig to WEBENIGNE_CONFIG, which then
were passed to gn.

[ChangeLog] Removing WEBENGINE_CONFIG from qtwebengine configure

Change-Id: I1a773fb4bff6d67ad75c237d044998051d92ab51
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
---
 configure.json                                | 11 ++--
 .../spellchecker/spellchecker.pro             |  5 +-
 .../webenginewidgets/webenginewidgets.pro     | 14 ++--
 mkspecs/features/configure.prf                | 66 +------------------
 mkspecs/features/functions.prf                |  7 +-
 src/core/config/common.pri                    | 18 ++---
 src/core/config/desktop_linux.pri             |  4 --
 src/core/config/embedded_linux.pri            |  4 --
 src/core/config/linux.pri                     | 53 +++++++--------
 src/core/config/mac_osx.pri                   |  6 +-
 src/core/core_chromium.pri                    | 16 ++---
 src/core/core_generator.pro                   |  3 +
 src/core/core_module.pro                      |  7 +-
 src/src.pro                                   |  2 +-
 src/webengine/webengine.pro                   |  4 +-
 src/webenginewidgets/webenginewidgets.pro     |  9 +--
 .../qquickwebengineview.pro                   |  2 +-
 .../widgets/qwebenginepage/qwebenginepage.pro |  2 +-
 tests/auto/widgets/tests.pri                  |  3 +
 tests/auto/widgets/widgets.pro                |  7 +-
 20 files changed, 89 insertions(+), 154 deletions(-)

diff --git a/configure.json b/configure.json
index f2cd78343..c89012352 100644
--- a/configure.json
+++ b/configure.json
@@ -11,7 +11,7 @@
             "webengine-icu": { "type": "enum", "name": "system-icu", "values": { "system": "yes", "qt": "no" } },
             "ffmpeg": { "type": "enum", "name": "system-ffmpeg", "values": { "system": "yes", "qt": "no" } },
             "opus": { "type": "enum", "name": "system-opus", "values": { "system": "yes", "qt": "no" } },
-            "webp": { "type": "enum", "name": "system-webp", "values": { "system": "yes", "qt": "no" } },
+            "webp": { "type": "enum", "name": "system-libwebp", "values": { "system": "yes", "qt": "no" } },
             "pepper-plugins": "boolean",
             "printing-and-pdf": "boolean",
             "proprietary-codecs": "boolean",
@@ -436,8 +436,9 @@
         "native-spellchecker": {
             "label": "Native Spellchecker",
             "purpose": "Provides a native spellchecker.",
-            "condition": "config.macos",
             "section": "WebEngine",
+            "autoDetect": false,
+            "condition": "config.macos && features.spellchecker",
             "output": [ "privateFeature" ]
         },
         "ui-delegates": {
@@ -461,7 +462,7 @@
             "condition": "config.unix && !config.darwin && libs.nss",
             "output": [ "privateFeature" ]
         },
-        "system-webp": {
+        "system-libwebp": {
             "label": "libwebp, libwebpmux and libwebpdemux",
             "autoDetect": "config.unix",
             "condition": "libs.webp",
@@ -476,7 +477,7 @@
         "system-ffmpeg": {
             "label": "ffmpeg",
             "autoDetect": false,
-            "condition": "libs.ffmpeg && features.system-opus && features.system-webp",
+            "condition": "libs.ffmpeg && features.system-opus && features.system-libwebp",
             "output": [ "privateFeature" ]
         },
         "system-icu": {
@@ -572,7 +573,7 @@
                    "entries": [
                         "system-re2",
                         "system-icu",
-                        "system-webp",
+                        "system-libwebp",
                         "system-opus",
                         "system-ffmpeg",
                         "system-libvpx",
diff --git a/examples/webenginewidgets/spellchecker/spellchecker.pro b/examples/webenginewidgets/spellchecker/spellchecker.pro
index c6031a36d..4c7ad2c36 100644
--- a/examples/webenginewidgets/spellchecker/spellchecker.pro
+++ b/examples/webenginewidgets/spellchecker/spellchecker.pro
@@ -1,9 +1,12 @@
+include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
+QT_FOR_CONFIG += webengine-private
+
 TEMPLATE = app
 TARGET = spellchecker
 QT += webenginewidgets
 CONFIG += c++11
 
-contains(WEBENGINE_CONFIG, use_native_spellchecker) {
+qtConfig(native-spellchecker) {
     error("Spellcheck example can not be built when using native OS dictionaries.")
 }
 
diff --git a/examples/webenginewidgets/webenginewidgets.pro b/examples/webenginewidgets/webenginewidgets.pro
index cb7c8aa22..63deb5854 100644
--- a/examples/webenginewidgets/webenginewidgets.pro
+++ b/examples/webenginewidgets/webenginewidgets.pro
@@ -1,3 +1,6 @@
+include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
+QT_FOR_CONFIG += webengine-private
+
 TEMPLATE=subdirs
 
 SUBDIRS += \
@@ -12,10 +15,9 @@ SUBDIRS += \
 
 qtHaveModule(positioning): SUBDIRS += maps
 
-contains(WEBENGINE_CONFIG, use_spellchecker):!cross_compile {
-    !contains(WEBENGINE_CONFIG, use_native_spellchecker) {
-        SUBDIRS += spellchecker
-    } else {
-        message("Spellcheck example will not be built because it depends on usage of Hunspell dictionaries.")
-    }
+qtConfig(spellchecker):!qtConfig(native-spellchecker):!cross_compile {
+    SUBDIRS += spellchecker
+} else {
+    message("Spellcheck example will not be built because it depends on usage of Hunspell dictionaries.")
 }
+
diff --git a/mkspecs/features/configure.prf b/mkspecs/features/configure.prf
index ed6fe6c15..ed9882735 100644
--- a/mkspecs/features/configure.prf
+++ b/mkspecs/features/configure.prf
@@ -4,7 +4,6 @@ load(functions)
 load(platform)
 
 defineTest(runConfigure) {
-    webengine_successfully_configured: return(true)
 
     !exists(src/3rdparty/chromium) {
         skipBuild("Submodule qtwebengine-chromium does not exist. Run 'git submodule update --init'.")
@@ -48,26 +47,6 @@ defineTest(runConfigure) {
         return(false)
     }
 
-    qtConfig(pepper-plugins): WEBENGINE_CONFIG += use_pepper_plugins
-    qtConfig(printing-and-pdf): WEBENGINE_CONFIG += use_printing use_pdf
-    qtConfig(proprietary-codecs): WEBENGINE_CONFIG += use_proprietary_codecs
-    qtConfig(spellchecker): WEBENGINE_CONFIG += use_spellchecker
-    qtConfig(webrtc): WEBENGINE_CONFIG += use_webrtc
-    qtConfig(embedded): WEBENGINE_CONFIG += embedded_build
-    qtConfig(system-webp): WEBENGINE_CONFIG += use_system_libwebp
-    qtConfig(system-opus): WEBENGINE_CONFIG += use_system_opus
-    qtConfig(system-ffmpeg): WEBENGINE_CONFIG += use_system_ffmpeg
-    qtConfig(system-icu): WEBENGINE_CONFIG += use_system_icu
-    qtConfig(system-re2): WEBENGINE_CONFIG += use_system_re2
-
-    !contains(WEBENGINE_CONFIG, use_system_libwebp): WEBENGINE_CONFIG += use_bundled_libwebp
-    !contains(WEBENGINE_CONFIG, use_system_opus): WEBENGINE_CONFIG += use_bundled_opus
-    !contains(WEBENGINE_CONFIG, use_system_ffmpeg): WEBENGINE_CONFIG += use_bundled_ffmpeg
-    !contains(WEBENGINE_CONFIG, use_system_icu): WEBENGINE_CONFIG += use_bundled_icu
-
-    qtConfig(appstore-compliant): WEBENGINE_CONFIG += use_appstore_compliant_code
-    optimize_size: WEBENGINE_CONFIG += reduce_binary_size
-
     sanitizer: !qtConfig(webengine-sanitizer) {
         skipBuild("Chosen sanitizer configuration is not supported. Use --feature-webengine-sanitizer=yes to force build with the chosen sanitizer configuration.")
         return(false);
@@ -93,9 +72,7 @@ defineTest(runConfigure) {
             }
          }
 
-        WEBENGINE_CONFIG += use_nss
-
-        !contains(WEBENGINE_CONFIG, embedded_build): qtConfig(xcb) {
+        !qtConfig(embedded): qtConfig(xcb) {
              for(package, $$list("libdrm xcomposite xcursor xi xrandr xtst")) {
                  !qtConfig(system-$$package) {
                      skipBuild("A suitable version of $$package could not be found.")
@@ -103,47 +80,6 @@ defineTest(runConfigure) {
                  }
              }
         }
-
-        # Fix me: mamke system-png a public feature in gui
-        qtConfig(system-png): qtConfig(webengine-system-png) {
-             WEBENGINE_CONFIG += use_system_libpng
-        }
-        # Fix me: make system-harfbuzz a public feautre in gui
-        qtConfig(system-harfbuzz): qtConfig(webengine-system-harfbuzz) {
-             WEBENGINE_CONFIG += use_system_harfbuzz
-        }
-        qtConfig(system-glib) {
-             WEBENGINE_CONFIG += use_glib
-        }
-        qtConfig(system-minizip) {
-             WEBENGINE_CONFIG += use_system_minizip
-        }
-        qtConfig(system-zlib) {
-             WEBENGINE_CONFIG += use_system_zlib
-        }
-        qtConfig(system-libxml2) {
-            WEBENGINE_CONFIG += use_system_libxslt use_system_libxml2
-        }
-
-        for(package, $$list("libevent jsoncpp protobuf libvpx libsrtp snappy")) {
-            qtConfig(system-$$package) {
-                WEBENGINE_CONFIG += use_system_$$package
-            } else {
-                WEBENGINE_CONFIG += use_bundled_$$package
-            }
-        }
-    }
-
-    isEmpty(skipBuildReason) {
-        cache(CONFIG, add, $$list(webengine_successfully_configured))
-        !isEmpty(WEBENGINE_CONFIG) {
-            cache(WEBENGINE_CONFIG, add, $$list($$WEBENGINE_CONFIG))
-            export(WEBENGINE_CONFIG)
-        }
-    }
-
-    macos:qtConfig(native-spellchecker) {
-        WEBENGINE_CONFIG+=use_native_spellchecker
     }
 }
 
diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf
index 0074a27b0..3f0d64ba5 100644
--- a/mkspecs/features/functions.prf
+++ b/mkspecs/features/functions.prf
@@ -47,11 +47,6 @@ defineReplace(which) {
   return($$out)
 }
 
-defineTest(use?) {
-    contains(WEBENGINE_CONFIG, use_$$lower($$1)): return(true)
-    return(false)
-}
-
 # Returns the unquoted path to the python executable.
 defineReplace(pythonPath) {
     isEmpty(QMAKE_PYTHON2) {
@@ -88,7 +83,7 @@ defineReplace(gnPath) {
 
 defineReplace(gnArgs) {
     linux {
-        contains(WEBENGINE_CONFIG, embedded_build): include($$QTWEBENGINE_ROOT/src/core/config/embedded_linux.pri)
+        qtConfig(embedded): include($$QTWEBENGINE_ROOT/src/core/config/embedded_linux.pri)
         else: include($$QTWEBENGINE_ROOT/src/core/config/desktop_linux.pri)
     }
     macos: include($$QTWEBENGINE_ROOT/src/core/config/mac_osx.pri)
diff --git a/src/core/config/common.pri b/src/core/config/common.pri
index ce7364ff9..2aa3c614d 100644
--- a/src/core/config/common.pri
+++ b/src/core/config/common.pri
@@ -13,37 +13,33 @@ gn_args += \
     treat_warnings_as_errors=false \
     enable_swiftshader=false
 
-use?(printing) {
+qtConfig(printing-and-pdf) {
     gn_args += enable_basic_printing=true enable_print_preview=true
-} else {
-    gn_args += enable_basic_printing=false enable_print_preview=false
-}
-
-use?(pdf) {
     gn_args += enable_pdf=true
 } else {
+    gn_args += enable_basic_printing=false enable_print_preview=false
     gn_args += enable_pdf=false
 }
 
-use?(pepper_plugins) {
+qtConfig(pepper-plugins) {
     gn_args += enable_plugins=true enable_widevine=true
 } else {
     gn_args += enable_plugins=false enable_widevine=false
 }
 
-use?(spellchecker) {
+qtConfig(spellchecker) {
     gn_args += enable_spellcheck=true
 } else {
     gn_args += enable_spellcheck=false
 }
 
-use?(webrtc) {
+qtConfig(webrtc) {
     gn_args += enable_webrtc=true
 } else {
     gn_args += enable_webrtc=false
 }
 
-use?(proprietary_codecs): gn_args += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
+qtConfig(proprietary-codecs): gn_args += proprietary_codecs=true ffmpeg_branding=\"Chrome\"
 
 CONFIG(release, debug|release) {
     force_debug_info {
@@ -63,4 +59,4 @@ CONFIG(debug, debug|release) {
 !v8base_debug: gn_args += remove_v8base_debug_symbols=true
 
 # Compiling with -Os makes a huge difference in binary size
-contains(WEBENGINE_CONFIG, reduce_binary_size): gn_args += optimize_for_size=true
+optimize_size: gn_args += optimize_for_size=true
diff --git a/src/core/config/desktop_linux.pri b/src/core/config/desktop_linux.pri
index 4d3f923e1..70f1cf81e 100644
--- a/src/core/config/desktop_linux.pri
+++ b/src/core/config/desktop_linux.pri
@@ -5,8 +5,4 @@ gn_args += \
     enable_session_service=false \
     toolkit_views=false
 
-use?(icecc) {
-    gn_args += use_debug_fission=false
-}
-
 !use_gold_linker: gn_args += use_gold=false
diff --git a/src/core/config/embedded_linux.pri b/src/core/config/embedded_linux.pri
index e48f1fc12..8d9f09deb 100644
--- a/src/core/config/embedded_linux.pri
+++ b/src/core/config/embedded_linux.pri
@@ -11,7 +11,3 @@ gn_args += \
     ozone_platform_external=true \
     ozone_platform=\"qt\" \
     toolkit_views=false
-
-use?(icecc) {
-    gn_args += use_debug_fission=false
-}
diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri
index c0f2f6289..fae157060 100644
--- a/src/core/config/linux.pri
+++ b/src/core/config/linux.pri
@@ -8,17 +8,10 @@ gn_args += \
     use_gio=false \
     use_gnome_keyring=false \
     use_kerberos=false \
-    linux_use_bundled_binutils=false
+    linux_use_bundled_binutils=false \
+    use_nss_certs=true \
+    use_openssl_certs=false
 
-use?(nss) {
-    gn_args += \
-        use_nss_certs=true \
-        use_openssl_certs=false
-} else {
-    gn_args += \
-        use_nss_certs=false \
-        use_openssl_certs=true
-}
 gcc:!clang: greaterThan(QT_GCC_MAJOR_VERSION, 5): gn_args += no_delete_null_pointer_checks=true
 
 clang {
@@ -119,15 +112,20 @@ host_build {
         # Strip '>2 /dev/null' from $$pkgConfigExecutable()
         PKGCONFIG = $$first($$list($$pkgConfigExecutable()))
         gn_args += pkg_config=\"$$PKGCONFIG\"
-        gn_args += "host_pkg_config=\"pkg-config\""
+        gn_args += host_pkg_config=\"pkg-config\"
     }
 
-    qtConfig(system-zlib): use?(system_minizip): gn_args += use_system_zlib=true use_system_minizip=true
-    use?(system_libpng): gn_args += use_system_libpng=true
+    qtConfig(system-zlib): qtConfig(system-minizip): gn_args += use_system_zlib=true use_system_minizip=true
+
+    # FIXME: make system-png a public feature in gui
+    qtConfig(system-png): qtConfig(webengine-system-png): gn_args += use_system_libpng=true
+
     qtConfig(system-jpeg): gn_args += use_system_libjpeg=true
     qtConfig(system-freetype): gn_args += use_system_freetype=true
-    use?(system_harfbuzz): gn_args += use_system_harfbuzz=true
-    !use?(glib): gn_args += use_glib=false
+
+    # FIXME: make system-harfbuzz a public feautre in gui
+    qtConfig(system-harfbuzz): qtConfig(webengine-system-harfbuzz): gn_args += use_system_harfbuzz=true
+    qtConfig(system-glib): gn_args += use_glib=false
     qtConfig(pulseaudio) {
         gn_args += use_pulseaudio=true
     } else {
@@ -143,15 +141,18 @@ host_build {
     !packagesExist(libpci): gn_args += use_libpci=false
     !packagesExist(xscrnsaver): gn_args += use_xscrnsaver=false
 
-    use?(system_libevent): gn_args += use_system_libevent=true
-    use?(system_libwebp):  gn_args += use_system_libwebp=true
-    use?(system_libxslt):  gn_args += use_system_libxml=true use_system_libxslt=true
-    #use?(system_jsoncpp):  gn_args += use_system_jsoncpp=true
-    use?(system_opus):     gn_args += use_system_opus=true
-    use?(system_snappy):   gn_args += use_system_snappy=true
-    use?(system_libvpx):   gn_args += use_system_libvpx=true
-    use?(system_icu):      gn_args += use_system_icu=true icu_use_data_file=false
-    use?(system_ffmpeg):   gn_args += use_system_ffmpeg=true
-    use?(system_re2):      gn_args += use_system_re2=true
-    #use?(system_protobuf): gn_args += use_system_protobuf=true
+    qtConfig(system-libevent): gn_args += use_system_libevent=true
+    qtConfig(system-libwebp): gn_args += use_system_libwebp=true
+    qtConfig(system-libxml2): gn_args += use_system_libxml=true use_system_libxslt=true
+    qtConfig(system-opus): gn_args += use_system_opus=true
+    qtConfig(system-snappy):   gn_args += use_system_snappy=true
+    qtConfig(system-libvpx):   gn_args += use_system_libvpx=true
+    qtConfig(system-icu): gn_args += use_system_icu=true icu_use_data_file=false
+    qtConfig(system-ffmpeg): gn_args += use_system_ffmpeg=true
+    qtConfig(system-re2):      gn_args += use_system_re2=true
+
+    # FIXME:
+    #qtConfig(system-protobuf): gn_args += use_system_protobuf=true
+    #qtConfig(system-jsoncpp):  gn_args += use_system_jsoncpp=true
+    #qtConfig(system-libsrtp: gn_args += use_system_libsrtp=true
 }
diff --git a/src/core/config/mac_osx.pri b/src/core/config/mac_osx.pri
index ddb397565..57f301f18 100644
--- a/src/core/config/mac_osx.pri
+++ b/src/core/config/mac_osx.pri
@@ -32,9 +32,9 @@ gn_args += \
     toolkit_views=false \
     use_external_popup_menu=false
 
-use?(spellchecker) {
-    use?(native_spellchecker): gn_args += use_browser_spellchecker=true
+qtConfig(spellchecker) {
+    qtConfig(native-spellchecker): gn_args += use_browser_spellchecker=true
     else: gn_args += use_browser_spellchecker=false
 } else {
-    macos: gn_args += use_browser_spellchecker=false
+    gn_args += use_browser_spellchecker=false
 }
diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri
index b76469833..71f74f51a 100644
--- a/src/core/core_chromium.pri
+++ b/src/core/core_chromium.pri
@@ -28,7 +28,7 @@ RCC_DIR = $$OUT_PWD/$$getConfigDir()/.rcc
 
 # Assume that we want mobile touch and low-end hardware behaviors
 # whenever we are cross compiling.
-contains(WEBENGINE_CONFIG, embedded_build): DEFINES += QTWEBENGINE_EMBEDDED_SWITCHES
+qtConfig(embedded): DEFINES += QTWEBENGINE_EMBEDDED_SWITCHES
 
 qtConfig(egl): CONFIG += egl
 
@@ -187,13 +187,8 @@ HEADERS = \
         web_engine_settings.h \
         web_event_factory.h
 
+qtConfig(pepper-plugins) {
 
-use?(pdf) {
-    SOURCES += pdfium_document_wrapper_qt.cpp
-    HEADERS += pdfium_document_wrapper_qt.h
-}
-
-use?(pepper_plugins) {
     SOURCES += \
         renderer_host/pepper/pepper_flash_browser_host_qt.cpp \
         renderer_host/pepper/pepper_host_factory_qt.cpp \
@@ -209,7 +204,8 @@ use?(pepper_plugins) {
         renderer/pepper/pepper_renderer_host_factory_qt.h
 }
 
-use?(printing) {
+qtConfig(printing-and-pdf) {
+
     SOURCES += \
         printing_message_filter_qt.cpp \
         print_view_manager_base_qt.cpp \
@@ -221,6 +217,10 @@ use?(printing) {
         print_view_manager_base_qt.h \
         print_view_manager_qt.h \
         renderer/print_web_view_helper_delegate_qt.h
+
+    # pdf sources
+    SOURCES += pdfium_document_wrapper_qt.cpp
+    HEADERS += pdfium_document_wrapper_qt.h
 }
 
 contains(QT_CONFIG, opengl) {
diff --git a/src/core/core_generator.pro b/src/core/core_generator.pro
index 916c211f9..cbf126dda 100644
--- a/src/core/core_generator.pro
+++ b/src/core/core_generator.pro
@@ -1,3 +1,6 @@
+include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
+QT_FOR_CONFIG += webengine-private
+
 include(core_gn_config.pri)
 
 TEMPLATE = lib
diff --git a/src/core/core_module.pro b/src/core/core_module.pro
index 1a5b66867..55b20cda2 100644
--- a/src/core/core_module.pro
+++ b/src/core/core_module.pro
@@ -1,3 +1,6 @@
+include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
+QT_FOR_CONFIG += webengine-private
+
 MODULE = webenginecore
 
 include(core_common.pri)
@@ -110,7 +113,7 @@ icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat
         resources.path = $$[QT_INSTALL_DATA]/resources
         INSTALLS += locales resources
 
-        !use?(system_icu) {
+        !qtConfig(system-icu) {
             icu.CONFIG += no_check_exist
             icu.path = $$[QT_INSTALL_DATA]/resources
             INSTALLS += icu
@@ -122,7 +125,7 @@ icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat
         # Copy essential files to the qtbase build directory for non-prefix builds
         #
 
-        !use?(system_icu) {
+        !qtConfig(system-icu) {
             COPIES += icu
         }
 
diff --git a/src/src.pro b/src/src.pro
index fabead2a0..1cd23f9fa 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -20,7 +20,7 @@ SUBDIRS += buildtools \
            plugins
 
 
-use?(spellchecker):!use?(native_spellchecker):!cross_compile {
+qtConfig(spellchecker):!qtConfig(native-spellchecker):!cross_compile {
     SUBDIRS += qwebengine_convert_dict
     qwebengine_convert_dict.subdir = tools/qwebengine_convert_dict
     qwebengine_convert_dict.depends = core
diff --git a/src/webengine/webengine.pro b/src/webengine/webengine.pro
index ac2727580..4b2170cbc 100644
--- a/src/webengine/webengine.pro
+++ b/src/webengine/webengine.pro
@@ -67,11 +67,11 @@ qtConfig(testsupport) {
     DEFINES += ENABLE_QML_TESTSUPPORT_API
 }
 
-contains(WEBENGINE_CONFIG, use_spellchecker) {
+qtConfig(spellchecker) {
     DEFINES += ENABLE_SPELLCHECK
 }
 
-use?(pdf) {
+qtConfig(printing-and-pdf) {
     DEFINES += ENABLE_PDF
 }
 
diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro
index 10791a6ca..a5c22e7be 100644
--- a/src/webenginewidgets/webenginewidgets.pro
+++ b/src/webenginewidgets/webenginewidgets.pro
@@ -51,17 +51,14 @@ qtConfig(ui-delegates) {
     DEFINES += QT_UI_DELEGATES
 }
 
-contains(WEBENGINE_CONFIG, use_spellchecker) {
+qtConfig(spellchecker) {
     DEFINES += ENABLE_SPELLCHECK
 }
 
-use?(printing) {
+qtConfig(printing-and-pdf) {
     DEFINES += ENABLE_PRINTING
-    QT += printsupport
-}
-
-use?(pdf) {
     DEFINES += ENABLE_PDF
+    QT += printsupport
 }
 
 load(qt_module)
diff --git a/tests/auto/quick/qquickwebengineview/qquickwebengineview.pro b/tests/auto/quick/qquickwebengineview/qquickwebengineview.pro
index df9b3e1b7..0f62ec21d 100644
--- a/tests/auto/quick/qquickwebengineview/qquickwebengineview.pro
+++ b/tests/auto/quick/qquickwebengineview/qquickwebengineview.pro
@@ -5,7 +5,7 @@ QT_PRIVATE += webengine-private gui-private
 
 HEADERS += ../shared/util.h
 
-use?(pdf) {
+qtConfig(printing-and-pdf) {
     DEFINES += ENABLE_PDF
 }
 
diff --git a/tests/auto/widgets/qwebenginepage/qwebenginepage.pro b/tests/auto/widgets/qwebenginepage/qwebenginepage.pro
index e0765736e..a2dbd4d70 100644
--- a/tests/auto/widgets/qwebenginepage/qwebenginepage.pro
+++ b/tests/auto/widgets/qwebenginepage/qwebenginepage.pro
@@ -1,4 +1,4 @@
 include(../tests.pri)
 QT *= core-private
 
-contains(WEBENGINE_CONFIG, use_pdf): DEFINES+=QWEBENGINEPAGE_PDFPRINTINGENABLED
+qtConfig(printing-and-pdf): DEFINES+=QWEBENGINEPAGE_PDFPRINTINGENABLED
diff --git a/tests/auto/widgets/tests.pri b/tests/auto/widgets/tests.pri
index d77cd5af5..dc0461e2b 100644
--- a/tests/auto/widgets/tests.pri
+++ b/tests/auto/widgets/tests.pri
@@ -1,3 +1,6 @@
+include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
+QT_FOR_CONFIG += webengine-private
+
 TEMPLATE = app
 
 CONFIG += testcase
diff --git a/tests/auto/widgets/widgets.pro b/tests/auto/widgets/widgets.pro
index 441eea0fa..60e5cc11f 100644
--- a/tests/auto/widgets/widgets.pro
+++ b/tests/auto/widgets/widgets.pro
@@ -1,3 +1,6 @@
+include($$QTWEBENGINE_OUT_ROOT/qtwebengine-config.pri)
+QT_FOR_CONFIG += webengine-private
+
 TEMPLATE = subdirs
 
 SUBDIRS += \
@@ -14,8 +17,8 @@ SUBDIRS += \
     qwebenginesettings \
     qwebengineview
 
-contains(WEBENGINE_CONFIG, use_spellchecker):!cross_compile {
-    !contains(WEBENGINE_CONFIG, use_native_spellchecker) {
+qtConfig(spellchecker):!cross_compile {
+    !qtConfig(native-spellchecker) {
         SUBDIRS += qwebenginespellcheck
     } else {
         message("Spellcheck test will not be built because it depends on usage of Hunspell dictionaries.")
-- 
GitLab