1.) Corrected internal compilation for Libintl

2.) Changed cmake-files accordingly
Patch from Jean-Marc Lasgouttes


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38606 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Kornel Benko 2011-05-06 19:24:54 +00:00
parent b65d0c087b
commit 45b61c6ecf
11 changed files with 56 additions and 47 deletions

View File

@ -4,7 +4,7 @@
# Tests are identified as having a file name of *-in.txt
# For failed tests, the collected output is kept in the corresponding folder
export LYX_EXE=../../../src/lyx
#export LYX_EXE=../../../src/lyx
if [ "$XVKBD_HACKED" != "" ]; then
export XVKBD_EXE=${XVKBD:-./xvkbd/xvkbd};

View File

@ -314,7 +314,11 @@ if(LYX_EXTERNAL_LIBINTL)
find_package(Libintl REQUIRED)
add_definitions(-DHAVE_GETTEXT) #TODO move to config.h
else()
add_subdirectory(intl)
if(LYX_NLS)
add_subdirectory(intl)
else()
# do not compile if nls disabled
endif()
endif()
if(LYX_EXTERNAL_BOOST)

View File

@ -13,9 +13,9 @@
#define _CONFIG_H
// obligatory flags
#define QT_NO_STL
#define QT_NO_KEYWORDS
#define HAVE_ICONV
#define QT_NO_STL 1
#define QT_NO_KEYWORDS 1
#define HAVE_ICONV 1
#include "configCompiler.h"
@ -75,7 +75,42 @@
#cmakedefine LYX_NLS 1
#ifdef LYX_NLS
#define ENABLE_NLS
#define ENABLE_NLS 1
// These are needed when building included gettext (taken from autoconf macro)
#cmakedefine LYX_EXTERNAL_LIBINTL 1
#if !defined(LYX_EXTERNAL_LIBINTL)
// this only makes sense when LYX_EXTERNAL_LIBINTL is OFF.
#define __libc_lock_t gl_lock_t
#define __libc_lock_define gl_lock_define
#define __libc_lock_define_initialized gl_lock_define_initialized
#define __libc_lock_init gl_lock_init
#define __libc_lock_lock gl_lock_lock
#define __libc_lock_unlock gl_lock_unlock
#define __libc_lock_recursive_t gl_recursive_lock_t
#define __libc_lock_define_recursive gl_recursive_lock_define
#define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized
#define __libc_lock_init_recursive gl_recursive_lock_init
#define __libc_lock_lock_recursive gl_recursive_lock_lock
#define __libc_lock_unlock_recursive gl_recursive_lock_unlock
#define glthread_in_use libintl_thread_in_use
#define glthread_lock_init libintl_lock_init
#define glthread_lock_lock libintl_lock_lock
#define glthread_lock_unlock libintl_lock_unlock
#define glthread_lock_destroy libintl_lock_destroy
#define glthread_rwlock_init libintl_rwlock_init
#define glthread_rwlock_rdlock libintl_rwlock_rdlock
#define glthread_rwlock_wrlock libintl_rwlock_wrlock
#define glthread_rwlock_unlock libintl_rwlock_unlock
#define glthread_rwlock_destroy libintl_rwlock_destroy
#define glthread_recursive_lock_init libintl_recursive_lock_init
#define glthread_recursive_lock_lock libintl_recursive_lock_lock
#define glthread_recursive_lock_unlock libintl_recursive_lock_unlock
#define glthread_recursive_lock_destroy libintl_recursive_lock_destroy
#define glthread_once libintl_once
#define glthread_once_call libintl_once_call
#define glthread_once_singlethreaded libintl_once_singlethreaded
#define hash_string libintl_hash_string
#endif /* LYX_EXTERNAL_LIBINTL */
#endif

View File

@ -38,32 +38,8 @@ endif()
file(GLOB intl_headers ${TOP_SRC_DIR}/intl/*.h)
set(intl_sources
bindtextdom.c
dcgettext.c
dgettext.c
gettext.c
finddomain.c
loadmsgcat.c
localealias.c
textdomain.c
l10nflist.c
explodename.c
dcigettext.c
dcngettext.c
dngettext.c
ngettext.c
plural.c
plural-exp.c
localcharset.c
relocatable.c
localename.c
log.c
printf.c
osdep.c
intl-compat.c
langprefs.c
)
file(GLOB intl_sources RELATIVE "${TOP_SRC_DIR}/intl" "${TOP_SRC_DIR}/intl/*.c")
list(REMOVE_ITEM intl_sources vasnprintf.c version.c printf-parse.c os2compat.c)
lyx_add_path(intl_sources ${TOP_SRC_DIR}/intl)

View File

@ -122,11 +122,14 @@ target_link_libraries(${_lyx}
frontend_qt4
graphics
support
${LIBINTL_LIBRARIES}
${ICONV_LIBRARY}
${QT_QTMAIN_LIBRARY}
${vld_dll})
if(NOT LYX_EXTERNAL_LIBINTL)
target_link_libraries(${_lyx} intl)
endif()
if(HUNSPELL_FOUND)
target_link_libraries(${_lyx} ${HUNSPELL_LIBRARY})
endif()

View File

@ -292,10 +292,11 @@ int LyX::exec(int & argc, char * argv[])
try {
init_package(os::utf8_argv(0), string(), string(),
top_build_dir_is_one_level_up);
// we do not get to this point when init_package throws an exception
locale_init();
} catch (ExceptionMessage const & message) {
LYXERR(Debug::LOCALE, message.title_ + ", " + message.details_);
}
locale_init();
// Here we need to parse the command line. At least
// we need to parse for "-dbg" and "-help"

View File

@ -77,7 +77,7 @@ private:
# if HAVE_GETTEXT
# include <libintl.h> // use the header already in the system *EK*
# else
# include "../../intl/libintl.h"
# include "intl/libintl.h"
# endif
// This is a more traditional variant.

View File

@ -64,7 +64,7 @@ void cleanTranslation(docstring & trans)
# if HAVE_GETTEXT
# include <libintl.h> // use the header already in the system *EK*
# else
# include "../../intl/libintl.h"
# include "intl/libintl.h"
# endif
using namespace lyx::support;

View File

@ -65,12 +65,6 @@ void init_package(string const & command_line_arg0,
}
bool packageInitialized()
{
return initialised_;
}
Package const & package()
{
LASSERT(initialised_, /**/);

View File

@ -52,8 +52,6 @@ void init_package(std::string const & command_line_arg0,
std::string const & command_line_user_support_dir,
exe_build_dir_to_top_build_dir);
bool packageInitialized();
/** Accessor to the global data.
* Asserts that init_package() has been called first.
*/

View File

@ -38,9 +38,7 @@ void locale_init()
setlocale(LC_MESSAGES, "");
# endif
setlocale(LC_CTYPE, "");
if (support::packageInitialized()) {
Messages::init();
}
Messages::init();
#endif
setlocale(LC_NUMERIC, "C");
}