[patch] Allow to link with ncursesw

Matthias Klose
2017-09-13T10:29:54Z

[-- Attachment #1: Type: text/plain, Size: 315 bytes --]

Triggered by https://launchpad.net/bugs/1275210, to be able to cope with UTF-8
characters in gdbtui. Ok for the trunk?

Matthias

* configure.ac: Search ncursesw before ncurses.
Check ncursesw/ncurses.h before ncurses/ncurses.h.
* gdb_curses.h: Include <ncursesw/ncurses.h>
* config.in, configure: Regenerate.

[-- Attachment #2: ncursesw.diff --]
[-- Type: text/x-patch, Size: 3875 bytes --]

* configure.ac: Search ncursesw before ncurses.
Check ncursesw/ncurses.h before ncurses/ncurses.h.
* gdb_curses.h: Include <ncursesw/ncurses.h>
* config.in, configure: Regenerate.

Index: b/gdb/configure.ac
===================================================================
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -569,7 +569,7 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation.
- AC_SEARCH_LIBS(waddstr, [ncurses cursesX curses])
+ AC_SEARCH_LIBS(waddstr, [ncursesw ncurses cursesX curses])

if test "$ac_cv_search_waddstr" != no; then
curses_found=yes
@@ -611,7 +611,7 @@ case $host_os in
esac

# These are the libraries checked by Readline.
-AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses])
+AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncursesw ncurses])

if test "$ac_cv_search_tgetent" = no; then
CONFIG_OBS="$CONFIG_OBS stub-termcap.o"
@@ -1314,7 +1314,7 @@ case $host_os in
Solaris 2.[789] when using GCC. ])
fi ;;
esac
-AC_CHECK_HEADERS(curses.h cursesX.h ncurses.h ncurses/ncurses.h ncurses/term.h)
+AC_CHECK_HEADERS(curses.h cursesX.h ncurses.h ncursesw/ncurses.h ncurses/ncurses.h ncurses/term.h)
AC_CHECK_HEADERS(term.h, [], [],
[#if HAVE_CURSES_H
# include <curses.h>
Index: b/gdb/config.in
===================================================================
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -300,6 +300,9 @@
/* Define to 1 if you have the `monstartup' function. */
#undef HAVE_MONSTARTUP

+/* Define to 1 if you have the <ncursesw/ncurses.h> header file. */
+#undef HAVE_NCURSESW_NCURSES_H
+
/* Define to 1 if you have the <ncurses.h> header file. */
#undef HAVE_NCURSES_H

Index: b/gdb/gdb_curses.h
===================================================================
--- a/gdb/gdb_curses.h
+++ b/gdb/gdb_curses.h
@@ -39,7 +39,9 @@
#define NOMACROS
#define NCURSES_NOMACROS

-#if defined (HAVE_NCURSES_NCURSES_H)
+#if defined (HAVE_NCURSESW_NCURSES_H)
+#include <ncursesw/ncurses.h>
+#elif defined (HAVE_NCURSES_NCURSES_H)
#include <ncurses/ncurses.h>
#elif defined (HAVE_NCURSES_H)
#include <ncurses.h>
Index: b/gdb/configure
===================================================================
--- a/gdb/configure
+++ b/gdb/configure
@@ -8796,7 +8796,7 @@ return waddstr ();
return 0;
}
_ACEOF
-for ac_lib in '' ncurses cursesX curses; do
+for ac_lib in '' ncursesw ncurses cursesX curses; do
if test -z "$ac_lib"; then
ac_res="none required"
else
@@ -8894,7 +8894,7 @@ return tgetent ();
return 0;
}
_ACEOF
-for ac_lib in '' termcap tinfo curses ncurses; do
+for ac_lib in '' termcap tinfo curses ncursesw ncurses; do
if test -z "$ac_lib"; then
ac_res="none required"
else
@@ -11713,7 +11713,7 @@ $as_echo "#define _MSE_INT_H 1" >>confde

fi ;;
esac
-for ac_header in curses.h cursesX.h ncurses.h ncurses/ncurses.h ncurses/term.h
+for ac_header in curses.h cursesX.h ncurses.h ncursesw/ncurses.h ncurses/ncurses.h ncurses/term.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -13179,7 +13179,7 @@ $as_echo "#define HAVE_LANGINFO_CODESET
fi

- for ac_header in linux/perf_event.h locale.h memory.h signal.h sys/resource.h sys/socket.h sys/syscall.h sys/un.h sys/wait.h thread_db.h wait.h
+ for ac_header in linux/perf_event.h locale.h memory.h signal.h sys/resource.h sys/socket.h sys/syscall.h sys/un.h sys/wait.h thread_db.h wait.h termios.h termio.h sgtty.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"