cmake: correct configure check for _nl_msg_cat_cntr

This commit is contained in:
David Adam 2017-11-16 22:13:45 +08:00
parent 32714021f5
commit 64194d02fc
3 changed files with 18 additions and 5 deletions

View file

@ -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)

View file

@ -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 <libintl.h>")
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} intl)
ENDIF()
CHECK_CXX_SOURCE_COMPILES("
${LIBINTL_INCLUDE}
#include <stdlib.h>
int main () {
extern int _nl_msg_cat_cntr;
int tmp = _nl_msg_cat_cntr;
exit(tmp);
}
"
HAVE__NL_MSG_CAT_CNTR)

View file

@ -34,9 +34,6 @@
/* Define to 1 if you have the `killpg' function. */
#cmakedefine HAVE_KILLPG 1
/* Define to 1 if you have the <libintl.h> header file. */
#cmakedefine HAVE_LIBINTL_H 1
/* Define to 1 if you have the `lrand48_r' function. */
#cmakedefine HAVE_LRAND48_R 1