summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 634bed2)
raw | patch | inline | side by side (parent: 634bed2)
author | Max Kellermann <max@duempel.org> | |
Thu, 25 Dec 2008 03:15:44 +0000 (04:15 +0100) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 25 Dec 2008 03:15:44 +0000 (04:15 +0100) |
Make locale.h mandatory. --disable-locale disables the locale.h
check.
check.
NEWS | patch | blob | history | |
configure.ac | patch | blob | history | |
src/charset.c | patch | blob | history | |
src/charset.h | patch | blob | history | |
src/main.c | patch | blob | history | |
src/options.c | patch | blob | history |
index 8dd51871acdf4ac82ba45cf59a3fb183d309412a..59b8077603dc9984c184a79b7e0b1ed21d75cc61 100644 (file)
--- a/NEWS
+++ b/NEWS
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 0a1d68d87bfbce4fc2883226ea48e3f83159c068..a6884456dcc2d80534e5248fb9b60392aa7743cc 100644 (file)
--- a/configure.ac
+++ b/configure.ac
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
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
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 69e15eb6e042b6047ac52bbec4be8a6f8041e51a..b948636f03c57e4ab31789ab42c02c535bb1058a 100644 (file)
--- a/src/charset.c
+++ b/src/charset.c
#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;
char *
utf8_to_locale(const char *utf8str)
{
-#if defined(HAVE_LOCALE_H) && !defined(NCMPC_MINI)
+#ifdef ENABLE_LOCALE
gchar *str;
assert(utf8str != NULL);
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 4dfe13f3f19f28b490cf73cb8aeba9aa03886c5a..0999e8ef3d572d9edb463a23257ad7f98ee0fe5b 100644 (file)
--- a/src/charset.h
+++ b/src/charset.h
#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 53ea8c5920d7c6e3452a1194492a6ab7355af151..a0f7c0c99c7aedd42b204af2cfcb2d64233ebd8c 100644 (file)
--- a/src/main.c
+++ b/src/main.c
#include <signal.h>
#include <string.h>
-#ifdef HAVE_LOCALE_H
+#ifdef ENABLE_LOCALE
#include <locale.h>
#endif
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;
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 8c62e4b83b3d41b191d9b2e39903b6d8c7050516..8a2ced94aaf8e80b1b921f7f63e4ab86a22c63df 100644 (file)
--- a/src/options.c
+++ b/src/options.c
#ifdef ENABLE_WIDE
" wide"
#endif
+#ifdef ENABLE_LOCALE
+ " locale"
+#endif
#ifdef ENABLE_NLS
" nls"
#endif