aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHasso Tepper <hasso@kde.org>2006-03-27 16:05:59 +0000
committerHasso Tepper <hasso@kde.org>2006-03-27 16:05:59 +0000
commitc80ebd38d8cb1d02dbd5a94fcca60c8bffd51404 (patch)
treefc19f931e1c7c1b7a68b758422f835b814764b54
parenteec44594b5f49e655dd14fd2aeb6deb05d2f3c0c (diff)
downloadextra-cmake-modules-c80ebd38d8cb1d02dbd5a94fcca60c8bffd51404.tar.gz
extra-cmake-modules-c80ebd38d8cb1d02dbd5a94fcca60c8bffd51404.tar.bz2
Better gettext find test. Tested with Linux and NetBSD.
svn path=/trunk/KDE/kdelibs/; revision=523195
-rw-r--r--modules/FindGettext.cmake36
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}")