[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

dpkg's ability to disable wide char ncurses (patch included)



Hello,

As pointed out by guillem in:
http://lists.debian.org/debian-dpkg/2009/11/msg00071.html

Gentoo has an obsolete sed substitution to disable Unicode support in dselect.
This got broken when dpkg's configure script learned how to autodetect the availability of wide char enabled ncurces library. The problem is that now if there are headers for the wide char ncurses lib, they are always used. (The ability to link against narrow char lib is there via exporting ac_cv_lib_ncursesw_initscr=no).

So I made this patch that creates a --disable-unicode ./configure flag, that when present will disable checks for the wide char ncurses library and use the narrow char variant even on a system with both variants installed.

I hope this patch can be accepted :-)

Kindest regards,
Yuri.

PS: Please CC me on replay as I'm not subscribed to this list.
diff -Naurp dpkg-1.15.5.2.orig/m4/dpkg-libs.m4 dpkg-1.15.5.2/m4/dpkg-libs.m4
--- dpkg-1.15.5.2.orig/m4/dpkg-libs.m4	2009-11-21 09:40:57.000000000 +0000
+++ dpkg-1.15.5.2/m4/dpkg-libs.m4	2009-11-21 09:37:55.000000000 +0000
@@ -100,14 +100,23 @@ fi
 # DPKG_LIB_CURSES
 # ---------------
 # 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_DEFUN([DPKG_LIB_CURSES], [
+AC_REQUIRE([AM_UNICODE])
+AC_ARG_VAR([CURSES_LIBS], [linker flags for curses library])dnl
+if test "x$USE_UNICODE" = "xyes"; then
+	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])])])])
+else
+	AC_CHECK_HEADERS([ncurses/ncurses.h ncurses.h curses.h \
+	                  ncurses/term.h term.h])
+	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_MSG_WARN([no curses library found])])])
+fi
 ])# DPKG_LIB_CURSES
 
 # DPKG_LIB_SSD
diff -Naurp dpkg-1.15.5.2.orig/m4/unicode.m4 dpkg-1.15.5.2/m4/unicode.m4
--- dpkg-1.15.5.2.orig/m4/unicode.m4	1970-01-01 00:00:00.000000000 +0000
+++ dpkg-1.15.5.2/m4/unicode.m4	2009-11-21 09:46:53.000000000 +0000
@@ -0,0 +1,21 @@
+# unicode.m4
+dnl Copyright (C) 2009 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl Author:
+dnl   Yuri Vasilevski <yvasilev@gentoo.org>, 2009
+
+AC_PREREQ(2.50)
+
+AC_DEFUN([AM_UNICODE],
+[
+  AC_MSG_CHECKING([whether UNICODE is requested])
+  dnl Default: UNICODE is enabled
+  AC_ARG_ENABLE(unicode,
+    [  --disable-unicode       do not use Unicode (wide characters) support],
+    USE_UNICODE=$enableval, USE_UNICODE=yes)
+  AC_MSG_RESULT($USE_UNICODE)
+  AC_SUBST(USE_UNICODE)
+])

Reply to: