Browse Source

Merge pull request #175 from dryabov/master

an attempt to fix issue #111 of twister-html
miguelfreitas
miguelfreitas 11 years ago
parent
commit
f38b97ddf3
  1. 2
      Makefile.am
  2. 2
      configure.ac
  3. 118
      m4/ax_boost_locale.m4
  4. 3
      src/init.cpp
  5. 1
      src/makefile.android
  6. 1
      src/makefile.linux-mingw
  7. 1
      src/makefile.mingw
  8. 1
      src/makefile.osx
  9. 1
      src/makefile.osx-bitcoin
  10. 1
      src/makefile.unix
  11. 5
      src/twister.cpp
  12. 2
      twister-qt.pro

2
Makefile.am

@ -171,7 +171,7 @@ twisterd_LDFLAGS = @OPENSSL_LDFLAGS@ @DB_CXX_LDFLAGS@
twisterd_DEPENDENCIES = $(LEVELDB_LIB) twisterd_DEPENDENCIES = $(LEVELDB_LIB)
twisterd_LDADD = $(LEVELDB_LIB) $(UPNP_LIB) \ twisterd_LDADD = $(LEVELDB_LIB) $(UPNP_LIB) \
@BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_PROGRAM_OPTIONS_LIB@ @BOOST_THREAD_LIB@ @BOOST_CHRONO_LIB@ \ @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_PROGRAM_OPTIONS_LIB@ @BOOST_THREAD_LIB@ @BOOST_CHRONO_LIB@ @BOOST_LOCALE_LIB@ \
@DB_CXX_LIBS@ @OPENSSL_LIBS@ @DB_CXX_LIBS@ @OPENSSL_LIBS@
AM_CPPFLAGS = -ftemplate-depth-100 -DBOOST_SPIRIT_THREADSAFE -D_FILE_OFFSET_BITS=64 \ AM_CPPFLAGS = -ftemplate-depth-100 -DBOOST_SPIRIT_THREADSAFE -D_FILE_OFFSET_BITS=64 \

2
configure.ac

@ -91,6 +91,7 @@ AX_BOOST_FILESYSTEM()
AX_BOOST_PROGRAM_OPTIONS() AX_BOOST_PROGRAM_OPTIONS()
AX_BOOST_THREAD() AX_BOOST_THREAD()
AX_BOOST_CHRONO() AX_BOOST_CHRONO()
AX_BOOST_LOCALE()
############################################################################### ###############################################################################
# Checking for Berkeley DB C++ # Checking for Berkeley DB C++
@ -771,6 +772,7 @@ Boost libraries:
boost.filesystem: ${BOOST_FILESYSTEM_LIB} boost.filesystem: ${BOOST_FILESYSTEM_LIB}
boost.program_opts: ${BOOST_PROGRAM_OPTIONS_LIB} boost.program_opts: ${BOOST_PROGRAM_OPTIONS_LIB}
boost.thread: ${BOOST_THREAD_LIB} boost.thread: ${BOOST_THREAD_LIB}
boost.locale: ${BOOST_LOCALE_LIB}
Berkeley DB C++ library: Berkeley DB C++ library:
header: ${DB_CXX_HEADER} header: ${DB_CXX_HEADER}

118
m4/ax_boost_locale.m4

@ -0,0 +1,118 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_locale.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_LOCALE
#
# DESCRIPTION
#
# Test for System library from the Boost C++ libraries. The macro requires
# a preceding call to AX_BOOST_BASE. Further documentation is available at
# <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_LOCALE_LIB)
#
# And sets:
#
# HAVE_BOOST_LOCALE
#
# LICENSE
#
# Copyright (c) 2012 Xiyue Deng <manphiz@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 1
AC_DEFUN([AX_BOOST_LOCALE],
[
AC_ARG_WITH([boost-locale],
AS_HELP_STRING([--with-boost-locale@<:@=special-lib@:>@],
[use the Locale library from boost - it is possible to specify a certain library for the linker
e.g. --with-boost-locale=boost_locale-gcc-mt ]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ax_boost_user_locale_lib=""
else
want_boost="yes"
ax_boost_user_locale_lib="$withval"
fi
],
[want_boost="yes"]
)
if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_BUILD])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_CACHE_CHECK(whether the Boost::Locale library is available,
ax_cv_boost_locale,
[AC_LANG_PUSH([C++])
CXXFLAGS_SAVE=$CXXFLAGS
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/locale/generator.hpp>]],
[[boost::locale::generator gen;]])],
ax_cv_boost_locale=yes, ax_cv_boost_locale=no)
CXXFLAGS=$CXXFLAGS_SAVE
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_locale" = "xyes"; then
AC_SUBST(BOOST_CPPFLAGS)
AC_DEFINE(HAVE_BOOST_LOCALE,,[define if the Boost::Locale library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
LDFLAGS_SAVE=$LDFLAGS
if test "x$ax_boost_user_locale_lib" = "x"; then
for libextension in `ls $BOOSTLIBDIR/libboost_locale*.so* $BOOSTLIBDIR/libboost_locale*.dylib* $BOOSTLIBDIR/libboost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_locale.*\)\.so.*$;\1;' -e 's;^lib\(boost_locale.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_locale.*\)\.a.*$;\1;'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
[link_locale="no"])
done
if test "x$link_locale" != "xyes"; then
for libextension in `ls $BOOSTLIBDIR/boost_locale*.dll* $BOOSTLIBDIR/boost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_locale.*\)\.dll.*$;\1;' -e 's;^\(boost_locale.*\)\.a.*$;\1;'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
[link_locale="no"])
done
fi
else
for ax_lib in $ax_boost_user_locale_lib boost_locale-$ax_boost_user_locale_lib; do
AC_CHECK_LIB($ax_lib, exit,
[BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
[link_locale="no"])
done
fi
if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the library!)
fi
if test "x$link_locale" = "xno"; then
AC_MSG_ERROR(Could not link against $ax_lib !)
fi
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])

3
src/init.cpp

@ -22,6 +22,8 @@
#include <boost/filesystem/convenience.hpp> #include <boost/filesystem/convenience.hpp>
#include <boost/interprocess/sync/file_lock.hpp> #include <boost/interprocess/sync/file_lock.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/locale.hpp>
#include <boost/locale/generator.hpp>
#include <openssl/crypto.h> #include <openssl/crypto.h>
#ifndef WIN32 #ifndef WIN32
@ -399,6 +401,7 @@ bool AppInit2(boost::thread_group& threadGroup)
#endif #endif
#endif #endif
#endif #endif
std::locale::global(boost::locale::generator().generate(""));
// ********************************************************* Step 2: parameter interactions // ********************************************************* Step 2: parameter interactions

1
src/makefile.android

@ -174,6 +174,7 @@ LIBS += \
-l boost_filesystem$(BOOST_LIB_SUFFIX) \ -l boost_filesystem$(BOOST_LIB_SUFFIX) \
-l boost_program_options$(BOOST_LIB_SUFFIX) \ -l boost_program_options$(BOOST_LIB_SUFFIX) \
-l boost_thread$(BOOST_LIB_SUFFIX) \ -l boost_thread$(BOOST_LIB_SUFFIX) \
-l boost_locale$(BOOST_LIB_SUFFIX) \
-l db_cxx$(BDB_LIB_SUFFIX) \ -l db_cxx$(BDB_LIB_SUFFIX) \
-L$(NDK_BASE)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/ -lgnustl_static -L$(NDK_BASE)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/ -lgnustl_static
#-l ssl_static -l crypto_static #-l ssl_static -l crypto_static

1
src/makefile.linux-mingw

@ -30,6 +30,7 @@ LIBS= \
-l boost_program_options-mt-s \ -l boost_program_options-mt-s \
-l boost_thread_win32-mt-s \ -l boost_thread_win32-mt-s \
-l boost_chrono-mt-s \ -l boost_chrono-mt-s \
-l boost_locale-mt-s \
-l db_cxx \ -l db_cxx \
-l ssl \ -l ssl \
-l crypto -l crypto

1
src/makefile.mingw

@ -39,6 +39,7 @@ LIBS= \
-l boost_program_options$(BOOST_SUFFIX) \ -l boost_program_options$(BOOST_SUFFIX) \
-l boost_thread$(BOOST_SUFFIX) \ -l boost_thread$(BOOST_SUFFIX) \
-l boost_chrono$(BOOST_SUFFIX) \ -l boost_chrono$(BOOST_SUFFIX) \
-l boost_locale$(BOOST_SUFFIX) \
-l db_cxx \ -l db_cxx \
-l ssl \ -l ssl \
-l crypto -l crypto

