2010-06-16 11:24:00 +04:00
|
|
|
|
|
|
|
dnl Check the header
|
2016-01-04 21:43:19 +03:00
|
|
|
AC_DEFUN([mc_CHECK_SLANG_HEADER], [
|
2010-06-16 11:24:00 +04:00
|
|
|
AC_MSG_CHECKING([for slang/slang.h])
|
|
|
|
AC_PREPROC_IFELSE(
|
|
|
|
[
|
2012-08-10 10:32:58 +04:00
|
|
|
AC_LANG_PROGRAM([#include <slang/slang.h>], [return 0;])
|
2010-06-16 11:24:00 +04:00
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT(yes)
|
2012-08-10 10:32:58 +04:00
|
|
|
AC_DEFINE(HAVE_SLANG_SLANG_H, 1, [Define to use slang.h])
|
2010-06-16 11:24:00 +04:00
|
|
|
found_slang=yes
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
]
|
|
|
|
)
|
|
|
|
])
|
|
|
|
|
2010-06-16 10:51:00 +04:00
|
|
|
dnl
|
|
|
|
dnl Check if the system S-Lang library can be used.
|
|
|
|
dnl If not, and $1 is "strict", exit.
|
|
|
|
dnl
|
2016-01-04 21:43:19 +03:00
|
|
|
AC_DEFUN([mc_CHECK_SLANG_BY_PATH], [
|
2010-06-16 10:51:00 +04:00
|
|
|
|
|
|
|
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"
|
|
|
|
|
2012-11-14 10:23:11 +04:00
|
|
|
CPPFLAGS="$saved_CPPFLAGS $ac_slang_inc_path"
|
|
|
|
LDFLAGS="$saved_LDFLAGS $ac_slang_lib_path"
|
2010-06-16 10:51:00 +04:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([for slang.h])
|
|
|
|
AC_PREPROC_IFELSE(
|
|
|
|
[
|
2012-08-10 10:32:58 +04:00
|
|
|
AC_LANG_PROGRAM([#include <slang.h>], [return 0;])
|
2010-06-16 10:51:00 +04:00
|
|
|
],
|
|
|
|
[
|
|
|
|
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
|
2012-08-10 10:32:58 +04:00
|
|
|
AC_DEFINE(HAVE_SLANG_H, 1, [Define to use slang.h])
|
2010-06-16 10:51:00 +04:00
|
|
|
|
|
|
|
],
|
|
|
|
[
|
|
|
|
AC_MSG_RESULT(no)
|
2010-06-16 11:24:00 +04:00
|
|
|
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_CHECK_SLANG_HEADER
|
2010-06-16 11:24:00 +04:00
|
|
|
if test x"$found_slang" = xno; then
|
2012-08-10 10:32:58 +04:00
|
|
|
error_msg_slang="S-Lang header not found"
|
2010-06-16 11:24:00 +04:00
|
|
|
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
|
2012-11-14 10:23:11 +04:00
|
|
|
CPPFLAGS="-DHAVE_SLANG_SLANG_H $CPPFLAGS"
|
2010-06-16 11:24:00 +04:00
|
|
|
fi
|
2010-06-16 10:51:00 +04:00
|
|
|
],
|
|
|
|
)
|
|
|
|
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])
|
2011-08-09 01:29:00 +04:00
|
|
|
AC_RUN_IFELSE([AC_LANG_SOURCE([
|
2010-06-16 10:51:00 +04:00
|
|
|
#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
|
|
|
|
}
|
2011-08-09 01:29:00 +04:00
|
|
|
])],
|
2010-06-16 10:51:00 +04:00
|
|
|
[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
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_SLANG_TERMCAP
|
2010-06-16 10:51:00 +04:00
|
|
|
if test x"$mc_cv_slang_termcap" = x"yes"; then
|
2012-11-14 10:23:11 +04:00
|
|
|
saved_CPPFLAGS="$saved_CPPFLAGS "
|
2010-06-16 10:51:00 +04:00
|
|
|
saved_LDFLAGS="-ltermcap $saved_LDFLAGS"
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl Check the library
|
2012-08-10 10:32:58 +04:00
|
|
|
unset ac_cv_lib_slang_SLang_init_tty
|
2010-06-16 10:51:00 +04:00
|
|
|
AC_CHECK_LIB(
|
|
|
|
[slang],
|
|
|
|
[SLang_init_tty],
|
|
|
|
[:],
|
|
|
|
[
|
|
|
|
found_slang=no
|
2012-08-10 10:32:58 +04:00
|
|
|
error_msg_slang="S-Lang library not found"
|
2010-06-16 10:51:00 +04:00
|
|
|
]
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test x"$found_slang" = x"yes"; then
|
|
|
|
MCLIBS="$ac_slang_lib_path -lslang $MCLIBS"
|
|
|
|
dnl do not reset CPPFLAGS
|
2012-11-14 10:23:11 +04:00
|
|
|
dnl if CPPFLAGS are reset then cpp does not find the specified header
|
|
|
|
CPPFLAGS="$ac_slang_inc_path $saved_CPPFLAGS"
|
2010-06-16 10:51:00 +04:00
|
|
|
LDFLAGS="$saved_LDFLAGS"
|
|
|
|
else
|
|
|
|
CPPFLAGS="$saved_CPPFLAGS"
|
|
|
|
LDFLAGS="$saved_LDFLAGS"
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Use the slang library.
|
|
|
|
dnl
|
2016-01-04 21:43:19 +03:00
|
|
|
AC_DEFUN([mc_WITH_SLANG], [
|
2010-06-16 10:51:00 +04:00
|
|
|
with_screen=slang
|
|
|
|
found_slang=yes
|
|
|
|
error_msg_slang=""
|
|
|
|
|
|
|
|
AC_ARG_WITH([slang-includes],
|
2011-05-25 17:51:18 +04:00
|
|
|
AS_HELP_STRING([--with-slang-includes=@<:@DIR@:>@],
|
2012-08-10 10:32:58 +04:00
|
|
|
[set path to S-Lang includes @<:@default=/usr/include@:>@; make sense only if --with-screen=slang]
|
2010-06-16 10:51:00 +04:00
|
|
|
),
|
|
|
|
[ac_slang_inc_path="$withval"],
|
|
|
|
[ac_slang_inc_path=""]
|
|
|
|
)
|
|
|
|
|
|
|
|
AC_ARG_WITH([slang-libs],
|
2011-05-25 17:51:18 +04:00
|
|
|
AS_HELP_STRING([--with-slang-libs=@<:@DIR@:>@],
|
2012-08-10 10:32:58 +04:00
|
|
|
[set path to S-Lang library @<:@default=/usr/lib@:>@; make sense only if --with-screen=slang]
|
2010-06-16 10:51:00 +04:00
|
|
|
),
|
|
|
|
[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
|
2012-08-10 10:32:58 +04:00
|
|
|
echo 'checking S-Lang headers in specified place ...'
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
|
2010-06-16 10:51:00 +04:00
|
|
|
else
|
|
|
|
found_slang=no
|
|
|
|
PKG_CHECK_MODULES(SLANG, [slang >= 2.0], [found_slang=yes], [:])
|
|
|
|
if test x"$found_slang" = "xyes"; then
|
2010-06-16 11:24:00 +04:00
|
|
|
MCLIBS="$pkg_cv_SLANG_LIBS $MCLIBS"
|
2012-11-14 10:23:11 +04:00
|
|
|
CPPFLAGS="$pkg_cv_SLANG_CFLAGS $CPPFLAGS"
|
2010-06-16 10:51:00 +04:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test x"$found_slang" = "xno"; then
|
|
|
|
found_slang=yes
|
|
|
|
ac_slang_inc_path="/usr/include"
|
|
|
|
ac_slang_lib_path="/usr/lib"
|
|
|
|
|
2012-08-10 10:32:58 +04:00
|
|
|
echo 'checking S-Lang headers in /usr ...'
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
|
2010-06-16 10:51:00 +04:00
|
|
|
if test x"$found_slang" = "xno"; then
|
|
|
|
found_slang=yes
|
|
|
|
ac_slang_inc_path="/usr/local/include"
|
|
|
|
ac_slang_lib_path="/usr/local/lib"
|
|
|
|
|
2012-08-10 10:32:58 +04:00
|
|
|
echo 'checking S-Lang headers in /usr/local ...'
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_CHECK_SLANG_BY_PATH( $ac_slang_inc_path , $ac_slang_lib_path )
|
2010-06-16 10:51:00 +04:00
|
|
|
if test x"$found_slang" = "xno"; then
|
|
|
|
AC_MSG_ERROR([$error_msg_slang])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2016-03-16 19:47:22 +03:00
|
|
|
screen_type=slang
|
2016-03-19 10:58:00 +03:00
|
|
|
screen_msg="S-Lang"
|
2012-08-10 10:32:58 +04:00
|
|
|
AC_DEFINE(HAVE_SLANG, 1, [Define to use S-Lang library for screen management])
|
2010-06-16 11:24:00 +04:00
|
|
|
|
2016-01-04 21:43:19 +03:00
|
|
|
mc_CHECK_SLANG_HEADER
|
2010-06-16 10:51:00 +04:00
|
|
|
])
|