summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--ChangeLog.adoc7
-rw-r--r--cmake/FindGettext.cmake42
-rw-r--r--config.h.cmake1
-rw-r--r--src/core/wee-doc.c2
-rw-r--r--src/core/weechat.h6
6 files changed, 34 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b3fad3bb0..7c1a125e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -250,10 +250,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)
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 44a23f49b..93db8442d 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -10,6 +10,13 @@ This document lists all the changes for each version. +
For a list of important changes that require manual actions, please look at release notes.
+[[v4.2.0]]
+== Version 4.2.0 (under dev)
+
+Build::
+
+ * core: make libintl.h required if CMake option ENABLE_NLS is enabled (issue #2031)
+
[[v4.1.0]]
== Version 4.1.0 (2023-10-15)
diff --git a/cmake/FindGettext.cmake b/cmake/FindGettext.cmake
index 358734688..2460e190b 100644
--- a/cmake/FindGettext.cmake
+++ b/cmake/FindGettext.cmake
@@ -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()
diff --git a/config.h.cmake b/config.h.cmake
index 462dcf36c..a9010448d 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -1,4 +1,3 @@
-#cmakedefine HAVE_LIBINTL_H
#cmakedefine HAVE_SYS_RESOURCE_H
#cmakedefine HAVE_FLOCK
#cmakedefine HAVE_LANGINFO_CODESET
diff --git a/src/core/wee-doc.c b/src/core/wee-doc.c
index 51fe5fa8f..942a41a03 100644
--- a/src/core/wee-doc.c
+++ b/src/core/wee-doc.c
@@ -1658,9 +1658,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++)
{
diff --git a/src/core/weechat.h b/src/core/weechat.h
index 47d395c89..af2ee8994 100644
--- a/src/core/weechat.h
+++ b/src/core/weechat.h
@@ -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