--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2011 - 2012 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the config.tests of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <slog2.h>
+
+int main(int, char **)
+{
+ slog2_set_default_buffer((slog2_buffer_t)-1);
+ return 0;
+}
--- /dev/null
+SOURCES = slog2.cpp
+CONFIG -= qt
+mac:CONFIG -= app_bundle
+LIBS += -lslog2
CFG_JAVASCRIPTCORE_JIT=auto
CFG_PKGCONFIG=auto
CFG_STACK_PROTECTOR_STRONG=auto
+CFG_SLOG2=auto
# Target architecture
CFG_ARCH=
UNKNOWN_OPT=yes
fi
;;
+ slog2)
+ if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+ CFG_SLOG2="$VAL"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ ;;
gstreamer)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_GSTREAMER="$VAL"
fi
+if [ "$XPLATFORM_QNX" = "yes" ]; then
+ cat << EOF
+
+ -no-slog2 .......... Do not compile with slog2 support.
+ -slog2 ............. Compile with slog2 support.
+
+EOF
+
+fi
+
if [ "$BUILD_ON_MAC" = "yes" ]; then
cat << EOF
CFG_ZLIB=auto
ZLIB_FORCED=yes
fi
+
+if [ "$XPLATFORM_QNX" = "yes" ]; then
+ if [ "$CFG_SLOG2" != "no" ]; then
+ if compileTest unix/slog2 "slog2"; then
+ CFG_SLOG2=yes
+ QMAKE_CONFIG="$QMAKE_CONFIG slog2"
+ else
+ CFG_SLOG2=no
+ fi
+ fi
+fi
+
if [ "$CFG_ZLIB" = "auto" ]; then
if compileTest unix/zlib "zlib"; then
CFG_ZLIB=system
echo "Session management ..... $CFG_SM"
echo "libudev support ........ $CFG_LIBUDEV"
+if [ "$XPLATFORM_QNX" = "yes" ]; then
+ echo "SLOG2 support .......... $CFG_SLOG2"
+fi
+
if [ "$CFG_OPENGL" = "desktop" ]; then
echo "OpenGL support ......... yes (Desktop OpenGL)"
elif [ "$CFG_OPENGL" = "es2" ]; then
(cd config.tests/unix/sqlite2 && $(MAKE) distclean); \
(cd config.tests/unix/libjpeg && $(MAKE) distclean); \
(cd config.tests/unix/libpng && $(MAKE) distclean); \
+ (cd config.tests/unix/slog2 && $(MAKE) distclean); \
(cd config.tests/x11/xcursor && $(MAKE) distclean); \
(cd config.tests/x11/xrender && $(MAKE) distclean); \
(cd config.tests/x11/xrandr && $(MAKE) distclean); \
DEFINES += ELF_INTERPRETER=\\\"$$system(readelf -l /bin/ls | perl -n -e \'$$prog\')\\\"
}
+slog2 {
+ LIBS_PRIVATE += -lslog2
+ DEFINES += QT_USE_SLOG2
+}
Calls the message handler with the debug message \a message. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the console, if it is a
- console application; otherwise, it is sent to the debugger. This
- function does nothing if \c QT_NO_DEBUG_OUTPUT was defined
- during compilation.
-
+ console application; otherwise, it is sent to the debugger. On Blackberry the
+ message is sent to slogger2. This function does nothing if \c QT_NO_DEBUG_OUTPUT
+ was defined during compilation.
If you pass the function a format string and a list of arguments,
it works in similar way to the C printf() function. The format
Calls the message handler with the warning message \a message. If no
message handler has been installed, the message is printed to
- stderr. Under Windows, the message is sent to the debugger. This
+ stderr. Under Windows, the message is sent to the debugger.
+ On Blackberry the message is sent to slogger2. This
function does nothing if \c QT_NO_WARNING_OUTPUT was defined
during compilation; it exits if the environment variable \c
QT_FATAL_WARNINGS is defined.
Calls the message handler with the critical message \a message. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the debugger.
+ On Blackberry the message is sent to slogger2.
This function takes a format string and a list of arguments,
similar to the C printf() function. The format should be a Latin-1
Calls the message handler with the fatal message \a message. If no
message handler has been installed, the message is printed to
stderr. Under Windows, the message is sent to the debugger.
+ On Blackberry the message is sent to slogger2.
If you are using the \b{default message handler} this function will
abort on Unix systems to create a core dump. On Windows, for debug builds,
#ifdef Q_OS_WIN
#include <qt_windows.h>
#endif
+#ifdef QT_USE_SLOG2
+#include <slog2.h>
+#endif
#include <stdio.h>
memcpy(literals, literalsVar.constData(), literalsVar.size() * sizeof(const char*));
}
+#if defined(QT_USE_SLOG2)
+#ifndef QT_LOG_CODE
+#define QT_LOG_CODE 9000
+#endif
+
+extern char *__progname;
+
+static void slog2_default_handler(QtMsgType msgType, const char *message)
+{
+ if (slog2_set_default_buffer((slog2_buffer_t)-1) == 0) {
+ slog2_buffer_set_config_t buffer_config;
+ slog2_buffer_t buffer_handle;
+
+ buffer_config.buffer_set_name = __progname;
+ buffer_config.num_buffers = 1;
+ buffer_config.verbosity_level = SLOG2_INFO;
+ buffer_config.buffer_config[0].buffer_name = "default";
+ buffer_config.buffer_config[0].num_pages = 8;
+
+ if (slog2_register(&buffer_config, &buffer_handle, 0) == -1) {
+ fprintf(stderr, "Error registering slogger2 buffer!\n");
+ fprintf(stderr, "%s", message);
+ fflush(stderr);
+ return;
+ }
+
+ // Set as the default buffer
+ slog2_set_default_buffer(buffer_handle);
+ }
+ int severity;
+ //Determines the severity level
+ switch (msgType) {
+ case QtDebugMsg:
+ severity = SLOG2_INFO;
+ break;
+ case QtWarningMsg:
+ severity = SLOG2_NOTICE;
+ break;
+ case QtCriticalMsg:
+ severity = SLOG2_WARNING;
+ break;
+ case QtFatalMsg:
+ severity = SLOG2_ERROR;
+ break;
+ }
+ //writes to the slog2 buffer
+ slog2c(NULL, QT_LOG_CODE, severity, message);
+}
+#endif // QT_USE_SLOG2
+
Q_GLOBAL_STATIC(QMessagePattern, qMessagePattern)
/*!
return;
}
#endif // Q_OS_WIN
+
+#if defined(QT_USE_SLOG2)
+ slog2_default_handler(type, logMessage.toLocal8Bit().constData());
+#else
fprintf(stderr, "%s", logMessage.toLocal8Bit().constData());
fflush(stderr);
+#endif
}
/*!
dictionary[ "QT_ICONV" ] = "auto";
dictionary[ "QT_CUPS" ] = "auto";
dictionary[ "CFG_GCC_SYSROOT" ] = "yes";
+ dictionary[ "SLOG2" ] = "no";
//Only used when cross compiling.
dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg";
dictionary[ "PLUGIN_MANIFESTS" ] = "no";
} else if (configCmdLine.at(i) == "-plugin-manifests") {
dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
+ } else if (configCmdLine.at(i) == "-no-slog2") {
+ dictionary[ "SLOG2" ] = "no";
+ } else if (configCmdLine.at(i) == "-slog2") {
+ dictionary[ "SLOG2" ] = "yes";
}
// Work around compiler nesting limitation
dictionary["DECORATIONS"] = "default windows styled";
} else if ((platform() == QNX) || (platform() == BLACKBERRY)) {
dictionary["STACK_PROTECTOR_STRONG"] = "auto";
+ dictionary["SLOG2"] = "auto";
}
}
desc("FREETYPE", "no", "-no-freetype", "Do not compile in Freetype2 support.");
desc("FREETYPE", "yes", "-qt-freetype", "Use the libfreetype bundled with Qt.");
desc("FREETYPE", "yes", "-system-freetype", "Use the libfreetype provided by the system.");
+
+ if ((platform() == QNX) || (platform() == BLACKBERRY)) {
+ desc("SLOG2", "yes", "-slog2", "Compile with slog2 support.");
+ desc("SLOG2", "no", "-no-slog2", "Do not compile with slog2 support.");
+ }
#endif
// Qt\Windows only options go below here --------------------------------------------------------------------------------
desc("\nQt for Windows only:\n\n");
available = (platform() != WINDOWS) && (platform() != WINDOWS_CE) && tryCompileProject("unix/cups");
} else if (part == "STACK_PROTECTOR_STRONG") {
available = (platform() == QNX || platform() == BLACKBERRY) && compilerSupportsFlag("qcc -fstack-protector-strong");
+ } else if (part == "SLOG2") {
+ available = tryCompileProject("unix/slog2");
}
return available;
if (dictionary["STACK_PROTECTOR_STRONG"] == "auto")
dictionary["STACK_PROTECTOR_STRONG"] = checkAvailability("STACK_PROTECTOR_STRONG") ? "yes" : "no";
+ if ((platform() == QNX || platform() == BLACKBERRY) && dictionary["SLOG2"] == "auto") {
+ dictionary["SLOG2"] = checkAvailability("SLOG2") ? "yes" : "no";
+ }
+
// Mark all unknown "auto" to the default value..
for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) {
if (i.value() == "auto")
if (dictionary["CROSS_COMPILE"] == "yes")
configStream << " cross_compile";
+ if (dictionary[ "SLOG2" ] == "yes")
+ configStream << " slog2";
+
if (dictionary["DIRECTWRITE"] == "yes")
configStream << "directwrite";
sout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl << endl;
sout << " PCRE support............" << dictionary[ "PCRE" ] << endl;
sout << " ICU support............." << dictionary[ "ICU" ] << endl;
+ if ((platform() == QNX) || (platform() == BLACKBERRY))
+ sout << " SLOG2 support..........." << dictionary[ "SLOG2" ] << endl;
sout << "Styles:" << endl;
sout << " Windows................." << dictionary[ "STYLE_WINDOWS" ] << endl;