3 AC_DEFUN([MC_CHECK_SLANG_HEADER], [
4 AC_MSG_CHECKING([for slang/slang.h])
7 AC_LANG_PROGRAM([#include <slang/slang.h>], [return 0;])
11 AC_DEFINE(HAVE_SLANG_SLANG_H, 1, [Define to use slang.h])
21 dnl Check if the system S-Lang library can be used.
22 dnl If not, and $1 is "strict", exit.
24 AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [
26 param_slang_inc_path=[$1]
27 param_slang_lib_path=[$2]
29 if test x"$param_slang_inc_path" != x; then
30 ac_slang_inc_path="-I"$param_slang_inc_path
33 if test x"$param_slang_lib_path" != x; then
34 ac_slang_lib_path="-L"$param_slang_lib_path
37 saved_CFLAGS="$CFLAGS"
38 saved_CPPFLAGS="$CPPFLAGS"
39 saved_LDFLAGS="$LDFLAGS"
41 CFLAGS="$CFLAGS $ac_slang_inc_path $ac_slang_lib_path"
42 CPPFLAGS="$saved_CPPFLAGS $ac_slang_inc_path $ac_slang_lib_path"
44 AC_MSG_CHECKING([for slang.h])
47 AC_LANG_PROGRAM([#include <slang.h>], [return 0;])
51 if test x"$ac_slang_inc_path" = x; then
52 ac_slang_inc_path="-I/usr/include"
54 if test x"$ac_slang_lib_path" = x; then
55 ac_slang_lib_path="-L/usr/lib"
58 AC_DEFINE(HAVE_SLANG_H, 1, [Define to use slang.h])
65 if test x"$found_slang" = xno; then
66 error_msg_slang="S-Lang header not found"
68 if test x"$ac_slang_inc_path" = x; then
69 ac_slang_inc_path="-I/usr/include"
71 if test x"$ac_slang_lib_path" = x; then
72 ac_slang_lib_path="-L/usr/lib"
74 CFLAGS="-DHAVE_SLANG_SLANG_H $CFLAGS"
78 dnl check if S-Lang have version 2.0 or newer
79 if test x"$found_slang" = x"yes"; then
80 AC_MSG_CHECKING([for S-Lang version 2.0 or newer])
81 AC_RUN_IFELSE([AC_LANG_SOURCE([
82 #ifdef HAVE_SLANG_SLANG_H
83 #include <slang/slang.h>
89 #if SLANG_VERSION >= 20000
96 [mc_slang_is_valid_version=yes],
97 [mc_slang_is_valid_version=no],
99 if test -f "$param_slang_inc_path/slang/slang.h" ; then
100 hdr_file="$param_slang_inc_path/slang/slang.h"
102 hdr_file="$param_slang_inc_path/slang.h"
104 mc_slang_is_valid_version=`grep '^#define SLANG_VERSION[[:space:]]' "$hdr_file"| sed s'/^#define SLANG_VERSION[[:space:]]*//'`
105 if test "$mc_slang_is_valid_version" -ge "20000"; then
106 mc_slang_is_valid_version=yes
108 mc_slang_is_valid_version=no
112 if test x$mc_slang_is_valid_version = xno; then
114 error_msg_slang="S-Lang library version 2.0 or newer not found"
116 AC_MSG_RESULT($mc_slang_is_valid_version)
118 dnl Check if termcap is needed.
119 dnl This check must be done before anything is linked against S-Lang.
120 if test x"$found_slang" = x"yes"; then
122 if test x"$mc_cv_slang_termcap" = x"yes"; then
123 saved_CPPFLAGS="-ltermcap $saved_CPPFLAGS "
124 saved_LDFLAGS="-ltermcap $saved_LDFLAGS"
127 dnl Check the library
128 unset ac_cv_lib_slang_SLang_init_tty
135 error_msg_slang="S-Lang library not found"
140 if test x"$found_slang" = x"yes"; then
142 screen_msg="S-Lang library"
144 MCLIBS="$ac_slang_lib_path -lslang $MCLIBS"
145 CFLAGS="$ac_slang_inc_path $saved_CFLAGS"
146 dnl do not reset CPPFLAGS
147 dnl - if CPPFLAGS are reset then cpp does not find the specified header
148 LDFLAGS="$saved_LDFLAGS"
150 CFLAGS="$saved_CFLAGS"
151 CPPFLAGS="$saved_CPPFLAGS"
152 LDFLAGS="$saved_LDFLAGS"
157 dnl Use the slang library.
159 AC_DEFUN([MC_WITH_SLANG], [
164 AC_ARG_WITH([slang-includes],
165 AS_HELP_STRING([--with-slang-includes=@<:@DIR@:>@],
166 [set path to S-Lang includes @<:@default=/usr/include@:>@; make sense only if --with-screen=slang]
168 [ac_slang_inc_path="$withval"],
169 [ac_slang_inc_path=""]
172 AC_ARG_WITH([slang-libs],
173 AS_HELP_STRING([--with-slang-libs=@<:@DIR@:>@],
174 [set path to S-Lang library @<:@default=/usr/lib@:>@; make sense only if --with-screen=slang]
176 [ac_slang_lib_path="$withval"],
177 [ac_slang_lib_path=""]
179 if test x"$ac_slang_lib_path" != x -o x"$ac_slang_inc_path" != x; then
180 echo 'checking S-Lang headers in specified place ...'
181 MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
184 PKG_CHECK_MODULES(SLANG, [slang >= 2.0], [found_slang=yes], [:])
185 if test x"$found_slang" = "xyes"; then
186 MCLIBS="$pkg_cv_SLANG_LIBS $MCLIBS"
187 CFLAGS="$pkg_cv_SLANG_CFLAGS $CFLAGS"
191 if test x"$found_slang" = "xno"; then
193 ac_slang_inc_path="/usr/include"
194 ac_slang_lib_path="/usr/lib"
196 echo 'checking S-Lang headers in /usr ...'
197 MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
198 if test x"$found_slang" = "xno"; then
200 ac_slang_inc_path="/usr/local/include"
201 ac_slang_lib_path="/usr/local/lib"
203 echo 'checking S-Lang headers in /usr/local ...'
204 MC_CHECK_SLANG_BY_PATH( $ac_slang_inc_path , $ac_slang_lib_path )
205 if test x"$found_slang" = "xno"; then
206 AC_MSG_ERROR([$error_msg_slang])
211 AC_DEFINE(HAVE_SLANG, 1, [Define to use S-Lang library for screen management])
213 MC_CHECK_SLANG_HEADER