diff options
-rw-r--r-- | modules/FindGettext.cmake | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/modules/FindGettext.cmake b/modules/FindGettext.cmake index 3eae44a0..26bab048 100644 --- a/modules/FindGettext.cmake +++ b/modules/FindGettext.cmake @@ -11,31 +11,33 @@ # embedded within kdelibs (cf. gettext.m4 from Gettext source). INCLUDE(CheckIncludeFiles) +include(CheckFunctionExists) + check_include_files(libintl.h HAVE_LIBINTL_H) set(GETTEXT_INCLUDE_DIR) set(GETTEXT_LIBRARIES) if (HAVE_LIBINTL_H) - set(GETTEXT_FOUND TRUE) - set(GETTEXT_SOURCE "built in libc") + check_function_exists(dgettext LIBC_HAS_DGETTEXT) + if (LIBC_HAS_DGETTEXT) + set(GETTEXT_SOURCE "built in libc") + set(GETTEXT_FOUND TRUE) + else (LIBC_HAS_DGETTEXT) + FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl + PATHS + /usr/lib + /usr/local/lib + ) + CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) + if (LIBINTL_HAS_DGETTEXT) + set(GETTEXT_SOURCE "in ${LIBINTL_LIBRARY}") + set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY}) + set(GETTEXT_FOUND TRUE) + endif (LIBINTL_HAS_DGETTEXT) + endif (LIBC_HAS_DGETTEXT) endif (HAVE_LIBINTL_H) -# Check for libintl, and check that it provides libintl_dgettext. Needed on BSD systems (e.g. Mac OS X) -FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl - PATHS - /usr/lib - /usr/local/lib -) - -if (LIBINTL_LIBRARY) - CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "libintl_dgettext" "" LIBINTL_HAS_DGETTEXT) - if (LIBINTL_HAS_DGETTEXT) - set(GETTEXT_SOURCE "in ${LIBINTL_LIBRARY}") - set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY}) - endif (LIBINTL_HAS_DGETTEXT) -endif (LIBINTL_LIBRARY) - if (GETTEXT_FOUND) if (NOT Gettext_FIND_QUIETLY) message(STATUS "Found Gettext: ${GETTEXT_SOURCE}") |