From: Frédéric Marchal Date: Wed, 17 Feb 2010 14:40:45 +0000 (+0000) Subject: Disable the use of missing LC_MESSAGES under mingw X-Git-Tag: v2.3-pre2~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eca2cec927f5654d3a45fd6500034d601248714f;p=thirdparty%2Fsarg.git Disable the use of missing LC_MESSAGES under mingw --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 518f8ef..a36227d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,7 @@ CHECK_INCLUDE_FILE(limits.h HAVE_LIMITS_H) CHECK_INCLUDE_FILE(math.h HAVE_MATH_H) CHECK_INCLUDE_FILE(locale.h HAVE_LOCALE_H) CHECK_INCLUDE_FILE(execinfo.h HAVE_EXECINFO_H) +CHECK_INCLUDE_FILE(libintl.h HAVE_LIBINTL_H) CHECK_FUNCTION_EXISTS(bzero HAVE_BZERO) CHECK_FUNCTION_EXISTS(backtrace HAVE_BACKTRACE) @@ -235,8 +236,8 @@ IF(HAVE_RLIM_T) ELSE(RLIM_T STREQUAL 4) MESSAGE("Unknown rlim_t size") ENDIF(RLIM_T STREQUAL 4) -ELSE(HAVE_RLIM_T) - MESSAGE("Cannot detect the size of your system's rlim_t type") +#ELSE(HAVE_RLIM_T) +# MESSAGE("Cannot detect the size of your system's rlim_t type") ENDIF(HAVE_RLIM_T) # Windows need lib wsock32 @@ -261,6 +262,22 @@ IF(NOT HAVE_MKSTEMP) ENDIF(IBERTY_LIB) ENDIF(NOT HAVE_MKSTEMP) +# Gettext and friends +IF(NOT HAVE_LC_MESSAGES) + UNSET(FILES) + IF(HAVE_LOCALE_H) + LIST(APPEND FILES "locale.h") + ENDIF(HAVE_LOCALE_H) + IF(HAVE_LIBINTL_H) + LIST(APPEND FILES "libintl.h") + ENDIF(HAVE_LIBINTL_H) + LIST(LENGTH FILES NFILES) + IF(NFILES GREATER 0) + MESSAGE("Search LC_MESSAGES in ${FILES}") + CHECK_SYMBOL_EXISTS(LC_MESSAGES "${FILES}" HAVE_LC_MESSAGES) + ENDIF(NFILES GREATER 0) +ENDIF(NOT HAVE_LC_MESSAGES) + # System particularities IF(CMAKE_SYSTEM_NAME STREQUAL "solaris") TARGET_LINK_LIBRARIES(sarg socket nsl) diff --git a/include/conf.h b/include/conf.h index 73eed1a..38de51e 100755 --- a/include/conf.h +++ b/include/conf.h @@ -121,7 +121,7 @@ int mkstemps(char *template, int suffixlen); #define mkstemp(template) mkstemps(template,0) #endif -#ifdef ENABLE_NLS +#if defined(ENABLE_NLS) && defined(HAVE_LIBINTL_H) #include #define _(String) gettext(String) #ifdef gettext_noop @@ -134,7 +134,7 @@ int mkstemps(char *template, int suffixlen); #define N_(String) (String) #define textdomain(String) #define bindtextdomain(Domain,Directory) -#endif +#endif //NLS #if defined(__MINGW32__) #define mkdir(p,m) _mkdir(p) diff --git a/include/config.h.in b/include/config.h.in index 58c90d9..5fde710 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -44,6 +44,7 @@ #cmakedefine HAVE_MATH_H #cmakedefine HAVE_LOCALE_H #cmakedefine HAVE_EXECINFO_H +#cmakedefine HAVE_LIBINTL_H #cmakedefine IBERTY_LIB @@ -57,4 +58,6 @@ #define RLIM_STRING "@RLIM_STRING@" #define ICONV_CONST @ICONV_CONST@ +#cmakedefine HAVE_LC_MESSAGES + #endif /*CONFIG_H*/ diff --git a/log.c b/log.c index e051e9d..4a750d9 100644 --- a/log.c +++ b/log.c @@ -309,10 +309,13 @@ int main(int argc,char *argv[]) #ifdef HAVE_LOCALE_H setlocale(LC_TIME,""); - setlocale (LC_MESSAGES, ""); #endif + +#if defined(ENABLE_NLS) && defined(HAVE_LOCALE_H) && defined(HAVE_LC_MESSAGES) + setlocale (LC_MESSAGES, ""); bindtextdomain (PACKAGE_NAME, LOCALEDIR); textdomain (PACKAGE_NAME); +#endif //ENABLE_NLS NAccessLog=0; for(x=0; x