]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Support platforms that lack tparm().
authorBruno Haible <bruno@clisp.org>
Thu, 14 Dec 2006 12:35:16 +0000 (12:35 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:14:28 +0000 (12:14 +0200)
gnulib-local/ChangeLog
gnulib-local/lib/termcap.h
gnulib-local/m4/termcap.m4
gnulib-local/modules/termcap

index 1532aa0f42c9e781d89ad961f820488bab586944..26b8e7fd5a3c05bb273e705b095fbff3de5b4f31 100644 (file)
@@ -1,3 +1,12 @@
+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.
index 50386d28cd3edab25c0f86bc4ea4ee3f9d50e132..1dec4ffb5ec778be9daf196bf243b2fd14d53765 100644 (file)
@@ -57,7 +57,8 @@ extern char * tparam (const char *str, void *buf, int bufsize, ...);
 /* 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.  */
index 7cf37739a54006d7cf377ed561ce6f4bc2a7354e..f3161f373b31a011518dc7ad2dc55568c612889a 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -9,6 +9,9 @@ dnl From Bruno Haible.
 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],
@@ -105,5 +108,23 @@ 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
 ])
index d119775bb51b91a1c2bdc2b7657969a140cd4709..9939edee0f8ed3091f674cb1b130ee8246ce2f46 100644 (file)
@@ -3,9 +3,11 @@ Information about terminal capabilities.
 
 Files:
 m4/termcap.m4
+lib/tparm.c
 
 Depends-on:
 havelib
+c-ctype
 
 configure.ac:
 gl_TERMCAP