From 64194d02fc3e309abfb70d360fe2235315685976 Mon Sep 17 00:00:00 2001 From: David Adam Date: Thu, 16 Nov 2017 22:13:45 +0800 Subject: [PATCH] cmake: correct configure check for _nl_msg_cat_cntr --- cmake/ConfigureChecks.cmake | 3 +-- cmake/gettext.cmake | 17 +++++++++++++++++ config_cmake.h.in | 3 --- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 1ae8462ba..3864b477b 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -39,7 +39,6 @@ CHECK_FUNCTION_EXISTS(getifaddrs HAVE_GETIFADDRS) CHECK_FUNCTION_EXISTS(getpwent HAVE_GETPWENT) CHECK_FUNCTION_EXISTS(gettext HAVE_GETTEXT) CHECK_FUNCTION_EXISTS(killpg HAVE_KILLPG) -CHECK_INCLUDE_FILE_CXX(libintl.h HAVE_LIBINTL_H) # Needed for _nl_msg_cat_cntr CHECK_FUNCTION_EXISTS(lrand48_r HAVE_LRAND48_R) CHECK_FUNCTION_EXISTS(mkostemp HAVE_MKOSTEMP) SET(HAVE_NCURSES_CURSES_H ${CURSES_HAVE_NCURSES_CURSES_H}) @@ -67,7 +66,7 @@ CHECK_FUNCTION_EXISTS(wcsdup HAVE_WCSDUP) CHECK_FUNCTION_EXISTS(wcslcpy HAVE_WCSLCPY) CHECK_FUNCTION_EXISTS(wcsncasecmp HAVE_WCSNCASECMP) CHECK_FUNCTION_EXISTS(wcsndup HAVE_WCSNDUP) -CHECK_CXX_SYMBOL_EXISTS(_nl_msg_cat_cntr stdlib.h HAVE__NL_MSG_CAT_CNTR) + CHECK_CXX_SYMBOL_EXISTS(_sys_errs stdlib.h HAVE__SYS__ERRS) SET(CMAKE_EXTRA_INCLUDE_FILES termios.h sys/ioctl.h) diff --git a/cmake/gettext.cmake b/cmake/gettext.cmake index 2fa31ca91..55b408e0c 100644 --- a/cmake/gettext.cmake +++ b/cmake/gettext.cmake @@ -20,3 +20,20 @@ IF(GETTEXT_FOUND) PO_FILES po/${lang}.po) ENDFOREACH() ENDIF() + + +# libintl.h can be compiled into the stdlib on some GLibC systems +IF(Intl_FOUND AND Intl_LIBRARIES) + SET(LIBINTL_INCLUDE "#include ") + SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} intl) +ENDIF() +CHECK_CXX_SOURCE_COMPILES(" +${LIBINTL_INCLUDE} +#include +int main () { + extern int _nl_msg_cat_cntr; + int tmp = _nl_msg_cat_cntr; + exit(tmp); +} +" + HAVE__NL_MSG_CAT_CNTR) diff --git a/config_cmake.h.in b/config_cmake.h.in index 008eedeec..39c5c2545 100644 --- a/config_cmake.h.in +++ b/config_cmake.h.in @@ -34,9 +34,6 @@ /* Define to 1 if you have the `killpg' function. */ #cmakedefine HAVE_KILLPG 1 -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LIBINTL_H 1 - /* Define to 1 if you have the `lrand48_r' function. */ #cmakedefine HAVE_LRAND48_R 1