+ If it is installed in a nonstandard directory, pass the option
--with-libintl-prefix=DIR to 'configure'.
-* GNU ncurses (preferred) or libtermcap (discouraged).
- + Required.
- Needed for the --color option of the various programs.
+* GNU ncurses (preferred)
+ or libtermcap (discouraged) or a curses library (legacy).
+ + Highly recommended.
+ Needed for the --color option of the 'msgcat' program.
+ Homepage:
http://www.gnu.org/software/ncurses/
+ Download:
+2006-12-23 Bruno Haible <bruno@clisp.org>
+
+ Support platforms with neither terminfo nor termcap functions, like
+ mingw.
+ * lib/tputs.c: New file.
+
+ * modules/termcap (Files): Add lib/tputs.c.
+ * m4/termcap.m4 (gl_TERMCAP): Add tputs replacement.
+ (gl_TERMCAP_BODY): Define HAVE_TERMCAP if tgetent is available.
+ * lib/termcap.h (tgetent, tgetnum, tgetflag, tgetstr): Declare only
+ if HAVE_TERMCAP.
+ (tgoto): Declare only if HAVE_TERMCAP || HAVE_TERMINFO.
+
+ * modules/terminfo (Files): Add lib/tputs.c.
+ * m4/terminfo.m4 (gl_TERMINFO): Add tputs replacement.
+ (gl_TERMINFO_BODY): Define HAVE_TERMCAP if tgetent is available.
+ * lib/terminfo.h (tgetent, tgetnum, tgetflag, tgetstr): Declare only
+ if HAVE_TERMCAP.
+ (tgoto): Declare only if HAVE_TERMINFO || HAVE_TERMCAP.
+
+ * lib/term-ostream.oo.c (term_ostream_create): Use ANSI color escape
+ sequences when neither terminfo nor termcap functions exist.
+ * Makefile.am (EXTRA_DIST): Add lib/tputs.c.
+
2006-12-23 Bruno Haible <bruno@clisp.org>
Improve cross-compilation support.
lib/termcap.h \
lib/terminfo.h \
lib/tparm.c \
+lib/tputs.c \
lib/vasprintf.c \
lib/xalloc.h \
lib/xerror.c \
stream->exit_underline_mode = xstrdup0 (tigetstr ("rmul"));
stream->exit_attribute_mode = xstrdup0 (tigetstr ("sgr0"));
}
-#else
+#elif HAVE_TERMCAP
struct { char buf[1024]; char canary[4]; } termcapbuf;
int retval;
/* Buffer overflow! */
abort ();
}
+#else
+ /* Fallback code for platforms with neither the terminfo nor the termcap
+ functions, such as mingw.
+ Assume the ANSI escape sequences. Extracted through
+ "TERM=ansi infocmp", replacing \E with \033. */
+ stream->max_colors = 8;
+ stream->no_color_video = 3;
+ stream->set_a_foreground = xstrdup ("\033[3%p1%dm");
+ stream->set_a_background = xstrdup ("\033[4%p1%dm");
+ stream->orig_pair = xstrdup ("\033[39;49m");
+ stream->enter_bold_mode = xstrdup ("\033[1m");
+ stream->enter_underline_mode = xstrdup ("\033[4m");
+ stream->exit_underline_mode = xstrdup ("\033[m");
+ stream->exit_attribute_mode = xstrdup ("\033[0;10m");
#endif
/* AIX 4.3.2, IRIX 6.5, HP-UX 11, Solaris 7..10 all lack the
extern "C" {
#endif
+#if HAVE_TERMCAP
+
/* Gets the capability information for terminal type TYPE.
Returns 1 if successful, 0 if TYPE is unknown, -1 on other error. */
extern int tgetent (char *bp, const char *type);
Also, if AREA != NULL, stores it at *AREA and advances *AREA. */
extern const char * tgetstr (const char *id, char **area);
+#endif
+
#if HAVE_TERMINFO
/* Gets the capability information for terminal type TYPE and prepares FD.
#endif
+#if HAVE_TERMCAP || HAVE_TERMINFO
+
/* Retrieves a string that causes cursor positioning to (column, row).
This function is necessary because the string returned by tgetstr ("cm")
is in a special format. */
extern const char * tgoto (const char *cm, int column, int row);
+#endif
+
/* Retrieves the value of a string capability.
OUTCHARFUN is called in turn for each 'char' of the result.
This function is necessary because string capabilities can contain
Returns NULL if it is not available, (char *)(-1) if ID is invalid. */
extern const char * tigetstr (const char *id);
-#else
+#elif HAVE_TERMCAP
/* Gets the capability information for terminal type TYPE.
Returns 1 if successful, 0 if TYPE is unknown, -1 on other error. */
#endif
+#if HAVE_TERMINFO || HAVE_TERMCAP
+
/* Retrieves a string that causes cursor positioning to (column, row).
This function is necessary because the string returned by tgetstr ("cm")
is in a special format. */
extern const char * tgoto (const char *cm, int column, int row);
+#endif
+
/* Retrieves the value of a string capability.
OUTCHARFUN is called in turn for each 'char' of the result.
This function is necessary because string capabilities can contain
-# termcap.m4 serial 5 (gettext-0.16.2)
+# termcap.m4 serial 6 (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,
if test $gl_cv_termcap_tparam = no && test $gl_cv_termcap_tparm = no; then
AC_LIBOBJ([tparm])
fi
+ case "$gl_cv_termcap" in
+ no*)
+ AC_LIBOBJ([tputs])
+ ;;
+ esac
])
AC_DEFUN([gl_TERMCAP_BODY],
dnl tigetstr(), tigetflag() in the same library.
dnl Some systems, like BeOS, use GNU termcap, which has tparam() instead of
dnl tparm().
+ dnl Some systems, like mingw, have nothing at all.
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
libtermcap)
;;
esac
+ case "$gl_cv_termcap" in
+ libc | libncurses | libtermcap)
+ AC_DEFINE([HAVE_TERMCAP], 1,
+ [Define if tgetent(), tgetnum(), tgetstr(), tgetflag()
+ are among the termcap library functions.])
+ ;;
+ esac
AC_SUBST([LIBTERMCAP])
AC_SUBST([LTLIBTERMCAP])
AC_SUBST([INCTERMCAP])
-# terminfo.m4 serial 1 (gettext-0.16.2)
+# terminfo.m4 serial 2 (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,
if test $gl_cv_terminfo_tparam = no && test $gl_cv_terminfo_tparm = no; then
AC_LIBOBJ([tparm])
fi
+ case "$gl_cv_terminfo" in
+ no*)
+ case "$gl_cv_termcap" in
+ no*)
+ AC_LIBOBJ([tputs])
+ ;;
+ esac
+ ;;
+ esac
])
AC_DEFUN([gl_TERMINFO_BODY],
dnl they have only a libtermcap.
dnl Some systems, like BeOS, use GNU termcap, which has tparam() instead of
dnl tparm().
+ dnl Some systems, like mingw, have nothing at all.
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
INCTERMINFO="$INCTERMCAP"
;;
esac
+ case "$gl_cv_termcap" in
+ libc | libncurses | libtermcap)
+ AC_DEFINE([HAVE_TERMCAP], 1,
+ [Define if tgetent(), tgetnum(), tgetstr(), tgetflag()
+ are among the termcap library functions.])
+ ;;
+ esac
;;
esac
AC_SUBST([LIBTERMINFO])
Files:
m4/termcap.m4
lib/tparm.c
+lib/tputs.c
Depends-on:
havelib
Files:
m4/terminfo.m4
lib/tparm.c
+lib/tputs.c
Depends-on:
havelib