aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-12-25 04:15:44 +0100
committerMax Kellermann <max@duempel.org>2008-12-25 04:15:44 +0100
commitc39eb2cdf399c740c24884997364cf84c64fd46b (patch)
treecb27e0df8199ce28960cd316347783d519dab357
parent634bed2e83799f604a60bfef62d5e240ea02511c (diff)
downloadmpd-c39eb2cdf399c740c24884997364cf84c64fd46b.tar.gz
mpd-c39eb2cdf399c740c24884997364cf84c64fd46b.tar.xz
mpd-c39eb2cdf399c740c24884997364cf84c64fd46b.zip
configure.ac: added --disable-locale option
Make locale.h mandatory. --disable-locale disables the locale.h check.
-rw-r--r--NEWS1
-rw-r--r--configure.ac32
-rw-r--r--src/charset.c6
-rw-r--r--src/charset.h2
-rw-r--r--src/main.c6
-rw-r--r--src/options.c3
6 files changed, 35 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index 8dd51871a..59b807760 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 0a1d68d87..a6884456d 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 69e15eb6e..b948636f0 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -23,7 +23,7 @@
#include <string.h>
#include <glib.h>
-#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 4dfe13f3f..0999e8ef3 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -25,7 +25,7 @@
#include <stdbool.h>
#include <stddef.h>
-#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 53ea8c592..a0f7c0c99 100644
--- a/src/main.c
+++ b/src/main.c
@@ -45,7 +45,7 @@
#include <signal.h>
#include <string.h>
-#ifdef HAVE_LOCALE_H
+#ifdef ENABLE_LOCALE
#include <locale.h>
#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 8c62e4b83..8a2ced94a 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