Просмотр исходного кода

build: Allow disabling Unicode support

This affects only dselect ncurses support for now.

Based-on-patch-by: Yuri Vasilevski <yvasilev@gentoo.org>
Guillem Jover лет назад: 16
Родитель
Сommit
c7dc2bf663
3 измененных файлов с 46 добавлено и 8 удалено
  1. 2 0
      debian/changelog
  2. 23 8
      m4/dpkg-libs.m4
  3. 21 0
      m4/dpkg-unicode.m4

+ 2 - 0
debian/changelog

@@ -178,6 +178,8 @@ dpkg (1.15.6) UNRELEASED; urgency=low
     Based on a patch by Marc-Jano Knopp <pub_br_debian.org@marc-jano.de>.
     Based on a patch by Marc-Jano Knopp <pub_br_debian.org@marc-jano.de>.
     Closes: #383869
     Closes: #383869
   * Honour LINGUAS environment variable when installing translated man pages.
   * Honour LINGUAS environment variable when installing translated man pages.
+  * Allow disabling at configure time Unicode ncurses support for dselect.
+    Based on a patch by Yuri Vasilevski <yvasilev@gentoo.org>.
 
 
   [ Modestas Vainius ]
   [ Modestas Vainius ]
   * Implement symbol patterns (Closes: #563752). From now on, it is possible to
   * Implement symbol patterns (Closes: #563752). From now on, it is possible to

+ 23 - 8
m4/dpkg-libs.m4

@@ -88,17 +88,32 @@ if test "x$with_selinux" != "xno"; then
 fi
 fi
 ])# DPKG_LIB_SELINUX
 ])# DPKG_LIB_SELINUX
 
 
+# _DPKG_CHECK_LIB_CURSES_NARROW
+# -----------------------------
+# Check for narrow curses library.
+AC_DEFUN([_DPKG_CHECK_LIB_CURSES_NARROW], [
+AC_CHECK_LIB([ncurses], [initscr],
+  [CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lncurses"],
+  [AC_CHECK_LIB([curses], [initscr],
+     [CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lcurses"],
+     [AC_MSG_WARN([no curses library found])])])])
+])# DPKG_CHECK_LIB_CURSES_NARROW
+
 # DPKG_LIB_CURSES
 # DPKG_LIB_CURSES
 # ---------------
 # ---------------
 # Check for curses library.
 # Check for curses library.
-AC_DEFUN([DPKG_LIB_CURSES],
-[AC_ARG_VAR([CURSES_LIBS], [linker flags for curses library])dnl
-AC_CHECK_HEADERS([ncursesw/ncurses.h ncurses/ncurses.h ncurses.h curses.h \
-                  ncursesw/term.h ncurses/term.h term.h])
-AC_CHECK_LIB([ncursesw], [initscr], [CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lncursesw"],
-	[AC_CHECK_LIB([ncurses], [initscr], [CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lncurses"],
-		[AC_CHECK_LIB([curses], [initscr], [CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lcurses"],
-			[AC_MSG_WARN([no curses library found])])])])
+AC_DEFUN([DPKG_LIB_CURSES], [
+AC_REQUIRE([DPKG_UNICODE])
+AC_ARG_VAR([CURSES_LIBS], [linker flags for curses library])dnl
+AC_CHECK_HEADERS([ncurses/ncurses.h ncurses.h curses.h ncurses/term.h term.h])
+if test "x$USE_UNICODE" = "xyes"; then
+  AC_CHECK_HEADERS([ncursesw/ncurses.h ncursesw/term.h])
+  AC_CHECK_LIB([ncursesw], [initscr],
+    [CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lncursesw"],
+    [_DPKG_CHECK_LIB_CURSES_NARROW()])
+else
+  _DPKG_CHECK_LIB_CURSES_NARROW()
+fi
 ])# DPKG_LIB_CURSES
 ])# DPKG_LIB_CURSES
 
 
 # DPKG_LIB_SSD
 # DPKG_LIB_SSD

+ 21 - 0
m4/dpkg-unicode.m4

@@ -0,0 +1,21 @@
+# Copyright © 1995-2003, 2005-2006 Free Software Foundation, Inc.
+# Copyright © 2009 Yuri Vasilevski <yvasilev@gentoo.org>
+# Copyright © 2010 Guillem Jover <guillem@debian.org>
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# DPKG_UNICODE()
+# --------------
+# Add configure option to disable Unicode support.
+AC_DEFUN([DPKG_UNICODE], [
+  AC_MSG_CHECKING([whether Unicode is requested])
+  dnl Default: Unicode is enabled.
+  AC_ARG_ENABLE([unicode],
+    [AS_HELP_STRING([--disable-unicode],
+                    [do not use Unicode (wide chars) support])],
+    [USE_UNICODE=$enableval], [USE_UNICODE=yes])
+  AC_MSG_RESULT($USE_UNICODE)
+  AC_SUBST(USE_UNICODE)
+]) # DPKG_UNICODE