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 <Friedemann.Kleint@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
Giuseppe D'Angelo 2012-01-23 22:31:13 +00:00 committed by Qt by Nokia
parent 3f91558d40
commit d6fccc69f3
4 changed files with 113 additions and 2 deletions

View File

@ -0,0 +1,51 @@
/****************************************************************************
**
** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.com>.
** 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 <pcre.h>
#if (PCRE_MAJOR < 8) || ((PCRE_MAJOR == 8) && (PCRE_MINOR < 30))
#error This PCRE version is not supported
#endif
int main(int, char **)
{
return 0;
}

View File

@ -0,0 +1,3 @@
SOURCES = pcre.cpp
CONFIG -= qt dylib app_bundle
LIBS += -lpcre16

34
configure vendored
View File

@ -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 <dir>] [-prefix-install] [-bindir <dir>] [-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 <part> ....... 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

View File

@ -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-<style>] [-qt-style-<style>] [-redo]\n"
"[-saveconfig <config>] [-loadconfig <config>]\n"
"[-qt-zlib] [-system-zlib] [-no-gif] [-no-libpng]\n"
"[-qt-libpng] [-system-libpng] [-no-libtiff] [-qt-libtiff]\n"
"[-qt-zlib] [-system-zlib] [-qt-pcre] [-system-pcre] [-no-gif]\n"
"[-no-libpng] [-qt-libpng] [-system-libpng] [-no-libtiff] [-qt-libtiff]\n"
"[-system-libtiff] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg]\n"
"[-mmx] [-no-mmx] [-3dnow] [-no-3dnow] [-sse] [-no-sse] [-sse2] [-no-sse2]\n"
"[-no-iwmmxt] [-iwmmxt] [-openssl] [-openssl-linked]\n"
@ -1643,6 +1651,9 @@ bool Configure::displayHelp()
desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt.");
desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n");
desc("PCRE", "qt", "-qt-pcre", "Use the PCRE library bundled with Qt.");
desc("PCRE", "qt", "-system-pcre", "Use the PCRE library from the operating system.\nSee http://pcre.org/\n");
desc("GIF", "no", "-no-gif", "Do not compile GIF reading support.");
desc("LIBPNG", "no", "-no-libpng", "Do not compile PNG support.");
@ -1857,6 +1868,7 @@ QString Configure::defaultTo(const QString &option)
{
// We prefer using the system version of the 3rd party libs
if (option == "ZLIB"
|| option == "PCRE"
|| option == "LIBJPEG"
|| option == "LIBPNG"
|| option == "LIBTIFF")
@ -1913,6 +1925,9 @@ bool Configure::checkAvailability(const QString &part)
else if (part == "ZLIB")
available = findFile("zlib.h");
else if (part == "PCRE")
available = findFile("pcre.h");
else if (part == "LIBJPEG")
available = findFile("jpeglib.h");
else if (part == "LIBPNG")
@ -2035,6 +2050,10 @@ void Configure::autoDetection()
if (dictionary["ZLIB"] == "auto")
dictionary["ZLIB"] = checkAvailability("ZLIB") ? defaultTo("ZLIB") : "qt";
// PCRE detection
if (dictionary["PCRE"] == "auto")
dictionary["PCRE"] = checkAvailability("PCRE") ? defaultTo("PCRE") : "qt";
// Image format detection
if (dictionary["GIF"] == "auto")
dictionary["GIF"] = defaultTo("GIF");
@ -2251,6 +2270,10 @@ void Configure::generateOutputVars()
else if (dictionary[ "ZLIB" ] == "system")
qtConfig += "system-zlib";
// PCRE ---------------------------------------------------------
if (dictionary[ "PCRE" ] == "qt")
qmakeConfig += "pcre";
// Image formates -----------------------------------------------
if (dictionary[ "GIF" ] == "no")
qtConfig += "no-gif";