From: Jonas Fonseca Date: Wed, 23 Apr 2008 21:49:25 +0000 (+0200) Subject: Make configure check for ncurses header files X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7a5eba335c2a925b94c28b4ecaf013932a002f65;p=tig.git Make configure check for ncurses header files First ncursesw/ncurses.h, then ncurses/ncurses.h, and finally ncurses.h. Also include ncurses.h by default instead of curses.h. On most system ncurses.h should be a symlink to curses.h and this will avoid the problem of including a non-ncurses header file. This should fix systems like Solaris who ships their own version of /usr/include/curses.h that is incompatible with ncurses. Reported by SungHyun Nam. --- diff --git a/NEWS b/NEWS index 626c824..2343292 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ Improvements: - F5 also refreshes the current view. - Allow line graphics to be disabled with new line-graphics option. - Also include the reference names when searching. + - Configure: check for the ncurses header files. Bug fixes: diff --git a/configure.ac b/configure.ac index 764190a..6b0fc45 100644 --- a/configure.ac +++ b/configure.ac @@ -1,13 +1,23 @@ -AC_INIT([tig], [0], - [Jonas Fonseca ], - [tig]) +AC_INIT([tig], [0], [Jonas Fonseca ], [tig]) AC_LANG([C]) AC_CONFIG_HEADER(config.h) AC_CONFIG_SRCDIR(tig.c) -AC_SEARCH_LIBS([wclear], [ncursesw ncurses curses], [], - [AC_ERROR([curses not found])]) +cursed=no +AC_CHECK_HEADERS([ncursesw/ncurses.h], + [AC_SEARCH_LIBS([initscr], [ncursesw], [cursed=yes])]) +case "$cursed" in "no") + AC_CHECK_HEADERS([ncurses/ncurses.h ncurses.h], + [AC_SEARCH_LIBS([wclear], [ncurses], [cursed=yes])]) + + case "$cursed" in "no") + AC_ERROR([ncurses not found]) + esac + + AC_MSG_WARN([The found ncurses library does not support wide-char.]) + AC_MSG_WARN([This means that tig will not correctly render UTF-8.]) +esac AM_ICONV @@ -26,9 +36,3 @@ AC_CHECK_PROGS(DOCBOOK2PDF, [docbook2pdf false]) AC_CONFIG_FILES([config.make]) AC_OUTPUT - -case "$LIBS" in -*-lncursesw*) ;; -*) AC_MSG_RESULT([NOTE: The found ncurses library does not support wide-char.]) - AC_MSG_RESULT([NOTE: This means that tig will not correctly render UTF-8]) -esac diff --git a/tig.c b/tig.c index c50ea84..8e06c1a 100644 --- a/tig.c +++ b/tig.c @@ -45,7 +45,15 @@ /* ncurses(3): Must be defined to have extended wide-character functions. */ #define _XOPEN_SOURCE_EXTENDED -#include +#ifdef HAVE_NCURSESW_NCURSES_H +#include +#else +#ifdef HAVE_NCURSES_NCURSES_H +#include +#else +#include +#endif +#endif #if __GNUC__ >= 3 #define __NORETURN __attribute__((__noreturn__))