From 075ded5020ef1dddd60a4e5c6d4a369fecefceb2 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 11 Oct 2020 15:24:52 +0200 Subject: [PATCH] stdioext: Avoid compilation errors on UnixWare 7. Reported by Tim Rice in . * lib/fbufmode.c: Don't include if it does not exist. * lib/fpurge.c: Likewise. * lib/freadable.h: Likewise. * lib/freading.h: Likewise. * lib/fwritable.h: Likewise. * lib/fwriting.h: Likewise. * m4/fbufmode.m4 (gl_FUNC_FBUFMODE): Test whether exists. * m4/fpurge.m4 (gl_FUNC_FPURGE): Likewise. * m4/freadable.m4 (gl_FUNC_FREADABLE): Likewise. * m4/freading.m4 (gl_FUNC_FREADING): Likewise. * m4/fwritable.m4 (gl_FUNC_FWRITABLE): Likewise. * m4/fwriting.m4 (gl_FUNC_FWRITING): Likewise. --- ChangeLog | 18 ++++++++++++++++++ lib/fbufmode.c | 4 +++- lib/fpurge.c | 6 ++++-- lib/freadable.h | 4 +++- lib/freading.h | 4 +++- lib/fwritable.h | 4 +++- lib/fwriting.h | 4 +++- m4/fbufmode.m4 | 3 ++- m4/fpurge.m4 | 3 ++- m4/freadable.m4 | 3 ++- m4/freading.m4 | 3 ++- m4/fwritable.m4 | 3 ++- m4/fwriting.m4 | 3 ++- 13 files changed, 49 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index defa84ad2a..070929e37c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2020-10-11 Bruno Haible + + stdioext: Avoid compilation errors on UnixWare 7. + Reported by Tim Rice in + . + * lib/fbufmode.c: Don't include if it does not exist. + * lib/fpurge.c: Likewise. + * lib/freadable.h: Likewise. + * lib/freading.h: Likewise. + * lib/fwritable.h: Likewise. + * lib/fwriting.h: Likewise. + * m4/fbufmode.m4 (gl_FUNC_FBUFMODE): Test whether exists. + * m4/fpurge.m4 (gl_FUNC_FPURGE): Likewise. + * m4/freadable.m4 (gl_FUNC_FREADABLE): Likewise. + * m4/freading.m4 (gl_FUNC_FREADING): Likewise. + * m4/fwritable.m4 (gl_FUNC_FWRITABLE): Likewise. + * m4/fwriting.m4 (gl_FUNC_FWRITING): Likewise. + 2020-10-11 Bruno Haible stdioext: Update comments regarding Cygwin. diff --git a/lib/fbufmode.c b/lib/fbufmode.c index 65a5cfc821..a528a63e35 100644 --- a/lib/fbufmode.c +++ b/lib/fbufmode.c @@ -20,7 +20,9 @@ #include "fbufmode.h" #if HAVE___FLBF -# include +# if HAVE_STDIO_EXT_H +# include +# endif #endif #include "stdio-impl.h" diff --git a/lib/fpurge.c b/lib/fpurge.c index fc88646ca4..9469ce43ca 100644 --- a/lib/fpurge.c +++ b/lib/fpurge.c @@ -19,8 +19,10 @@ /* Specification. */ #include -#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7, Cygwin >= 1.7.10, Android API >= 23 */ -# include +#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7, Cygwin >= 1.7.10, Android API >= 23, musl libc */ +# if HAVE_STDIO_EXT_H +# include +# endif #endif #include diff --git a/lib/freadable.h b/lib/freadable.h index f05e5fb397..9139865023 100644 --- a/lib/freadable.h +++ b/lib/freadable.h @@ -24,7 +24,9 @@ #if HAVE___FREADABLE /* glibc >= 2.2, Solaris >= 7, Cygwin >= 1.7.34, Android API >= 23, musl libc */ -# include +# if HAVE_STDIO_EXT_H +# include +# endif # define freadable(stream) (__freadable (stream) != 0) #else diff --git a/lib/freading.h b/lib/freading.h index 1891f5af4f..7bef18ede9 100644 --- a/lib/freading.h +++ b/lib/freading.h @@ -35,7 +35,9 @@ #if HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)) /* Solaris >= 7, Cygwin >= 1.7.34, Android API >= 29, not glibc >= 2.2, but glibc >= 2.7, or musl libc */ -# include +# if HAVE_STDIO_EXT_H +# include +# endif # define freading(stream) (__freading (stream) != 0) #else diff --git a/lib/fwritable.h b/lib/fwritable.h index 509e069528..fb9c871efa 100644 --- a/lib/fwritable.h +++ b/lib/fwritable.h @@ -24,7 +24,9 @@ #if HAVE___FWRITABLE /* glibc >= 2.2, Solaris >= 7, Cygwin >= 1.7.34, Android API >= 23, musl libc */ -# include +# if HAVE_STDIO_EXT_H +# include +# endif # define fwritable(stream) (__fwritable (stream) != 0) #else diff --git a/lib/fwriting.h b/lib/fwriting.h index 2d16f42d47..3aa5d7f0ee 100644 --- a/lib/fwriting.h +++ b/lib/fwriting.h @@ -35,7 +35,9 @@ #if HAVE___FWRITING /* glibc >= 2.2, Solaris >= 7, Cygwin >= 1.7.34, Android API >= 29, musl libc */ -# include +# if HAVE_STDIO_EXT_H +# include +# endif # define fwriting(stream) (__fwriting (stream) != 0) #else diff --git a/m4/fbufmode.m4 b/m4/fbufmode.m4 index 87e76e0d7b..e2a146fa29 100644 --- a/m4/fbufmode.m4 +++ b/m4/fbufmode.m4 @@ -1,4 +1,4 @@ -# fbufmode.m4 serial 2 +# fbufmode.m4 serial 3 dnl Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,5 +7,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FBUFMODE], [ dnl Prerequisites of lib/fbufmode.c. + AC_CHECK_HEADERS_ONCE([stdio_ext.h]) AC_CHECK_FUNCS_ONCE([__flbf __fbufsize]) ]) diff --git a/m4/fpurge.m4 b/m4/fpurge.m4 index 0796a6f0ed..9a486e00a4 100644 --- a/m4/fpurge.m4 +++ b/m4/fpurge.m4 @@ -1,4 +1,4 @@ -# fpurge.m4 serial 11 +# fpurge.m4 serial 12 dnl Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,6 +8,7 @@ AC_DEFUN([gl_FUNC_FPURGE], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CHECK_HEADERS_ONCE([stdio_ext.h]) AC_CHECK_FUNCS_ONCE([fpurge]) AC_CHECK_FUNCS_ONCE([__fpurge]) AC_CHECK_DECLS([fpurge], , , [[#include ]]) diff --git a/m4/freadable.m4 b/m4/freadable.m4 index 3237effe02..e988054374 100644 --- a/m4/freadable.m4 +++ b/m4/freadable.m4 @@ -1,4 +1,4 @@ -# freadable.m4 serial 2 +# freadable.m4 serial 3 dnl Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,5 +6,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FREADABLE], [ + AC_CHECK_HEADERS_ONCE([stdio_ext.h]) AC_CHECK_FUNCS_ONCE([__freadable]) ]) diff --git a/m4/freading.m4 b/m4/freading.m4 index 440c241e47..6eb25abfa2 100644 --- a/m4/freading.m4 +++ b/m4/freading.m4 @@ -1,4 +1,4 @@ -# freading.m4 serial 1 +# freading.m4 serial 2 dnl Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,5 +6,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FREADING], [ + AC_CHECK_HEADERS_ONCE([stdio_ext.h]) AC_CHECK_FUNCS_ONCE([__freading]) ]) diff --git a/m4/fwritable.m4 b/m4/fwritable.m4 index dbe887e886..55db08f87e 100644 --- a/m4/fwritable.m4 +++ b/m4/fwritable.m4 @@ -1,4 +1,4 @@ -# fwritable.m4 serial 2 +# fwritable.m4 serial 3 dnl Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,5 +6,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FWRITABLE], [ + AC_CHECK_HEADERS_ONCE([stdio_ext.h]) AC_CHECK_FUNCS_ONCE([__fwritable]) ]) diff --git a/m4/fwriting.m4 b/m4/fwriting.m4 index 4d7cd3ede1..fe2f10ea27 100644 --- a/m4/fwriting.m4 +++ b/m4/fwriting.m4 @@ -1,4 +1,4 @@ -# fwriting.m4 serial 2 +# fwriting.m4 serial 3 dnl Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,5 +6,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FWRITING], [ + AC_CHECK_HEADERS_ONCE([stdio_ext.h]) AC_CHECK_FUNCS_ONCE([__fwriting]) ]) -- 2.39.5