Commit 7a5eba335c2a925b94c28b4ecaf013932a002f65

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.

Commit diff

NEWS

 
99 - F5 also refreshes the current view.
1010 - Allow line graphics to be disabled with new line-graphics option.
1111 - Also include the reference names when searching.
12 - Configure: check for the ncurses header files.
1213
1314Bug fixes:
1415
toggle raw diff

configure.ac

 
1AC_INIT([tig], [0],
2 [Jonas Fonseca <fonseca@diku.dk>],
3 [tig])
1AC_INIT([tig], [0], [Jonas Fonseca <fonseca@diku.dk>], [tig])
42
53AC_LANG([C])
64AC_CONFIG_HEADER(config.h)
75AC_CONFIG_SRCDIR(tig.c)
86
9AC_SEARCH_LIBS([wclear], [ncursesw ncurses curses], [],
10 [AC_ERROR([curses not found])])
7cursed=no
8AC_CHECK_HEADERS([ncursesw/ncurses.h],
9 [AC_SEARCH_LIBS([initscr], [ncursesw], [cursed=yes])])
10case "$cursed" in "no")
11 AC_CHECK_HEADERS([ncurses/ncurses.h ncurses.h],
12 [AC_SEARCH_LIBS([wclear], [ncurses], [cursed=yes])])
13
14 case "$cursed" in "no")
15 AC_ERROR([ncurses not found])
16 esac
17
18 AC_MSG_WARN([The found ncurses library does not support wide-char.])
19 AC_MSG_WARN([This means that tig will not correctly render UTF-8.])
20esac
1121
1222AM_ICONV
1323
3636
3737AC_CONFIG_FILES([config.make])
3838AC_OUTPUT
39
40case "$LIBS" in
41*-lncursesw*) ;;
42*) AC_MSG_RESULT([NOTE: The found ncurses library does not support wide-char.])
43 AC_MSG_RESULT([NOTE: This means that tig will not correctly render UTF-8])
44esac
toggle raw diff

tig.c

 
4545/* ncurses(3): Must be defined to have extended wide-character functions. */
4646#define _XOPEN_SOURCE_EXTENDED
4747
48#include <curses.h>
48#ifdef HAVE_NCURSESW_NCURSES_H
49#include <ncursesw/ncurses.h>
50#else
51#ifdef HAVE_NCURSES_NCURSES_H
52#include <ncurses/ncurses.h>
53#else
54#include <ncurses.h>
55#endif
56#endif
4957
5058#if __GNUC__ >= 3
5159#define __NORETURN __attribute__((__noreturn__))
toggle raw diff