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
This commit is contained in:
17
config_host/config_libnumbertext.h.in
Normal file
17
config_host/config_libnumbertext.h.in
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/* -*- 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: */
|
52
configure.ac
52
configure.ac
@@ -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,25 +9657,36 @@ 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_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
|
SYSTEM_LIBNUMBERTEXT=
|
||||||
SYSTEM_LIBNUMBERTEXT=YES
|
|
||||||
else
|
else
|
||||||
AC_LANG_PUSH([C++])
|
AC_MSG_RESULT([yes])
|
||||||
save_CXXFLAGS=$CXXFLAGS
|
ENABLE_LIBNUMBERTEXT=TRUE
|
||||||
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
|
libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
|
||||||
AC_CHECK_HEADERS([codecvt regex])
|
if test "$with_system_libnumbertext" = "yes"; then
|
||||||
AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
|
SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
|
||||||
[ ENABLE_LIBNUMBERTEXT=''
|
SYSTEM_LIBNUMBERTEXT=YES
|
||||||
LIBNUMBERTEXT_CFLAGS=''
|
else
|
||||||
AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
|
SYSTEM_LIBNUMBERTEXT=
|
||||||
Enable libnumbertext fallback (missing number to number name conversion).])
|
AC_LANG_PUSH([C++])
|
||||||
])
|
save_CXXFLAGS=$CXXFLAGS
|
||||||
CXXFLAGS=$save_CXXFLAGS
|
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
|
||||||
AC_LANG_POP([C++])
|
AC_CHECK_HEADERS([codecvt regex])
|
||||||
|
AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
|
||||||
|
[ ENABLE_LIBNUMBERTEXT=''
|
||||||
|
LIBNUMBERTEXT_CFLAGS=''
|
||||||
|
AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
|
||||||
|
Enable libnumbertext fallback (missing number to number name conversion).])
|
||||||
|
])
|
||||||
|
CXXFLAGS=$save_CXXFLAGS
|
||||||
|
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])
|
|||||||
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 @@
|
|||||||
* 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 @@
|
|||||||
|
|
||||||
#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()
|
|||||||
|
|
||||||
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()
|
|||||||
#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()
|
|||||||
}
|
}
|
||||||
|
|
||||||
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
|
|||||||
{
|
{
|
||||||
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());
|
||||||
|
Reference in New Issue
Block a user