1
src/makefile.osx vendored

@ -37,6 +37,7 @@ LIBS += \
-l boost_filesystem$(BOOST_LIB_SUFFIX) \ -l boost_filesystem$(BOOST_LIB_SUFFIX) \
-l boost_program_options$(BOOST_LIB_SUFFIX) \ -l boost_program_options$(BOOST_LIB_SUFFIX) \
-l boost_thread$(BOOST_LIB_SUFFIX) \ -l boost_thread$(BOOST_LIB_SUFFIX) \
-l boost_locale$(BOOST_LIB_SUFFIX) \
-l db_cxx$(BDB_LIB_SUFFIX) \ -l db_cxx$(BDB_LIB_SUFFIX) \
-l ssl \ -l ssl \
-l crypto -l crypto

1
src/makefile.osx-bitcoin

@ -50,6 +50,7 @@ LIBS += \
-lboost_program_options-mt \ -lboost_program_options-mt \
-lboost_thread-mt \ -lboost_thread-mt \
-lboost_chrono-mt \ -lboost_chrono-mt \
-lboost_locale-mt \
-lssl \ -lssl \
-lcrypto \ -lcrypto \
-lz -lz

1
src/makefile.unix

@ -38,6 +38,7 @@ LIBS += \
-l boost_filesystem$(BOOST_LIB_SUFFIX) \ -l boost_filesystem$(BOOST_LIB_SUFFIX) \
-l boost_program_options$(BOOST_LIB_SUFFIX) \ -l boost_program_options$(BOOST_LIB_SUFFIX) \
-l boost_thread$(BOOST_LIB_SUFFIX) \ -l boost_thread$(BOOST_LIB_SUFFIX) \
-l boost_locale$(BOOST_LIB_SUFFIX) \
-l db_cxx$(BDB_LIB_SUFFIX) \ -l db_cxx$(BDB_LIB_SUFFIX) \
-l ssl \ -l ssl \
-l crypto \ -l crypto \

5
src/twister.cpp

@ -13,6 +13,7 @@ using namespace json_spirit;
using namespace std; using namespace std;
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/locale.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
@ -1226,7 +1227,7 @@ void updateSeenHashtags(std::string &message, int64_t msgTime)
BOOST_FOREACH(string const& token, tokens) { BOOST_FOREACH(string const& token, tokens) {
if( token.length() >= 2 ) { if( token.length() >= 2 ) {
string word = token.substr(1); string word = token.substr(1);
boost::algorithm::to_lower(word); word = boost::locale::to_lower(word);
if( token.at(0) == '#') { if( token.at(0) == '#') {
hashtags.insert(word); hashtags.insert(word);
} }
@ -1489,7 +1490,7 @@ Value newpostmsg(const Array& params, bool fHelp)
BOOST_FOREACH(string const& token, tokens) { BOOST_FOREACH(string const& token, tokens) {
if( token.length() >= 2 ) { if( token.length() >= 2 ) {
string word = token.substr(1); string word = token.substr(1);
boost::algorithm::to_lower(word); word = boost::locale::to_lower(word);
if( token.at(0) == '#') { if( token.at(0) == '#') {
ses->dht_putData(word, "hashtag", true, ses->dht_putData(word, "hashtag", true,
v, strUsername, GetAdjustedTime(), 0); v, strUsername, GetAdjustedTime(), 0);

2
twister-qt.pro

@ -453,7 +453,7 @@ LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB
LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX
# -lgdi32 has to happen after -lcrypto (see #681) # -lgdi32 has to happen after -lcrypto (see #681)
win32:LIBS += -lws2_32 -lshlwapi -lmswsock -lole32 -loleaut32 -luuid -lgdi32 win32:LIBS += -lws2_32 -lshlwapi -lmswsock -lole32 -loleaut32 -luuid -lgdi32
LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX -lboost_locale$$BOOST_THREAD_LIB_SUFFIX
win32:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX win32:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX
macx:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX macx:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX

Loading…
Cancel
Save