summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8736e49)
raw | patch | inline | side by side (parent: 8736e49)
author | Max Kellermann <max@duempel.org> | |
Mon, 6 Oct 2008 14:54:54 +0000 (16:54 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Mon, 6 Oct 2008 14:54:54 +0000 (16:54 +0200) |
The configure option "--disable-wide" disables wide character support.
This simplifies lots of internal calculations and makes the ncmpc
binary leaner.
This simplifies lots of internal calculations and makes the ncmpc
binary leaner.
configure.ac | patch | blob | history | |
src/charset.c | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index 51faeee3eff24328772d11bd202ca5dfc8fb5f99..7439d36b23a20030c17443f249d51e73fa7e5906 100644 (file)
--- a/configure.ac
+++ b/configure.ac
])
+dnl wide character support
+AC_ARG_ENABLE([wide],
+ AC_HELP_STRING([--enable-wide],
+ [Enable wide character support]),
+ [use_wide=$enableval],
+ [use_wide=auto])
+
+
dnl ncurses
ncurses=auto
AC_ARG_WITH([ncurses],
AC_HELP_STRING([--with-ncursesw], [compile/link with wide-char ncurses library @<:@default@:>@]),
[ncurses=ncursesw])
+if test "x$enable_wide" = "xno"; then
+ if test "x$ncurses" = "xauto"; then
+ dnl select narrow ncurses
+ ncurses=ncurses
+ fi
+
+ if test "x$ncurses" = "xncursesw"; then
+ AC_MSG_WARN([Narrow ncmpc linking against wide libncurses])
+ fi
+fi
+
if test "x$ncurses" = "xauto"; then
AC_CHECK_LIB([ncursesw],
[initscr],
fi
+dnl wide character support II
+
+if test "x$use_wide" = "xauto" ; then
+ AC_CHECK_LIB([$ncurses],
+ [wget_wch],
+ [use_wide=yes],
+ [use_wide=no])
+fi
+
+AC_MSG_CHECKING([wide character support])
+AC_MSG_RESULT([$use_wide])
+
+if test "x$use_wide" = "xyes" ; then
+ AC_DEFINE([ENABLE_WIDE], [1], [Enable wide character support])
+fi
+
+
dnl Check for glib-2.4
PKG_CHECK_MODULES([GLIB],
[glib-2.0 >= 2.4],
diff --git a/src/charset.c b/src/charset.c
index ccfac0ef86a454c339c2b7479c4eb801e1648fbf..5625f12771305065987c342e160759cd89e3af53 100644 (file)
--- a/src/charset.c
+++ b/src/charset.c
{
assert(str != NULL);
-#ifdef HAVE_LOCALE_H
+#ifdef ENABLE_WIDE
if (g_utf8_validate(str, -1, NULL)) {
size_t len = g_utf8_strlen(str, -1);
unsigned width = 0;