2 dnl Check if the system S-Lang library can be used.
3 dnl If not, and $1 is "strict", exit, otherwise fall back to mcslang.
5 AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [
10 if test x"$ac_slang_inc_path" != x; then
11 ac_slang_inc_path="-I"$ac_slang_inc_path
14 if test x"$ac_slang_lib_path" != x; then
15 ac_slang_lib_path="-L"$ac_slang_lib_path
18 saved_CFLAGS="$CFLAGS"
19 saved_CPPFLAGS="$CPPFLAGS"
20 saved_LDFLAGS="$LDFLAGS"
22 CFLAGS="$CFLAGS $ac_slang_inc_path $ac_slang_lib_path"
23 CPPFLAGS="$saved_CPPFLAGS $ac_slang_inc_path $ac_slang_lib_path"
26 AC_MSG_CHECKING([for slang.h])
29 AC_LANG_PROGRAM([#include <slang.h>],[return 0;])
33 if test x"$ac_slang_inc_path" = x; then
34 ac_slang_inc_path="-I/usr/include"
36 if test x"$ac_slang_lib_path" = x; then
37 ac_slang_lib_path="-L/usr/lib"
40 AC_DEFINE(HAVE_SLANG_H, 1,[Define to use slang.h])
45 AC_MSG_CHECKING([for slang/slang.h])
48 AC_LANG_PROGRAM([#include <slang/slang.h>],[return 0;])
52 if test x"$ac_slang_inc_path" = x; then
53 ac_slang_inc_path="-I/usr/include"
55 if test x"$ac_slang_lib_path" = x; then
56 ac_slang_lib_path="-L/usr/lib"
59 AC_DEFINE(HAVE_SLANG_SLANG_H, 1,[Define to use slang.h])
64 error_msg_slang="Slang header not found"
70 dnl Check if termcap is needed.
71 dnl This check must be done before anything is linked against S-Lang.
72 if test x"$found_slang" = x"yes"; then
73 CFLAGS="$saved_CFLAGS $ac_slang_inc_path $ac_slang_lib_path"
74 LDFLAGS="$saved_LDFLAGS $ac_slang_lib_path"
75 CPPFLAGS="$saved_CPPFLAGS $ac_slang_inc_path $ac_slang_lib_path"
78 if test x"$mc_cv_slang_termcap" = x"yes"; then
79 ac_slang_lib_path="$ac_slang_lib_path -ltermcap"
80 CFLAGS="$saved_CFLAGS $ac_slang_inc_path $ac_slang_lib_path"
81 CPPFLAGS="$saved_CPPFLAGS $ac_slang_inc_path $ac_slang_lib_path"
82 LDFLAGS="$saved_LDFLAGS $ac_slang_lib_path"
86 if test x"$found_slang" = x"yes"; then
87 unset ac_cv_lib_slang_SLang_init_tty
94 error_msg_slang="S-lang library not found"
98 dnl check if S-Lang have version 2.0 or newer
99 if test x"$found_slang" = x"yes"; then
100 AC_MSG_CHECKING([for S-Lang version 2.0 or newer])
102 #ifdef HAVE_SLANG_SLANG_H
103 #include <slang/slang.h>
109 #if SLANG_VERSION >= 20000
116 [mc_slang_is_valid_version=yes],
117 [mc_slang_is_valid_version=no],
118 [mc_slang_is_valid_version=no]
120 if test x$mc_slang_is_valid_version = xno; then
122 error_msg_slang="S-Lang library version 2.0 or newer not found"
124 AC_MSG_RESULT($mc_slang_is_valid_version)
127 dnl Unless external S-Lang was requested, reject S-Lang with UTF-8 hacks
128 if test x"$found_slang" = x"yes"; then
129 unset ac_cv_lib_slang_SLsmg_write_nwchars
132 [SLsmg_write_nwchars],
135 error_msg_slang="Rejecting S-Lang with UTF-8 support, it's not fully supported yet"
141 if test x"$found_slang" = x"yes"; then
143 screen_msg="S-Lang library (installed on the system)"
145 AC_DEFINE(HAVE_SLANG, 1,
146 [Define to use S-Lang library for screen management])
148 MCLIBS="$MCLIBS $ac_slang_lib_path -lslang"
150 CFLAGS="$saved_CFLAGS"
151 CPPFLAGS="$saved_CPPFLAGS"
152 LDFLAGS="$saved_LDFLAGS"
156 dnl Use the slang library.
158 AC_DEFUN([MC_WITH_SLANG], [
163 AC_ARG_WITH([slang-includes],
164 AC_HELP_STRING([--with-slang-includes=@<:@DIR@:>@],
165 [set path to SLANG includes @<:@default=/usr/include@:>@; may sense only if --with-screen=slang]
167 [ac_slang_inc_path="$withval"],
168 [ac_slang_inc_path=""]
171 AC_ARG_WITH([slang-libs],
172 AC_HELP_STRING([--with-slang-libs=@<:@DIR@:>@],
173 [set path to SLANG library @<:@default=/usr/lib@:>@; may sense only if --with-screen=slang]
175 [ac_slang_lib_path="$withval"],
176 [ac_slang_lib_path=""]
178 echo 'checking SLANG-headers in default place ...'
179 MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
180 if test x"$found_slang" = "xno"; then
181 ac_slang_inc_path="/usr/include"
182 ac_slang_lib_path="/usr/lib"
184 echo 'checking SLANG-headers in /usr ...'
185 MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
186 if test x"$found_slang" = "xno"; then
187 ac_slang_inc_path="/usr/local/include"
188 ac_slang_lib_path="/usr/local/lib"
190 echo 'checking SLANG-headers in /usr/local ...'
191 MC_CHECK_SLANG_BY_PATH( $ac_slang_inc_path , $ac_slang_lib_path )
192 if test x"$found_slang" = "xno"; then
193 AC_MSG_ERROR([$error_msg_slang])
201 dnl Use the ncurses library. It can only be requested explicitly,
202 dnl so just fail if anything goes wrong.
204 dnl If ncurses exports the ESCDELAY variable it should be set to 0
205 dnl or you'll have to press Esc three times to dismiss a dialog box.
207 AC_DEFUN([MC_WITH_NCURSES], [
208 dnl has_colors() is specific to ncurses, it's not in the old curses
212 AC_SEARCH_LIBS([addwstr], [ncursesw ncurses curses], [MCLIBS="$MCLIBS $LIBS";ncursesw_found=yes],
213 [AC_MSG_WARN([Cannot find ncurses library, that support wide characters])])
215 if test x"$ncursesw_found" = "x"; then
217 AC_SEARCH_LIBS([has_colors], [ncurses curses], [MCLIBS="$MCLIBS $LIBS"],
218 [AC_MSG_ERROR([Cannot find ncurses library])])
223 AC_CHECK_HEADERS([ncursesw/curses.h ncurses/curses.h ncurses.h curses.h],
224 [ncurses_h_found=yes; break])
226 if test x"$ncurses_h_found" = "x"; then
227 AC_MSG_ERROR([Cannot find ncurses header file])
231 screen_msg="ncurses library"
232 AC_DEFINE(USE_NCURSES, 1,
233 [Define to use ncurses for screen management])
235 AC_CACHE_CHECK([for ESCDELAY variable],
236 [mc_cv_ncurses_escdelay],
241 [mc_cv_ncurses_escdelay=yes],
242 [mc_cv_ncurses_escdelay=no])
244 if test x"$mc_cv_ncurses_escdelay" = xyes; then
245 AC_DEFINE(HAVE_ESCDELAY, 1,
246 [Define if ncurses has ESCDELAY variable])
249 AC_CHECK_FUNCS(resizeterm)
254 dnl Use the ncursesw library. It can only be requested explicitly,
255 dnl so just fail if anything goes wrong.
257 dnl If ncursesw exports the ESCDELAY variable it should be set to 0
258 dnl or you'll have to press Esc three times to dismiss a dialog box.
261 AC_DEFUN([MC_WITH_NCURSESW], [
262 dnl has_colors() is specific to ncurses, it's not in the old curses
265 AC_SEARCH_LIBS([has_colors], [ncursesw], [MCLIBS="$MCLIBS $LIBS"],
266 [AC_MSG_ERROR([Cannot find ncursesw library])])
270 AC_CHECK_HEADERS([ncursesw/curses.h],
271 [ncursesw_h_found=yes; break])
273 if test x"$ncursesw_h_found" = "x"; then
274 AC_MSG_ERROR([Cannot find ncursesw header file])
278 screen_msg="ncursesw library"
279 AC_DEFINE(USE_NCURSESW, 1,
280 [Define to use ncursesw for screen management])
282 AC_CACHE_CHECK([for ESCDELAY variable],
283 [mc_cv_ncursesw_escdelay],
288 [mc_cv_ncursesw_escdelay=yes],
289 [mc_cv_ncursesw_escdelay=no])
291 if test x"$mc_cv_ncursesw_escdelay" = xyes; then
292 AC_DEFINE(HAVE_ESCDELAY, 1,
293 [Define if ncursesw has ESCDELAY variable])
296 AC_CHECK_FUNCS(resizeterm)