]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
libtextstyle: Reexport isatty() override from gnulib.
authorBruno Haible <bruno@clisp.org>
Thu, 14 Mar 2019 23:02:55 +0000 (00:02 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 14 Mar 2019 23:02:55 +0000 (00:02 +0100)
This is necessary for programs that are compiled for native Windows and
run in a Cygwin console.

* libtextstyle/autogen.sh (GNULIB_MODULES): Add 'isatty'.
* libtextstyle/configure.ac: Set GNULIB_ISATTY to 0.
* libtextstyle/lib/textstyle.h (libtextstyle_isatty): New declaration.
(isatty): Redirect to libtextstyle_isatty.

libtextstyle/.gitignore
libtextstyle/autogen.sh
libtextstyle/configure.ac
libtextstyle/lib/textstyle.h

index fc318084275ac9fe3d4b78e0dacfdd89120b6a2d..c2b2a29a9bd006a5e73bc58ea0e41276051a0ed4 100644 (file)
@@ -81,6 +81,7 @@
 /lib/iconv-ostream.oo.c
 /lib/iconv-ostream.oo.h
 /lib/intprops.h
+/lib/isatty.c
 /lib/isinf.c
 /lib/isnan.c
 /lib/isnand.c
index 8fbe8d05f88caa05eb02bb6eca24cf4c2366d61f..d1980dfc4d1e8fbd5b4c5ccd171de51e7e23a513 100755 (executable)
@@ -84,6 +84,7 @@ if test $skip_gnulib = false; then
         html-styled-ostream
         term-styled-ostream
       filename
+      isatty
       xalloc
       xconcat-filename
 
index 922634053429c3c8fb3434ffd73bd1e7aebb8247..13c79fee82cf2a78463cbf935c57626d4dfb6593 100644 (file)
@@ -70,6 +70,10 @@ dnl Checks for types, header files, functions and declarations.
 
 gl_INIT
 
+dnl Arrange that the gnulib-generated <unistd.h> does not declare isatty(). The
+dnl adhoc-tests want to get this declaration from <textstyle.h>, not <unistd.h>.
+GNULIB_ISATTY=0
+
 dnl Compilation on mingw and Cygwin needs special Makefile rules, because
 dnl 1. when we install a shared library, we must arrange to export
 dnl    auxiliary pointer variables for every exported variable,
index f905fe6ccb4d42b66dbd525a1ea71c7f43036938..6f3d0de04cc7455c68477fcdd9cefaf6517dae59 100644 (file)
@@ -530,6 +530,26 @@ extern void libtextstyle_set_failure_exit_code (int exit_code);
 }
 #endif
 
+/* ----------------------- Exported gnulib overrides ----------------------- */
+
+#if defined _WIN32 && ! defined __CYGWIN__
+
+# include <io.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+extern int libtextstyle_isatty (int fd);
+# undef isatty
+# define isatty libtextstyle_isatty
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
 /* ------------------------------------------------------------------------- */
 
 #endif /* _TEXTSTYLE_H */