Browse Source

Allow to use system QJson. Closes #1744.

adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
4493fd9c31
  1. 132
      configure
  2. 23
      configure.ac
  3. 2
      src/app/application.cpp
  4. 5
      src/webui/jsonutils.h
  5. 7
      src/webui/webui.pri

132
configure vendored

@ -601,6 +601,8 @@ EXPAND_BINDIR
EXPAND_PREFIX EXPAND_PREFIX
zlib_LIBS zlib_LIBS
zlib_CFLAGS zlib_CFLAGS
qjson_LIBS
qjson_CFLAGS
libtorrent_LIBS libtorrent_LIBS
libtorrent_CFLAGS libtorrent_CFLAGS
BOOST_SYSTEM_LIB BOOST_SYSTEM_LIB
@ -716,6 +718,7 @@ with_qt5
with_libtorrent_rasterbar0_16 with_libtorrent_rasterbar0_16
with_geoip_database_embedded with_geoip_database_embedded
with_qtsingleapplication with_qtsingleapplication
with_qjson
enable_debug enable_debug
enable_gui enable_gui
enable_systemd enable_systemd
@ -742,6 +745,8 @@ PKG_CONFIG_LIBDIR
QT_QMAKE QT_QMAKE
libtorrent_CFLAGS libtorrent_CFLAGS
libtorrent_LIBS libtorrent_LIBS
qjson_CFLAGS
qjson_LIBS
zlib_CFLAGS zlib_CFLAGS
zlib_LIBS' zlib_LIBS'
@ -1389,6 +1394,9 @@ Optional Packages:
--with-qtsingleapplication=[system|shipped] --with-qtsingleapplication=[system|shipped]
Use the shipped qtsingleapplication library or the Use the shipped qtsingleapplication library or the
system one (default=shipped) system one (default=shipped)
--with-qjson=[system|shipped]
Use the shipped qjson library or the system one
(default=shipped) (Qt4 only
--with-boost[=ARG] use Boost library from a standard location --with-boost[=ARG] use Boost library from a standard location
(ARG=yes), from the specified location (ARG=<path>), (ARG=yes), from the specified location (ARG=<path>),
or disable it (ARG=no) [ARG=yes] or disable it (ARG=no) [ARG=yes]
@ -1423,6 +1431,9 @@ Some influential environment variables:
C compiler flags for libtorrent, overriding pkg-config C compiler flags for libtorrent, overriding pkg-config
libtorrent_LIBS libtorrent_LIBS
linker flags for libtorrent, overriding pkg-config linker flags for libtorrent, overriding pkg-config
qjson_CFLAGS
C compiler flags for qjson, overriding pkg-config
qjson_LIBS linker flags for qjson, overriding pkg-config
zlib_CFLAGS C compiler flags for zlib, overriding pkg-config zlib_CFLAGS C compiler flags for zlib, overriding pkg-config
zlib_LIBS linker flags for zlib, overriding pkg-config zlib_LIBS linker flags for zlib, overriding pkg-config
@ -4200,6 +4211,15 @@ else
fi fi
# Check whether --with-qjson was given.
if test "${with_qjson+set}" = set; then :
withval=$with_qjson;
else
with_qjson=shipped
fi
# Check whether --enable-debug was given. # Check whether --enable-debug was given.
if test "${enable_debug+set}" = set; then : if test "${enable_debug+set}" = set; then :
enableval=$enable_debug; enableval=$enable_debug;
@ -5507,6 +5527,118 @@ $as_echo "$with_qtsingleapplication" >&6; }
as_fn_error $? "Unknown option \"$with_qtsingleapplication\". Use either \"system\" or \"shipped\"." "$LINENO" 5 ;; as_fn_error $? "Unknown option \"$with_qtsingleapplication\". Use either \"system\" or \"shipped\"." "$LINENO" 5 ;;
esac esac
if test "x$with_qt5" = "xno"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which qjson to use" >&5
$as_echo_n "checking which qjson to use... " >&6; }
case "x$with_qjson" in #(
"xshipped") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: shipped" >&5
$as_echo "shipped" >&6; }
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG usesystemqjson" ;; #(
"xsystem") :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: system" >&5
$as_echo "system" >&6; }
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for qjson" >&5
$as_echo_n "checking for qjson... " >&6; }
if test -n "$qjson_CFLAGS"; then
pkg_cv_qjson_CFLAGS="$qjson_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"QJson >= 0.8.1\""; } >&5
($PKG_CONFIG --exists --print-errors "QJson >= 0.8.1") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_qjson_CFLAGS=`$PKG_CONFIG --cflags "QJson >= 0.8.1" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$qjson_LIBS"; then
pkg_cv_qjson_LIBS="$qjson_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"QJson >= 0.8.1\""; } >&5
($PKG_CONFIG --exists --print-errors "QJson >= 0.8.1") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_qjson_LIBS=`$PKG_CONFIG --libs "QJson >= 0.8.1" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
qjson_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "QJson >= 0.8.1" 2>&1`
else
qjson_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "QJson >= 0.8.1" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$qjson_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (QJson >= 0.8.1) were not met:
$qjson_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables qjson_CFLAGS
and qjson_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables qjson_CFLAGS
and qjson_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
qjson_CFLAGS=$pkg_cv_qjson_CFLAGS
qjson_LIBS=$pkg_cv_qjson_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CPPFLAGS="$qjson_CFLAGS $CPPFLAGS"
LIBS="$qjson_LIBS $LIBS"
fi
QBT_ADD_CONFIG="$QBT_ADD_CONFIG usesystemqjson" ;; #(
*) :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_qjson" >&5
$as_echo "$with_qjson" >&6; }
as_fn_error $? "Unknown option \"$with_qjson\". Use either \"system\" or \"shipped\"." "$LINENO" 5 ;;
esac
fi
pkg_failed=no pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib" >&5

23
configure.ac

@ -36,6 +36,12 @@ AC_ARG_WITH(qtsingleapplication,
[], [],
[with_qtsingleapplication=shipped]) [with_qtsingleapplication=shipped])
AC_ARG_WITH(qjson,
[AS_HELP_STRING([--with-qjson=@<:@system|shipped@:>@],
[Use the shipped qjson library or the system one (default=shipped) (Qt4 only])],
[],
[with_qjson=shipped])
AC_ARG_ENABLE(debug, AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug], [AS_HELP_STRING([--enable-debug],
[Enable debug build])], [Enable debug build])],
@ -214,6 +220,23 @@ AS_CASE(["x$with_qtsingleapplication"],
[AC_MSG_RESULT([$with_qtsingleapplication]) [AC_MSG_RESULT([$with_qtsingleapplication])
AC_MSG_ERROR([Unknown option "$with_qtsingleapplication". Use either "system" or "shipped".])]) AC_MSG_ERROR([Unknown option "$with_qtsingleapplication". Use either "system" or "shipped".])])
AS_IF([test "x$with_qt5" = "xno"],
[AC_MSG_CHECKING([which qjson to use])
AS_CASE(["x$with_qjson"],
["xshipped"],
[AC_MSG_RESULT([shipped])
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG usesystemqjson"],
["xsystem"],
[AC_MSG_RESULT([system])
PKG_CHECK_MODULES(qjson,
[QJson >= 0.8.1],
[CPPFLAGS="$qjson_CFLAGS $CPPFLAGS"
LIBS="$qjson_LIBS $LIBS"])
QBT_ADD_CONFIG="$QBT_ADD_CONFIG usesystemqjson"],
[AC_MSG_RESULT([$with_qjson])
AC_MSG_ERROR([Unknown option "$with_qjson". Use either "system" or "shipped".])])
])
PKG_CHECK_MODULES(zlib, PKG_CHECK_MODULES(zlib,
[zlib], [zlib],
[CPPFLAGS="$zlib_CFLAGS $CPPFLAGS" [CPPFLAGS="$zlib_CFLAGS $CPPFLAGS"

2
src/app/application.cpp

@ -50,7 +50,7 @@
#endif // DISABLE_GUI #endif // DISABLE_GUI
#ifndef DISABLE_WEBUI #ifndef DISABLE_WEBUI
#include "webui.h" #include "../webui/webui.h"
#endif #endif
#include "application.h" #include "application.h"

5
src/webui/jsonutils.h

@ -36,8 +36,13 @@
#include <QJsonArray> #include <QJsonArray>
#else #else
#include <QString> #include <QString>
#ifndef USE_SYSTEM_QJSON
#include "qjson/parser.h" #include "qjson/parser.h"
#include "qjson/serializer.h" #include "qjson/serializer.h"
#else // USE_SYSTEM_QJSON
#include <qjson/parser.h>
#include <qjson/serializer.h>
#endif // USE_SYSTEM_QJSON
#endif #endif
namespace json { namespace json {

7
src/webui/webui.pri

@ -1,5 +1,3 @@
INCLUDEPATH += $$PWD
HEADERS += \ HEADERS += \
$$PWD/webui.h \ $$PWD/webui.h \
$$PWD/btjson.h \ $$PWD/btjson.h \
@ -20,6 +18,9 @@ SOURCES += \
$$PWD/abstractwebapplication.cpp $$PWD/abstractwebapplication.cpp
# QJson JSON parser/serializer for using with Qt4 # QJson JSON parser/serializer for using with Qt4
lessThan(QT_MAJOR_VERSION, 5): include(qjson/qjson.pri) lessThan(QT_MAJOR_VERSION, 5) {
!usesystemqjson: include(qjson/qjson.pri)
else: DEFINES += USE_SYSTEM_QJSON
}
RESOURCES += $$PWD/webui.qrc RESOURCES += $$PWD/webui.qrc

Loading…
Cancel
Save