From: Max Kellermann Date: Thu, 25 Dec 2008 03:15:44 +0000 (+0100) Subject: configure.ac: added --disable-locale option X-Git-Tag: release-0.13~48 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c39eb2cdf399c740c24884997364cf84c64fd46b;p=ncmpc.git configure.ac: added --disable-locale option Make locale.h mandatory. --disable-locale disables the locale.h check. --- diff --git a/NEWS b/NEWS index 8dd5187..59b8077 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ ncmpc 0.13 - not yet released * added output configuration screen, default hotkey F8 + * new --disable-locale configure option ncmpc 0.12 - 2008-12-05 diff --git a/configure.ac b/configure.ac index 0a1d68d..a688445 100644 --- a/configure.ac +++ b/configure.ac @@ -18,14 +18,6 @@ ALL_LINGUAS="es da de fr gl no ru sk sv hu" set -- $CFLAGS -dnl -dnl Check for headers -dnl - -AC_CHECK_HEADER([locale.h], - AC_DEFINE([HAVE_LOCALE_H], [1], [locale.h]), - ,) - dnl dnl ncmpc-mini @@ -42,10 +34,12 @@ if test "x$enable_mini" = xyes; then AC_DEFINE([NCMPC_MINI], [1], [Build ncmpc-mini, which disables lots of features]) auto=no disable_mini=no + auto_mini=no ncurses=ncurses else auto=auto disable_mini=yes + auto_mini=auto ncurses=auto fi @@ -139,6 +133,28 @@ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.4],, dnl i18n +AC_ARG_ENABLE([locale], + AC_HELP_STRING([--disable-locale], + [Disable locale support (default: auto)]), + [enable_locale=$enableval], + [enable_locale=$auto_mini]) + +if test x$enable_locale = xyes; then + AC_CHECK_HEADER([locale.h],, + [AC_MSG_ERROR(locale.h is unavailable)]) +fi + +if test x$enable_locale = xauto; then + AC_CHECK_HEADER([locale.h], + [enable_locale=yes], + [enable_locale=no]) +fi + +if test x$enable_locale = xyes; then + AC_DEFINE([ENABLE_LOCALE], [1], [Locale support is enabled]) +fi + + AM_NLS nls=$USE_NLS diff --git a/src/charset.c b/src/charset.c index 69e15eb..b948636 100644 --- a/src/charset.c +++ b/src/charset.c @@ -23,7 +23,7 @@ #include #include -#if defined(HAVE_LOCALE_H) && !defined(NCMPC_MINI) +#ifdef ENABLE_LOCALE static bool noconvert = true; static const char *charset; @@ -62,7 +62,7 @@ utf8_width(const char *str) char * utf8_to_locale(const char *utf8str) { -#if defined(HAVE_LOCALE_H) && !defined(NCMPC_MINI) +#ifdef ENABLE_LOCALE gchar *str; assert(utf8str != NULL); @@ -85,7 +85,7 @@ utf8_to_locale(const char *utf8str) char * locale_to_utf8(const char *localestr) { -#if defined(HAVE_LOCALE_H) && !defined(NCMPC_MINI) +#ifdef ENABLE_LOCALE gchar *str; assert(localestr != NULL); diff --git a/src/charset.h b/src/charset.h index 4dfe13f..0999e8e 100644 --- a/src/charset.h +++ b/src/charset.h @@ -25,7 +25,7 @@ #include #include -#if defined(HAVE_LOCALE_H) && !defined(NCMPC_MINI) +#ifdef ENABLE_LOCALE const char * charset_init(void); #endif diff --git a/src/main.c b/src/main.c index 53ea8c5..a0f7c0c 100644 --- a/src/main.c +++ b/src/main.c @@ -45,7 +45,7 @@ #include #include -#ifdef HAVE_LOCALE_H +#ifdef ENABLE_LOCALE #include #endif @@ -363,7 +363,7 @@ int main(int argc, const char *argv[]) { struct sigaction act; -#if defined(HAVE_LOCALE_H) && !defined(NCMPC_MINI) +#ifdef ENABLE_LOCALE const char *charset = NULL; #endif GIOChannel *keyboard_channel; @@ -372,7 +372,7 @@ main(int argc, const char *argv[]) GIOChannel *lirc_channel = NULL; #endif -#if defined(HAVE_LOCALE_H) && !defined(NCMPC_MINI) +#ifdef ENABLE_LOCALE /* time and date formatting */ setlocale(LC_TIME,""); /* care about sorting order etc */ diff --git a/src/options.c b/src/options.c index 8c62e4b..8a2ced9 100644 --- a/src/options.c +++ b/src/options.c @@ -168,6 +168,9 @@ handle_option(int c, const char *arg) #ifdef ENABLE_WIDE " wide" #endif +#ifdef ENABLE_LOCALE + " locale" +#endif #ifdef ENABLE_NLS " nls" #endif