[Libreoffice-commits] core.git: config_host/config_liblangtag.h.in configure.ac i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk i18nlangtag/Library_i18nlangtag.mk i18nlangtag/qa i18nlangtag/source
Stephan Bergmann
sbergman at redhat.com
Wed Oct 14 01:16:03 PDT 2015
config_host/config_liblangtag.h.in | 1
configure.ac | 1
i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk | 1
i18nlangtag/Library_i18nlangtag.mk | 1
i18nlangtag/qa/cppunit/test_languagetag.cxx | 17 ++++------------
i18nlangtag/source/languagetag/languagetag.cxx | 2 -
6 files changed, 8 insertions(+), 15 deletions(-)
New commits:
commit 2c975878ff82eb911e488359f7f3fdb7ec104584
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Oct 14 10:14:18 2015 +0200
Pass ENABLE_LIBLANGTAG into code via config_liblangtag.h
...so changes to ENABLE_LIBLANGTAG during configure cause proper recompilation
of source code
Change-Id: I282623c885b83e3bf7d94f6f364c5031c012f058
diff --git a/config_host/config_liblangtag.h.in b/config_host/config_liblangtag.h.in
index f639fb7..18a9c12 100644
--- a/config_host/config_liblangtag.h.in
+++ b/config_host/config_liblangtag.h.in
@@ -1,6 +1,7 @@
#ifndef CONFIG_LIBLANGTAG_H
#define CONFIG_LIBLANGTAG_H
+#define ENABLE_LIBLANGTAG 0
#define LIBLANGTAG_INLINE_FIX 0
#endif
diff --git a/configure.ac b/configure.ac
index e1814ed..5aed6eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11768,6 +11768,7 @@ if test "$enable_liblangtag" = "yes" -o \
LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
fi
fi
+ AC_DEFINE(ENABLE_LIBLANGTAG)
else
AC_MSG_RESULT([no])
fi
diff --git a/i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk b/i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk
index 849d94b..076f59d 100644
--- a/i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk
+++ b/i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk
@@ -29,7 +29,6 @@ $(eval $(call gb_CppunitTest_use_externals,i18nlangtag_test_languagetag,\
liblangtag \
libxml2 \
))
-$(eval $(call gb_CppunitTest_add_defs,i18nlangtag_test_languagetag,-DENABLE_LIBLANGTAG))
ifneq ($(SYSTEM_LIBLANGTAG),)
$(eval $(call gb_CppunitTest_add_defs,i18nlangtag_test_languagetag,-DSYSTEM_LIBLANGTAG))
diff --git a/i18nlangtag/Library_i18nlangtag.mk b/i18nlangtag/Library_i18nlangtag.mk
index 30b6e01..f4935584 100644
--- a/i18nlangtag/Library_i18nlangtag.mk
+++ b/i18nlangtag/Library_i18nlangtag.mk
@@ -36,7 +36,6 @@ $(eval $(call gb_Library_add_exception_objects,i18nlangtag,\
ifeq ($(ENABLE_LIBLANGTAG),TRUE)
-$(eval $(call gb_Library_add_defs,i18nlangtag,-DENABLE_LIBLANGTAG))
$(eval $(call gb_Library_use_external,i18nlangtag,liblangtag))
$(eval $(call gb_Library_use_external,i18nlangtag,libxml2))
$(eval $(call gb_Library_use_system_win32_libs,i18nlangtag,\
diff --git a/i18nlangtag/qa/cppunit/test_languagetag.cxx b/i18nlangtag/qa/cppunit/test_languagetag.cxx
index f93f1df..76ef5a3 100644
--- a/i18nlangtag/qa/cppunit/test_languagetag.cxx
+++ b/i18nlangtag/qa/cppunit/test_languagetag.cxx
@@ -17,6 +17,7 @@
#include <i18nlangtag/mslangid.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <config_liblangtag.h>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <osl/file.hxx>
@@ -25,14 +26,6 @@
using namespace com::sun::star;
-// To test the replacement code add '&& 0' and also in
-// source/languagetag/languagetag.cxx
-#if defined(ENABLE_LIBLANGTAG)
-#define USE_LIBLANGTAG 1
-#else
-#define USE_LIBLANGTAG 0
-#endif
-
namespace {
class TestLanguageTag : public CppUnit::TestFixture
@@ -58,7 +51,7 @@ void TestLanguageTag::testAllTags()
OUString aBcp47 = de_DE.getBcp47();
lang::Locale aLocale = de_DE.getLocale();
LanguageType nLanguageType = de_DE.getLanguageType();
-#if USE_LIBLANGTAG
+#if ENABLE_LIBLANGTAG
CPPUNIT_ASSERT_MESSAGE("Default script should be stripped after canonicalize.", aBcp47 == "de-DE" );
CPPUNIT_ASSERT( aLocale.Language == "de" );
CPPUNIT_ASSERT( aLocale.Country == "DE" );
@@ -87,7 +80,7 @@ void TestLanguageTag::testAllTags()
OUString s_klingon( "i-klingon" );
LanguageTag klingon( s_klingon, true );
lang::Locale aLocale = klingon.getLocale();
-#if USE_LIBLANGTAG
+#if ENABLE_LIBLANGTAG
CPPUNIT_ASSERT( klingon.getBcp47() == "tlh" );
CPPUNIT_ASSERT( aLocale.Language == "tlh" );
CPPUNIT_ASSERT( aLocale.Country.isEmpty() );
@@ -469,7 +462,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT( en_GB_oxendict_Fallbacks[4] == "en");
}
-#if USE_LIBLANGTAG
+#if ENABLE_LIBLANGTAG
// 'zh-yue-HK' uses redundant 'zh-yue' and should be preferred 'yue-HK'
#if 0
/* XXX Disabled because liblangtag in lt_tag_canonicalize() after replacing
@@ -623,7 +616,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "en-US", &aCanonicalized, true) && aCanonicalized == "en-US" );
CPPUNIT_ASSERT( !LanguageTag::isValidBcp47( "x-foobar", &aCanonicalized, true) && aCanonicalized == "x-foobar" );
CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "qaa", &aCanonicalized, true) && aCanonicalized == "qaa" );
-#if USE_LIBLANGTAG
+#if ENABLE_LIBLANGTAG
CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "de-Latn-DE", &aCanonicalized) && aCanonicalized == "de-DE" );
/* TODO: at least some (those we know) grandfathered tags should be
* recognized by the replacement code. */
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index de31afe..0262a367 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -24,7 +24,7 @@
//#define erDEBUG
-#if defined(ENABLE_LIBLANGTAG)
+#if ENABLE_LIBLANGTAG
#if LIBLANGTAG_INLINE_FIX
#define LT_HAVE_INLINE
#endif
More information about the Libreoffice-commits
mailing list