+2006-12-13 Bruno Haible <bruno@clisp.org>
+
+ * lib/tparm.c: New file, based on a public-domain implementation part
+ of Cygwin.
+ * m4/termcap.m4 (gl_TERMCAP): AC_LIBOBJ of tparm.c if needed.
+ (gl_TERMCAP_BODY): Test whether the system has tparm().
+ * modules/termcap (Files): Add lib/tparm.c.
+ (Depends-on): Add c-ctype.
+
2006-12-13 Bruno Haible <bruno@clisp.org>
* modules/termcap-h (Include): Add termcap.h.
/* API provided by
- GNU ncurses in <term.h>, <curses.h>, <ncurses.h>,
- OSF/1 curses in <term.h>, <curses.h>,
- - Solaris, AIX, HP-UX, IRIX curses in <term.h>. */
+ - Solaris, AIX, HP-UX, IRIX curses in <term.h>,
+ - gnulib's replacement. */
/* Instantiates a string capability with format strings.
The return value is statically allocated and must not be freed. */
-# termcap.m4 serial 2 (gettext-0.16.2)
+# termcap.m4 serial 3 (gettext-0.16.2)
dnl Copyright (C) 2000-2002, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_DEFUN([gl_TERMCAP],
[
AC_REQUIRE([gl_TERMCAP_BODY])
+ if test $gl_func_tparam = no && test $gl_cv_func_tparm = no; then
+ AC_LIBOBJ([tparm])
+ fi
])
AC_DEFUN([gl_TERMCAP_BODY],
if test $gl_cv_func_tparam = yes; then
AC_DEFINE([HAVE_TPARAM], 1,
[Define if tparam() is among the termcap library functions.])
+ else
+ dnl Test whether a tparm() function is provided. It is missing e.g.
+ dnl in NetBSD 3.0 libtermcap.
+ AC_CACHE_CHECK([for tparm], [gl_cv_func_tparm], [
+ gl_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBTERMCAP"
+ gl_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $INCTERMCAP"
+ AC_TRY_LINK([extern
+ #ifdef __cplusplus
+ "C"
+ #endif
+ char * tparm (const char *, ...);
+ ], [return tparm ("\033\133%dm", 8);],
+ [gl_cv_func_tparm=yes], [gl_cv_func_tparm=no])
+ CPPFLAGS="$gl_save_CPPFLAGS"
+ LIBS="$gl_save_LIBS"
+ ])
fi
])