1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
|
dnl Check the header
AC_DEFUN([mc_CHECK_SLANG_HEADER], [
AC_MSG_CHECKING([for slang/slang.h])
AC_PREPROC_IFELSE(
[
AC_LANG_PROGRAM([#include <slang/slang.h>], [return 0;])
],
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SLANG_SLANG_H, 1, [Define to use slang.h])
found_slang=yes
],
[
AC_MSG_RESULT(no)
]
)
])
dnl
dnl Check if the system S-Lang library can be used.
dnl If not, and $1 is "strict", exit.
dnl
AC_DEFUN([mc_CHECK_SLANG_BY_PATH], [
param_slang_inc_path=[$1]
param_slang_lib_path=[$2]
if test x"$param_slang_inc_path" != x; then
ac_slang_inc_path="-I"$param_slang_inc_path
fi
if test x"$param_slang_lib_path" != x; then
ac_slang_lib_path="-L"$param_slang_lib_path
fi
saved_CPPFLAGS="$CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
CPPFLAGS="$saved_CPPFLAGS $ac_slang_inc_path"
LDFLAGS="$saved_LDFLAGS $ac_slang_lib_path"
AC_MSG_CHECKING([for slang.h])
AC_PREPROC_IFELSE(
[
AC_LANG_PROGRAM([#include <slang.h>], [return 0;])
],
[
AC_MSG_RESULT(yes)
if test x"$ac_slang_inc_path" = x; then
ac_slang_inc_path="-I/usr/include"
fi
if test x"$ac_slang_lib_path" = x; then
ac_slang_lib_path="-L/usr/lib"
fi
found_slang=yes
AC_DEFINE(HAVE_SLANG_H, 1, [Define to use slang.h])
],
[
AC_MSG_RESULT(no)
mc_CHECK_SLANG_HEADER
if test x"$found_slang" = xno; then
error_msg_slang="S-Lang header not found"
else
if test x"$ac_slang_inc_path" = x; then
ac_slang_inc_path="-I/usr/include"
fi
if test x"$ac_slang_lib_path" = x; then
ac_slang_lib_path="-L/usr/lib"
fi
CPPFLAGS="-DHAVE_SLANG_SLANG_H $CPPFLAGS"
fi
],
)
dnl check if S-Lang have version 2.0 or newer
if test x"$found_slang" = x"yes"; then
AC_MSG_CHECKING([for S-Lang version 2.0 or newer])
AC_RUN_IFELSE([AC_LANG_SOURCE([
#ifdef HAVE_SLANG_SLANG_H
#include <slang/slang.h>
#else
#include <slang.h>
#endif
int main (void)
{
#if SLANG_VERSION >= 20000
return 0;
#else
return 1;
#endif
}
])],
[mc_slang_is_valid_version=yes],
[mc_slang_is_valid_version=no],
[
if test -f "$param_slang_inc_path/slang/slang.h" ; then
hdr_file="$param_slang_inc_path/slang/slang.h"
else
hdr_file="$param_slang_inc_path/slang.h"
fi
mc_slang_is_valid_version=`grep '^#define SLANG_VERSION[[:space:]]' "$hdr_file"| sed s'/^#define SLANG_VERSION[[:space:]]*//'`
if test "$mc_slang_is_valid_version" -ge "20000"; then
mc_slang_is_valid_version=yes
else
mc_slang_is_valid_version=no
fi
]
)
if test x$mc_slang_is_valid_version = xno; then
found_slang=no
error_msg_slang="S-Lang library version 2.0 or newer not found"
fi
AC_MSG_RESULT($mc_slang_is_valid_version)
fi
dnl Check if termcap is needed.
dnl This check must be done before anything is linked against S-Lang.
if test x"$found_slang" = x"yes"; then
mc_SLANG_TERMCAP
if test x"$mc_cv_slang_termcap" = x"yes"; then
saved_CPPFLAGS="$saved_CPPFLAGS "
saved_LDFLAGS="-ltermcap $saved_LDFLAGS"
fi
dnl Check the library
unset ac_cv_lib_slang_SLang_init_tty
AC_CHECK_LIB(
[slang],
[SLang_init_tty],
[:],
[
found_slang=no
error_msg_slang="S-Lang library not found"
]
)
fi
if test x"$found_slang" = x"yes"; then
MCLIBS="$ac_slang_lib_path -lslang $MCLIBS"
dnl do not reset CPPFLAGS
dnl if CPPFLAGS are reset then cpp does not find the specified header
CPPFLAGS="$ac_slang_inc_path $saved_CPPFLAGS"
LDFLAGS="$saved_LDFLAGS"
else
CPPFLAGS="$saved_CPPFLAGS"
LDFLAGS="$saved_LDFLAGS"
fi
])
dnl
dnl Use the slang library.
dnl
AC_DEFUN([mc_WITH_SLANG], [
with_screen=slang
found_slang=yes
error_msg_slang=""
AC_ARG_WITH([slang-includes],
AS_HELP_STRING([--with-slang-includes=@<:@DIR@:>@],
[set path to S-Lang includes @<:@default=/usr/include@:>@; make sense only if --with-screen=slang]
),
[ac_slang_inc_path="$withval"],
[ac_slang_inc_path=""]
)
AC_ARG_WITH([slang-libs],
AS_HELP_STRING([--with-slang-libs=@<:@DIR@:>@],
[set path to S-Lang library @<:@default=/usr/lib@:>@; make sense only if --with-screen=slang]
),
[ac_slang_lib_path="$withval"],
[ac_slang_lib_path=""]
)
if test x"$ac_slang_lib_path" != x -o x"$ac_slang_inc_path" != x; then
echo 'checking S-Lang headers in specified place ...'
mc_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
else
found_slang=no
PKG_CHECK_MODULES(SLANG, [slang >= 2.0], [found_slang=yes], [:])
if test x"$found_slang" = "xyes"; then
MCLIBS="$pkg_cv_SLANG_LIBS $MCLIBS"
CPPFLAGS="$pkg_cv_SLANG_CFLAGS $CPPFLAGS"
fi
fi
if test x"$found_slang" = "xno"; then
found_slang=yes
ac_slang_inc_path="/usr/include"
ac_slang_lib_path="/usr/lib"
echo 'checking S-Lang headers in /usr ...'
mc_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
if test x"$found_slang" = "xno"; then
found_slang=yes
ac_slang_inc_path="/usr/local/include"
ac_slang_lib_path="/usr/local/lib"
echo 'checking S-Lang headers in /usr/local ...'
mc_CHECK_SLANG_BY_PATH( $ac_slang_inc_path , $ac_slang_lib_path )
if test x"$found_slang" = "xno"; then
AC_MSG_ERROR([$error_msg_slang])
fi
fi
fi
screen_type=slang
screen_msg="S-Lang"
AC_DEFINE(HAVE_SLANG, 1, [Define to use S-Lang library for screen management])
mc_CHECK_SLANG_HEADER
])
|