1 dnl check for ncurses in user supplied path
2 AC_DEFUN([MC_CHECK_NCURSES_BY_PATH], [
4 ac_ncurses_inc_path=[$1]
5 ac_ncurses_lib_path=[$2]
7 if test x"$ac_ncurses_inc_path" != x; then
8 ac_ncurses_inc_path="-I"$ac_ncurses_inc_path
11 if test x"$ac_ncurses_lib_path" != x; then
12 ac_ncurses_lib_path="-L"$ac_ncurses_lib_path
15 saved_CPPFLAGS="$CPPFLAGS"
16 CPPFLAGS="$CPPFLAGS $ac_ncurses_inc_path"
18 dnl Check for the headers
19 dnl Both headers should be in the same directory
20 dnl AIX term.h is unusable for mc
21 AC_MSG_CHECKING([for ncurses/ncurses.h and ncurses/term.h])
24 AC_LANG_PROGRAM([[#include <ncurses/ncurses.h>
25 #include <ncurses/term.h>
30 if test x"$ac_ncurses_inc_path" = x; then
31 ac_ncurses_inc_path="-I/usr/include"
33 if test x"$ac_ncurses_lib_path" = x; then
34 ac_ncurses_lib_path="-L/usr/lib"
37 AC_DEFINE(HAVE_NCURSES_NCURSES_H, 1,
38 [Define to 1 if you have the <ncurses/ncurses.h> header file.])
39 AC_DEFINE(HAVE_NCURSES_TERM_H, 1,
40 [Define to 1 if you have the <ncurses/term.h> header file.])
45 error_msg_ncurses="ncurses header not found"
49 if test x"$found_ncurses" = x"yes"; then
51 screen_msg="ncurses library (installed on the system)"
53 AC_DEFINE(HAVE_NCURSES, 1,
54 [Define to use ncurses library for screen management])
56 MCLIBS="$MCLIBS $ac_ncurses_lib_path"
58 CPPFLAGS="$saved_CPPFLAGS"
59 AC_MSG_ERROR([$error_msg_ncurses])
64 dnl Use the ncurses library. It can only be requested explicitly,
65 dnl so just fail if anything goes wrong.
67 dnl If ncurses exports the ESCDELAY variable it should be set to 0
68 dnl or you'll have to press Esc three times to dismiss a dialog box.
70 AC_DEFUN([MC_WITH_NCURSES], [
71 dnl has_colors() is specific to ncurses, it's not in the old curses
75 dnl get the user supplied include path
76 AC_ARG_WITH([ncurses-includes],
77 AS_HELP_STRING([--with-ncurses-includes=@<:@DIR@:>@],
78 [set path to ncurses includes @<:@default=/usr/include@:>@; make sense only if --with-screen=ncurses; for /usr/local/include/ncurses specify /usr/local/include]
80 [ac_ncurses_inc_path="$withval"],
81 [ac_ncurses_inc_path=""]
84 dnl get the user supplied lib path
85 AC_ARG_WITH([ncurses-libs],
86 AS_HELP_STRING([--with-ncurses-libs=@<:@DIR@:>@],
87 [set path to ncurses library @<:@default=/usr/lib@:>@; make sense only if --with-screen=ncurses]
89 [ac_ncurses_lib_path="$withval"],
90 [ac_ncurses_lib_path=""]
93 dnl we need at least the inc path, the lib may be in a std location
94 if test x"$ac_ncurses_inc_path" != x; then
95 dnl check the user supplied location
96 MC_CHECK_NCURSES_BY_PATH([$ac_ncurses_inc_path],[$ac_ncurses_lib_path])
99 AC_SEARCH_LIBS([has_colors], [ncurses], [MCLIBS="$MCLIBS $LIBS"],
100 [AC_MSG_ERROR([Cannot find ncurses library])])
103 screen_msg="ncurses library"
104 AC_DEFINE(USE_NCURSES, 1,
105 [Define to use ncurses for screen management])
108 AC_SEARCH_LIBS([addwstr], [ncursesw ncurses curses], [MCLIBS="$MCLIBS $LIBS";ncursesw_found=yes],
109 [AC_MSG_WARN([Cannot find ncurses library, that support wide characters])])
111 if test x"$ncursesw_found" = "x"; then
113 AC_SEARCH_LIBS([has_colors], [ncurses curses], [MCLIBS="$MCLIBS $LIBS"],
114 [AC_MSG_ERROR([Cannot find ncurses library])])
119 AC_CHECK_HEADERS([ncursesw/curses.h ncurses/curses.h ncurses.h curses.h],
120 [ncurses_h_found=yes; break])
122 if test x"$ncurses_h_found" = "x"; then
123 AC_MSG_ERROR([Cannot find ncurses header file])
127 screen_msg="ncurses library"
128 AC_DEFINE(USE_NCURSES, 1,
129 [Define to use ncurses for screen management])
132 dnl check for ESCDELAY
133 AC_CACHE_CHECK([for ESCDELAY variable],
134 [mc_cv_ncurses_escdelay],
139 [mc_cv_ncurses_escdelay=yes],
140 [mc_cv_ncurses_escdelay=no])
142 if test x"$mc_cv_ncurses_escdelay" = xyes; then
143 AC_DEFINE(HAVE_ESCDELAY, 1,
144 [Define if ncurses has ESCDELAY variable])
147 dnl check for resizeterm
148 AC_CHECK_FUNCS(resizeterm)
153 dnl Use the ncursesw library. It can only be requested explicitly,
154 dnl so just fail if anything goes wrong.
156 dnl If ncursesw exports the ESCDELAY variable it should be set to 0
157 dnl or you'll have to press Esc three times to dismiss a dialog box.
160 AC_DEFUN([MC_WITH_NCURSESW], [
161 dnl has_colors() is specific to ncurses, it's not in the old curses
164 AC_SEARCH_LIBS([has_colors], [ncursesw], [MCLIBS="$MCLIBS $LIBS"],
165 [AC_MSG_ERROR([Cannot find ncursesw library])])
169 AC_CHECK_HEADERS([ncursesw/curses.h],
170 [ncursesw_h_found=yes; break])
172 if test x"$ncursesw_h_found" = "x"; then
173 AC_MSG_ERROR([Cannot find ncursesw header file])
177 screen_msg="ncursesw library"
178 AC_DEFINE(USE_NCURSESW, 1,
179 [Define to use ncursesw for screen management])
181 AC_CACHE_CHECK([for ESCDELAY variable],
182 [mc_cv_ncursesw_escdelay],
187 [mc_cv_ncursesw_escdelay=yes],
188 [mc_cv_ncursesw_escdelay=no])
190 if test x"$mc_cv_ncursesw_escdelay" = xyes; then
191 AC_DEFINE(HAVE_ESCDELAY, 1,
192 [Define if ncursesw has ESCDELAY variable])
195 AC_CHECK_FUNCS(resizeterm)