From d6fccc69f39def255ec5d1ea36c37c49273c23b1 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 23 Jan 2012 22:31:13 +0000 Subject: QRegularExpression: configure support for PCRE Added PCRE config.tests, and logic and command line options (-qt-pcre and -system-pcre) for configure and configure.exe. Change-Id: I5da2658191198dbcf48c07d7c5de1be1b884a7a5 Reviewed-by: Friedemann Kleint Reviewed-by: Oswald Buddenhagen --- config.tests/unix/pcre/pcre.cpp | 51 ++++++++++++++++++++++++++++++++++++++++ config.tests/unix/pcre/pcre.pro | 3 +++ configure | 34 +++++++++++++++++++++++++++ tools/configure/configureapp.cpp | 27 +++++++++++++++++++-- 4 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 config.tests/unix/pcre/pcre.cpp create mode 100644 config.tests/unix/pcre/pcre.pro diff --git a/config.tests/unix/pcre/pcre.cpp b/config.tests/unix/pcre/pcre.cpp new file mode 100644 index 0000000000..9bdef6da5c --- /dev/null +++ b/config.tests/unix/pcre/pcre.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Giuseppe D'Angelo . +** Contact: http://www.qt-project.org/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#if (PCRE_MAJOR < 8) || ((PCRE_MAJOR == 8) && (PCRE_MINOR < 30)) +#error This PCRE version is not supported +#endif + +int main(int, char **) +{ + return 0; +} + diff --git a/config.tests/unix/pcre/pcre.pro b/config.tests/unix/pcre/pcre.pro new file mode 100644 index 0000000000..b29c55da47 --- /dev/null +++ b/config.tests/unix/pcre/pcre.pro @@ -0,0 +1,3 @@ +SOURCES = pcre.cpp +CONFIG -= qt dylib app_bundle +LIBS += -lpcre16 diff --git a/configure b/configure index fe07f8cc70..4a4ef6d812 100755 --- a/configure +++ b/configure @@ -814,6 +814,7 @@ CFG_COREWLAN=auto CFG_NOPROCESS=no CFG_ICU=auto CFG_FORCE_ASSERTS=no +CFG_PCRE=auto # initalize variables used for installation QT_INSTALL_PREFIX= @@ -2317,6 +2318,13 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; + pcre) + if [ "$VAL" = "qt" ] || [ "$VAL" = "system" ]; then + CFG_PCRE="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; *) UNKNOWN_OPT=yes ;; @@ -3559,6 +3567,7 @@ Usage: $relconf [-h] [-prefix ] [-prefix-install] [-bindir ] [-libdir [-no-script] [-script] [-no-scripttools] [-scripttools] [-no-declarative] [-declarative] [-no-declarative-debug] [-declarative-debug] [-no-location] [-location] + [-qt-pcre] [-system-pcre] [additional platform specific options (see below)] @@ -3795,6 +3804,9 @@ Third Party Libraries: + -openssl ........... Enable run-time OpenSSL support. -openssl-linked .... Enabled linked OpenSSL support. + -qt-pcre ........... Use the PCRE library bundled with Qt. + + -system-pcre ....... Use the PCRE library from the operating system. + Additional options: -make ....... Add part to the list of parts to be built at make time. @@ -6410,6 +6422,23 @@ if [ "$CFG_OPENSSL" != "no" ]; then fi fi +# detect PCRE +if [ "$CFG_PCRE" != "qt" ]; then + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/pcre "PCRE" $L_FLAGS $I_FLAGS $l_FLAGS; then + CFG_PCRE=system + else + if [ "$CFG_PCRE" = "system" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then + echo "PCRE support cannot be enabled due to functionality tests!" + echo " Turn on verbose messaging (-v) to $0 to see the final report." + echo " If you believe this message is in error you may use the continue" + echo " switch (-continue) to $0 to continue." + exit 101 + else + CFG_PCRE=qt + fi + fi +fi + # detect OpenVG support if [ "$CFG_OPENVG" != "no" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "config.tests/unix/openvg" "OpenVG" $L_FLAGS $I_FLAGS $l_FLAGS $CONFIG_ARG; then @@ -6931,6 +6960,10 @@ if [ "$CFG_FORCE_ASSERTS" = "yes" ]; then QT_CONFIG="$QT_CONFIG force_asserts" fi +if [ "$CFG_PCRE" = "qt" ]; then + QMAKE_CONFIG="$QMAKE_CONFIG pcre" +fi + # # Some Qt modules are too advanced in C++ for some old compilers # Detect here the platforms where they are known to work. @@ -8078,6 +8111,7 @@ if [ "$PLATFORM_MAC" = "yes" ]; then echo "CoreWlan support ....... $CFG_COREWLAN" fi echo "libICU support ......... $CFG_ICU" +echo "PCRE support ........... $CFG_PCRE" if [ "$CFG_XCB_LIMITED" = "yes" ] && [ "$CFG_XCB" = "yes" ]; then echo "Xcb support ............ limited (old version)" else diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 656323e365..d32b65107f 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -305,6 +305,8 @@ Configure::Configure(int& argc, char** argv) dictionary[ "ZLIB" ] = "auto"; + dictionary[ "PCRE" ] = "auto"; + dictionary[ "GIF" ] = "auto"; dictionary[ "TIFF" ] = "auto"; dictionary[ "JPEG" ] = "auto"; @@ -545,6 +547,12 @@ void Configure::parseCmdLine() dictionary[ "ZLIB" ] = "system"; } + else if (configCmdLine.at(i) == "-qt-pcre") { + dictionary[ "PCRE" ] = "qt"; + } else if (configCmdLine.at(i) == "-system-pcre") { + dictionary[ "PCRE" ] = "system"; + } + // Image formats -------------------------------------------- else if (configCmdLine.at(i) == "-no-gif") dictionary[ "GIF" ] = "no"; @@ -1522,8 +1530,8 @@ bool Configure::displayHelp() "[-no-qmake] [-qmake] [-dont-process] [-process]\n" "[-no-style-