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_CPPFLAGS="$CPPFLAGS"
38 saved_LDFLAGS="$LDFLAGS"
40 CPPFLAGS="$saved_CPPFLAGS $ac_slang_inc_path"
41 LDFLAGS="$saved_LDFLAGS $ac_slang_lib_path"
43 AC_MSG_CHECKING([for slang.h])
46 AC_LANG_PROGRAM([#include <slang.h>], [return 0;])
50 if test x"$ac_slang_inc_path" = x; then
51 ac_slang_inc_path="-I/usr/include"
53 if test x"$ac_slang_lib_path" = x; then
54 ac_slang_lib_path="-L/usr/lib"
57 AC_DEFINE(HAVE_SLANG_H, 1, [Define to use slang.h])
64 if test x"$found_slang" = xno; then
65 error_msg_slang="S-Lang header not found"
67 if test x"$ac_slang_inc_path" = x; then
68 ac_slang_inc_path="-I/usr/include"
70 if test x"$ac_slang_lib_path" = x; then
71 ac_slang_lib_path="-L/usr/lib"
73 CPPFLAGS="-DHAVE_SLANG_SLANG_H $CPPFLAGS"
77 dnl check if S-Lang have version 2.0 or newer
78 if test x"$found_slang" = x"yes"; then
79 AC_MSG_CHECKING([for S-Lang version 2.0 or newer])
80 AC_RUN_IFELSE([AC_LANG_SOURCE([
81 #ifdef HAVE_SLANG_SLANG_H
82 #include <slang/slang.h>
88 #if SLANG_VERSION >= 20000
95 [mc_slang_is_valid_version=yes],
96 [mc_slang_is_valid_version=no],
98 if test -f "$param_slang_inc_path/slang/slang.h" ; then
99 hdr_file="$param_slang_inc_path/slang/slang.h"
101 hdr_file="$param_slang_inc_path/slang.h"
103 mc_slang_is_valid_version=`grep '^#define SLANG_VERSION[[:space:]]' "$hdr_file"| sed s'/^#define SLANG_VERSION[[:space:]]*//'`
104 if test "$mc_slang_is_valid_version" -ge "20000"; then
105 mc_slang_is_valid_version=yes
107 mc_slang_is_valid_version=no
111 if test x$mc_slang_is_valid_version = xno; then
113 error_msg_slang="S-Lang library version 2.0 or newer not found"
115 AC_MSG_RESULT($mc_slang_is_valid_version)
117 dnl Check if termcap is needed.
118 dnl This check must be done before anything is linked against S-Lang.
119 if test x"$found_slang" = x"yes"; then
121 if test x"$mc_cv_slang_termcap" = x"yes"; then
122 saved_CPPFLAGS="$saved_CPPFLAGS "
123 saved_LDFLAGS="-ltermcap $saved_LDFLAGS"
126 dnl Check the library
127 unset ac_cv_lib_slang_SLang_init_tty
134 error_msg_slang="S-Lang library not found"
139 if test x"$found_slang" = x"yes"; then
140 MCLIBS="$ac_slang_lib_path -lslang $MCLIBS"
141 dnl do not reset CPPFLAGS
142 dnl if CPPFLAGS are reset then cpp does not find the specified header
143 CPPFLAGS="$ac_slang_inc_path $saved_CPPFLAGS"
144 LDFLAGS="$saved_LDFLAGS"
146 CPPFLAGS="$saved_CPPFLAGS"
147 LDFLAGS="$saved_LDFLAGS"
152 dnl Use the slang library.
154 AC_DEFUN([mc_WITH_SLANG], [
159 AC_ARG_WITH([slang-includes],
160 AS_HELP_STRING([--with-slang-includes=@<:@DIR@:>@],
161 [set path to S-Lang includes @<:@default=/usr/include@:>@; make sense only if --with-screen=slang]
163 [ac_slang_inc_path="$withval"],
164 [ac_slang_inc_path=""]
167 AC_ARG_WITH([slang-libs],
168 AS_HELP_STRING([--with-slang-libs=@<:@DIR@:>@],
169 [set path to S-Lang library @<:@default=/usr/lib@:>@; make sense only if --with-screen=slang]
171 [ac_slang_lib_path="$withval"],
172 [ac_slang_lib_path=""]
174 if test x"$ac_slang_lib_path" != x -o x"$ac_slang_inc_path" != x; then
175 echo 'checking S-Lang headers in specified place ...'
176 mc_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
179 PKG_CHECK_MODULES(SLANG, [slang >= 2.0], [found_slang=yes], [:])
180 if test x"$found_slang" = "xyes"; then
181 MCLIBS="$pkg_cv_SLANG_LIBS $MCLIBS"
182 CPPFLAGS="$pkg_cv_SLANG_CFLAGS $CPPFLAGS"
186 if test x"$found_slang" = "xno"; then
188 ac_slang_inc_path="/usr/include"
189 ac_slang_lib_path="/usr/lib"
191 echo 'checking S-Lang headers in /usr ...'
192 mc_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
193 if test x"$found_slang" = "xno"; then
195 ac_slang_inc_path="/usr/local/include"
196 ac_slang_lib_path="/usr/local/lib"
198 echo 'checking S-Lang headers in /usr/local ...'
199 mc_CHECK_SLANG_BY_PATH( $ac_slang_inc_path , $ac_slang_lib_path )
200 if test x"$found_slang" = "xno"; then
201 AC_MSG_ERROR([$error_msg_slang])
208 AC_DEFINE(HAVE_SLANG, 1, [Define to use S-Lang library for screen management])
210 mc_CHECK_SLANG_HEADER