Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh-4.3.4-dev-2.tar.gz



On Tue, 20 Nov 2007 17:03:15 +0200
"Zvi Har'El" <rl@xxxxxxxxxxxxxxxxxxx> wrote:
> I believe ncurses.h is in the standard place, but not where it is
> configures looks for and the sources include it:
>...
> so, one should have
> #include <ncursesw/ncurses.h>

Aieee.

This looks for the header in more places and tries to be consistent about
multibyte support.

It also tries to be consistent the other way:  if we haven't found
the ncurses library, we shouldn't be using the headers.

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.79
diff -u -r1.79 configure.ac
--- configure.ac	20 Nov 2007 14:20:00 -0000	1.79
+++ configure.ac	20 Nov 2007 15:39:40 -0000
@@ -557,7 +557,8 @@
 		 unistd.h sys/capability.h \
 		 utmp.h utmpx.h sys/types.h pwd.h grp.h poll.h sys/mman.h \
 		 netinet/in_systm.h pcre.h langinfo.h wchar.h stddef.h \
-		 sys/stropts.h iconv.h ncurses.h)
+		 sys/stropts.h iconv.h ncurses.h ncursesw/ncurses.h \
+		 ncurses/ncurses.h)
 if test x$dynamic = xyes; then
   AC_CHECK_HEADERS(dlfcn.h)
   AC_CHECK_HEADERS(dl.h)
@@ -639,7 +640,7 @@
 dnl Various features of ncurses depend on having the right header
 dnl (the system's own curses.h may well not be good enough).
 dnl So don't search for ncurses unless we found the header.
-if test x$ac_cv_header_ncurses_h = xyes; then
+if test x$ac_cv_header_ncurses_h = xyes || test x$ac_cv_header_ncurses_ncurses_h = xyes || test x$ac_cv_header_ncursesw_ncurses_h = xyes; then
   ncursesw_test=ncursesw
   ncurses_test=ncurses
 else
@@ -719,6 +720,16 @@
 AC_MSG_RESULT(no)
 fi
 
+dnl If our terminal library is not ncurses, don't try including
+dnl any ncurses headers.
+AH_TEMPLATE([ZSH_IGNORE_NCURSES],
+[Define to 1 to ignore any ncurses library headers found on the system.])
+case $LIBS in
+  ncurses*) ;;
+  *)
+  AC_DEFINE(ZSH_IGNORE_NCURSES) ;;
+esac
+
 AC_MSG_CHECKING(if boolcodes is available)
 AC_TRY_LINK([#ifdef TERM_H_NEEDS_CURSES_H
 #include <curses.h>
@@ -1381,7 +1392,7 @@
 AC_CACHE_CHECK(where curses key definitions are located, zsh_cv_path_curses_keys_h,
 [dnl This is an identical trick to errno.h, except we use ncurses.h
 dnl if we can.
-if test x$ac_cv_header_ncurses_h = xyes; then
+if test x$ac_cv_header_ncurses_h = xyes || test x$ac_cv_header_ncurses_ncurses_h = xyes || test x$ac_cv_header_ncursesw_ncurses_h = xyes; then
   echo "#include <ncurses.h>" >nametmp.c
 else
   if test x$ac_cv_header_curses_h = xyes; then
Index: Src/Modules/curses.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/curses.c,v
retrieving revision 1.40
diff -u -r1.40 curses.c
--- Src/Modules/curses.c	12 Nov 2007 12:16:52 -0000	1.40
+++ Src/Modules/curses.c	20 Nov 2007 15:39:41 -0000
@@ -32,20 +32,35 @@
 #include "curses.mdh"
 #include "curses.pro"
 
-#ifdef HAVE_NCURSES_H
-# include <ncurses.h>
-#else
-# ifdef HAVE_CURSES_H
-#  include <curses.h>
-# endif
-#endif
-
 #ifndef MULTIBYTE_SUPPORT
 # undef HAVE_GETCCHAR
 # undef HAVE_SETCCHAR
 # undef HAVE_WADDWSTR
 # undef HAVE_WGET_WCH
 # undef HAVE_WIN_WCH
+# undef HAVE_NCURSESW_NCURSES_H
+#endif
+
+#ifdef ZSH_IGNORE_NCURSES
+# ifdef HAVE_CURSES_H
+#  include <curses.h>
+# endif
+#else
+# ifdef HAVE_NCURSESW_NCURSES_H
+#  include <ncursesw/ncurses.h>
+# else
+#  ifdef HAVE_NCURSES_H
+#   include <ncurses.h>
+#  else
+#   ifdef HAVE_NCURSES_NCURSES_H
+#    include <ncurses/ncurses.h>
+#   else
+#    ifdef HAVE_CURSES_H
+#     include <curses.h>
+#    endif
+#   endif
+#  endif
+# endif
 #endif
 
 #ifdef HAVE_SETCCHAR

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author