Kaydet (Commit) 24d59c9e authored tarafından Noel Grandin's avatar Noel Grandin

configure option to disable libnumbertext

Because we get a crash in CppunitTest_sw_odfexport when compiling with
clang >= 6.0.0

Also had to fix the ENABLE_LIBNUMBERTEXT being propogated, and the
way the code checked it.

Change-Id: I68e4a0078016d176f478ca4c1110fc296b6ca921
üst 4d7867c3
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_CONFIG_LIBNUMBERTEXT_H
#define INCLUDED_CONFIG_LIBNUMBERTEXT_H
#define ENABLE_LIBNUMBERTEXT 0
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -1169,6 +1169,10 @@ libo_FUZZ_ARG_ENABLE(ooenv, ...@@ -1169,6 +1169,10 @@ libo_FUZZ_ARG_ENABLE(ooenv,
AS_HELP_STRING([--disable-ooenv], AS_HELP_STRING([--disable-ooenv],
[Disable ooenv for the instdir installation.])) [Disable ooenv for the instdir installation.]))
libo_FUZZ_ARG_ENABLE(libnumbertext,
AS_HELP_STRING([--disable-libnumbertext],
[Disable use of numbertext external library.]))
AC_ARG_ENABLE(lto, AC_ARG_ENABLE(lto,
AS_HELP_STRING([--enable-lto], AS_HELP_STRING([--enable-lto],
[Enable link-time optimization. Suitable for (optimised) product builds. Building might take [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
...@@ -9653,13 +9657,20 @@ AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA) ...@@ -9653,13 +9657,20 @@ AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
dnl =================================================================== dnl ===================================================================
dnl Checking for libnumbertext dnl Checking for libnumbertext
dnl =================================================================== dnl ===================================================================
ENABLE_LIBNUMBERTEXT=TRUE AC_MSG_CHECKING([whether to use libnumbertext])
libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0]) if test "$enable_libnumbertext" = "no"; then
LIBNUMBERTEXT_CFLAGS="$LIBNUMBERTEXT_CFLAGS -DENABLE_LIBNUMBERTEXT" AC_MSG_RESULT([no])
if test "$with_system_libnumbertext" = "yes"; then ENABLE_LIBNUMBERTEXT=
SYSTEM_LIBNUMBERTEXT=
else
AC_MSG_RESULT([yes])
ENABLE_LIBNUMBERTEXT=TRUE
libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
if test "$with_system_libnumbertext" = "yes"; then
SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext` SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
SYSTEM_LIBNUMBERTEXT=YES SYSTEM_LIBNUMBERTEXT=YES
else else
SYSTEM_LIBNUMBERTEXT=
AC_LANG_PUSH([C++]) AC_LANG_PUSH([C++])
save_CXXFLAGS=$CXXFLAGS save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
...@@ -9672,6 +9683,10 @@ else ...@@ -9672,6 +9683,10 @@ else
]) ])
CXXFLAGS=$save_CXXFLAGS CXXFLAGS=$save_CXXFLAGS
AC_LANG_POP([C++]) AC_LANG_POP([C++])
fi
if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
AC_DEFINE(ENABLE_LIBNUMBERTEXT)
fi
fi fi
AC_SUBST(SYSTEM_LIBNUMBERTEXT) AC_SUBST(SYSTEM_LIBNUMBERTEXT)
AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA) AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
...@@ -12732,6 +12747,7 @@ AC_CONFIG_HEADERS([config_host/config_langs.h]) ...@@ -12732,6 +12747,7 @@ AC_CONFIG_HEADERS([config_host/config_langs.h])
AC_CONFIG_HEADERS([config_host/config_lgpl.h]) AC_CONFIG_HEADERS([config_host/config_lgpl.h])
AC_CONFIG_HEADERS([config_host/config_libcxx.h]) AC_CONFIG_HEADERS([config_host/config_libcxx.h])
AC_CONFIG_HEADERS([config_host/config_liblangtag.h]) AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
AC_CONFIG_HEADERS([config_host/config_locales.h]) AC_CONFIG_HEADERS([config_host/config_locales.h])
AC_CONFIG_HEADERS([config_host/config_mpl.h]) AC_CONFIG_HEADERS([config_host/config_mpl.h])
AC_CONFIG_HEADERS([config_host/config_kde4.h]) AC_CONFIG_HEADERS([config_host/config_kde4.h])
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <config_libnumbertext.h>
#include <iostream> #include <iostream>
#include <osl/file.hxx> #include <osl/file.hxx>
...@@ -37,7 +38,7 @@ ...@@ -37,7 +38,7 @@
#include <sal/macros.h> #include <sal/macros.h>
#ifdef ENABLE_LIBNUMBERTEXT #if ENABLE_LIBNUMBERTEXT
#include <Numbertext.hxx> #include <Numbertext.hxx>
#endif #endif
...@@ -67,7 +68,7 @@ static osl::Mutex& GetNumberTextMutex() ...@@ -67,7 +68,7 @@ static osl::Mutex& GetNumberTextMutex()
class NumberText_Impl : public ::cppu::WeakImplHelper<XNumberText, XServiceInfo> class NumberText_Impl : public ::cppu::WeakImplHelper<XNumberText, XServiceInfo>
{ {
#if defined(ENABLE_LIBNUMBERTEXT) || defined(SYSTEM_LIBNUMBERTEXT) #if ENABLE_LIBNUMBERTEXT
Numbertext m_aNumberText; Numbertext m_aNumberText;
#endif #endif
bool m_bInitialized; bool m_bInitialized;
...@@ -114,7 +115,7 @@ void NumberText_Impl::EnsureInitialized() ...@@ -114,7 +115,7 @@ void NumberText_Impl::EnsureInitialized()
#else #else
aPhysPath += "/"; aPhysPath += "/";
#endif #endif
#if defined(ENABLE_LIBNUMBERTEXT) || defined(SYSTEM_LIBNUMBERTEXT) #if ENABLE_LIBNUMBERTEXT
OString path = OUStringToOString(aPhysPath, osl_getThreadTextEncoding()); OString path = OUStringToOString(aPhysPath, osl_getThreadTextEncoding());
m_aNumberText.set_prefix(path.getStr()); m_aNumberText.set_prefix(path.getStr());
#endif #endif
...@@ -122,7 +123,7 @@ void NumberText_Impl::EnsureInitialized() ...@@ -122,7 +123,7 @@ void NumberText_Impl::EnsureInitialized()
} }
OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Locale& OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Locale&
#if defined(ENABLE_LIBNUMBERTEXT) || defined(SYSTEM_LIBNUMBERTEXT) #if ENABLE_LIBNUMBERTEXT
rLocale) rLocale)
#else #else
) )
...@@ -130,7 +131,7 @@ OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Lo ...@@ -130,7 +131,7 @@ OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Lo
{ {
osl::MutexGuard aGuard(GetNumberTextMutex()); osl::MutexGuard aGuard(GetNumberTextMutex());
EnsureInitialized(); EnsureInitialized();
#if defined(ENABLE_LIBNUMBERTEXT) || defined(SYSTEM_LIBNUMBERTEXT) #if ENABLE_LIBNUMBERTEXT
// libnumbertext supports Language + Country tags (separated by "_" or "-") // libnumbertext supports Language + Country tags (separated by "_" or "-")
LanguageTag aLanguageTag(rLocale); LanguageTag aLanguageTag(rLocale);
OUString aCode(aLanguageTag.getLanguage()); OUString aCode(aLanguageTag.getLanguage());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment