1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

core: make libintl.h required if CMake option ENABLE_NLS is enabled (issue #2031)

This commit is contained in:
Sébastien Helleu
2023-10-15 14:58:26 +02:00
parent 753a2adffc
commit 3184bb92e6
6 changed files with 28 additions and 31 deletions
+2 -4
View File
@@ -246,10 +246,8 @@ add_subdirectory(icons)
if(ENABLE_NLS)
find_package(Gettext REQUIRED)
add_definitions(-DENABLE_NLS)
find_package(Intl)
if(Intl_FOUND)
list(APPEND EXTRA_LIBS "${Intl_LIBRARIES}")
endif()
find_package(Intl REQUIRED)
list(APPEND EXTRA_LIBS "${Intl_LIBRARIES}")
add_subdirectory(po)
else()
add_custom_target(translations COMMAND true)
+1 -1
View File
@@ -21,7 +21,7 @@ Bug fixes::
Build::
* core: fix build error if CMake option ENABLE_NLS is turned to off or if required dependencies are not found (issue #2026)
* core: fix build error if CMake option ENABLE_NLS is turned to off or if required dependencies are not found (issue #2026, issue #2031)
[[v4.0.5]]
== Version 4.0.5 (2023-09-24)
+22 -20
View File
@@ -45,26 +45,28 @@ set(CMAKE_REQUIRED_INCLUDES ${LIBINTL_INCLUDE})
check_include_files(libintl.h HAVE_LIBINTL_H)
if(HAVE_LIBINTL_H)
check_function_exists(dgettext LIBC_HAS_DGETTEXT)
if(LIBC_HAS_DGETTEXT)
set(GETTEXT_FOUND TRUE)
else()
find_library(LIBINTL_LIBRARY NAMES intl
PATHS
/usr/local/lib
/usr/lib
)
if(LIBINTL_LIBRARY)
if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
set(CMAKE_REQUIRED_LIBRARIES "iconv")
check_library_exists(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT)
else()
check_library_exists(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT)
endif()
if(LIBINTL_HAS_DGETTEXT)
set(GETTEXT_FOUND TRUE)
endif()
if(NOT HAVE_LIBINTL_H)
message(SEND_ERROR "Header libintl.h not found, required if ENABLE_NLS is enabled")
endif()
check_function_exists(dgettext LIBC_HAS_DGETTEXT)
if(LIBC_HAS_DGETTEXT)
set(GETTEXT_FOUND TRUE)
else()
find_library(LIBINTL_LIBRARY NAMES intl
PATHS
/usr/local/lib
/usr/lib
)
if(LIBINTL_LIBRARY)
if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
set(CMAKE_REQUIRED_LIBRARIES "iconv")
check_library_exists(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT)
else()
check_library_exists(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT)
endif()
if(LIBINTL_HAS_DGETTEXT)
set(GETTEXT_FOUND TRUE)
endif()
endif()
endif()
-1
View File
@@ -1,4 +1,3 @@
#cmakedefine HAVE_LIBINTL_H
#cmakedefine HAVE_SYS_RESOURCE_H
#cmakedefine HAVE_FLOCK
#cmakedefine HAVE_LANGINFO_CODESET
+2
View File
@@ -1662,9 +1662,11 @@ doc_generate (const char *path)
* (this is used to generate documentation without installing WeeChat,
* that means no need to run `make install`)
*/
#ifdef ENABLE_NLS
localedir = getenv ("WEECHAT_DOCGEN_LOCALEDIR");
if (localedir && localedir[0])
bindtextdomain (PACKAGE, localedir);
#endif /* ENABLE_NLS */
for (i = 0; locales[i]; i++)
{
+1 -5
View File
@@ -33,11 +33,7 @@
#include <locale.h>
#if defined(ENABLE_NLS) && !defined(_)
#ifdef HAVE_LIBINTL_H
#include <libintl.h>
#else
#include "../../intl/libintl.h"
#endif /* HAVE_LIBINTL_H */
#include <libintl.h>
#define _(string) gettext(string)
#define NG_(single,plural,number) ngettext(single,plural,number)
#ifdef gettext_noop