dnl CF_SLANG_UNIX_DEFS version: 5 updated: 2010/09/26 10:23:14
dnl ------------------
dnl Slang's header files rely on some predefined symbols to declare variables
dnl that we might find useful.  This check is needed, because those symbols
dnl are generally not available.
AC_DEFUN([CF_SLANG_UNIX_DEFS],
[

CF_SLANG_CPPFLAGS(slang)
if test "x$cf_cv_slang_header" != xno
then
	CF_SLANG_LIBS(slang)
else
	CF_SLANG_CPPFLAGS(slang2)
	if test "x$cf_cv_slang2_header" != xno
	then
		CF_SLANG_LIBS(slang2)
	else
		AC_MSG_ERROR(cannot find slang headers)
	fi
fi

# There's an unofficial set of patches for slang that gives it some limited
# UTF8 capability.  Unfortunately it won't compile unless one defines UTF8.
AC_CACHE_CHECK(if we must define UTF8,cf_cv_slang_utf8,[
	AC_TRY_COMPILE([#include <slang.h>],
	[SLtt_get_screen_size()],
	[cf_cv_slang_utf8=no],
	[
	AC_TRY_COMPILE([
#define UTF8
#include <slang.h>],
	[SLtt_get_screen_size()],
	[cf_cv_slang_utf8=yes],
	[cf_cv_slang_utf8=unknown])])
])

if test "$cf_cv_slang_utf8" = yes ; then
	AC_DEFINE(UTF8)
fi

AC_CACHE_CHECK(if we must tell slang this is UNIX,cf_cv_slang_unix,[
AC_TRY_LINK([#include <slang.h>],
	[
#ifdef REAL_UNIX_SYSTEM
make an error
#else
extern int SLang_TT_Baud_Rate;
SLang_TT_Baud_Rate = 1
#endif
],
	[cf_cv_slang_unix=yes],
	[cf_cv_slang_unix=no])
])
test $cf_cv_slang_unix = yes && AC_DEFINE(REAL_UNIX_SYSTEM)

CF_CHECK_TYPE(SLsmg_Color_Type,int,[#include <slang.h>])
CF_CHECK_TYPE(SLtt_Char_Type,unsigned long,[#include <slang.h>])
])dnl
