diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Src/Modules/curses.c | 31 | ||||
-rw-r--r-- | configure.ac | 17 |
3 files changed, 43 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog index 2e24f2d53..775e0a3d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-11-20 Peter Stephenson <pws@csr.com> + * 24107: configure.ac, Src/Modules/curses.c: yet more + library fun: search for ncurses headers in other places, + don't use ncursesw/ncurses.h if no multibyte support, + don't use any ncurses headers if the terminal library + isn't ncurses. + * 24104: INSTALL, configure.ac: don't search for ncurses if we can't find ncurses.h. diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c index 19f58cc62..81d34ce4f 100644 --- a/Src/Modules/curses.c +++ b/Src/Modules/curses.c @@ -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 diff --git a/configure.ac b/configure.ac index 394178117..fbbd76aca 100644 --- a/configure.ac +++ b/configure.ac @@ -557,7 +557,8 @@ AC_CHECK_HEADERS(sys/time.h sys/times.h sys/select.h termcap.h termio.h \ 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 @@ AC_CHECK_LIB(m, pow) 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 @@ else 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 @@ dnl Where are curses key definitions located? Need for keypad() mode. 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 |