Am Freitag, 6. Mai 2011 schrieb Jean-Marc Lasgouttes: > Le 06/05/11 17:50, Kornel a écrit : > > But it is your work. It would be disingenuous. > > > > I will prepare a patch, but you should commit. > > Seriously, it is more important for me to have all the cmake code > passing through your hands. > > JMarc
Thanks Jean-Marc. Will check now, if the defines in config.h.cmake don't break compilation for external libintl. ... Looks good. Lyx behaves ok ... Ataching the patch. Kornel
Index: development/cmake/src/CMakeLists.txt =================================================================== --- development/cmake/src/CMakeLists.txt (Revision 38598) +++ development/cmake/src/CMakeLists.txt (Arbeitskopie) @@ -122,11 +122,14 @@ 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() Index: development/cmake/intl/CMakeLists.txt =================================================================== --- development/cmake/intl/CMakeLists.txt (Revision 38598) +++ development/cmake/intl/CMakeLists.txt (Arbeitskopie) @@ -38,32 +38,8 @@ 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) Index: development/cmake/config.h.cmake =================================================================== --- development/cmake/config.h.cmake (Revision 38598) +++ development/cmake/config.h.cmake (Arbeitskopie) @@ -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 send 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 Index: development/cmake/CMakeLists.txt =================================================================== --- development/cmake/CMakeLists.txt (Revision 38598) +++ development/cmake/CMakeLists.txt (Arbeitskopie) @@ -314,7 +314,11 @@ 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) Index: development/autotests/run-tests.sh =================================================================== --- development/autotests/run-tests.sh (Revision 38598) +++ development/autotests/run-tests.sh (Arbeitskopie) @@ -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}; Index: src/LyX.cpp =================================================================== --- src/LyX.cpp (Revision 38598) +++ src/LyX.cpp (Arbeitskopie) @@ -292,10 +292,11 @@ 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" Index: src/support/gettext.cpp =================================================================== --- src/support/gettext.cpp (Revision 38598) +++ src/support/gettext.cpp (Arbeitskopie) @@ -38,9 +38,7 @@ setlocale(LC_MESSAGES, ""); # endif setlocale(LC_CTYPE, ""); - if (support::packageInitialized()) { - Messages::init(); - } + Messages::init(); #endif setlocale(LC_NUMERIC, "C"); } Index: src/support/Package.h =================================================================== --- src/support/Package.h (Revision 38598) +++ src/support/Package.h (Arbeitskopie) @@ -52,8 +52,6 @@ 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. */ Index: src/support/Messages.cpp =================================================================== --- src/support/Messages.cpp (Revision 38598) +++ src/support/Messages.cpp (Arbeitskopie) @@ -64,7 +64,7 @@ # 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; Index: src/support/Package.cpp =================================================================== --- src/support/Package.cpp (Revision 38598) +++ src/support/Package.cpp (Arbeitskopie) @@ -65,12 +65,6 @@ } -bool packageInitialized() -{ - return initialised_; -} - - Package const & package() { LASSERT(initialised_, /**/); Index: src/client/Messages.cpp =================================================================== --- src/client/Messages.cpp (Revision 38598) +++ src/client/Messages.cpp (Arbeitskopie) @@ -77,7 +77,7 @@ # 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.