Tim Rice wrote in <https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00127.html>: > > I've attached a patch to address the fact that UnixWare does not have > stdio_ext.h but has some __X() stdio helper functions. > > Wrap "#include <stdio_ext.h>" in HAVE_STDIO_EXT_H insead of HAVE___X
I'm applying the patch below, to fix this. The main differences to yours are: * No need to touch the modules freadahead, freadptr, fseterr, since the functions __freadahead, __freadptr, __fseterr don't exist on your platform, as you reported in <https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00133.html>. * When we modify a .m4 file, we also need to bump its serial number. * It does not make the code clearer to remove the HAVE___FLBF and HAVE___FPURGE tests in fbufmode.c and fpurge.c. 2020-10-11 Bruno Haible <br...@clisp.org> stdioext: Avoid compilation errors on UnixWare 7. Reported by Tim Rice <t...@multitalents.net> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00127.html>. * lib/fbufmode.c: Don't include <stdio_ext.h> 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 <stdio_ext.h> 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. diff --git a/lib/fbufmode.c b/lib/fbufmode.c index 65a5cfc..a528a63 100644 --- a/lib/fbufmode.c +++ b/lib/fbufmode.c @@ -20,7 +20,9 @@ #include "fbufmode.h" #if HAVE___FLBF -# include <stdio_ext.h> +# if HAVE_STDIO_EXT_H +# include <stdio_ext.h> +# endif #endif #include "stdio-impl.h" diff --git a/lib/fpurge.c b/lib/fpurge.c index fc88646..9469ce4 100644 --- a/lib/fpurge.c +++ b/lib/fpurge.c @@ -19,8 +19,10 @@ /* Specification. */ #include <stdio.h> -#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7, Cygwin >= 1.7.10, Android API >= 23 */ -# include <stdio_ext.h> +#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7, Cygwin >= 1.7.10, Android API >= 23, musl libc */ +# if HAVE_STDIO_EXT_H +# include <stdio_ext.h> +# endif #endif #include <stdlib.h> diff --git a/lib/freadable.h b/lib/freadable.h index f05e5fb..9139865 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 <stdio_ext.h> +# if HAVE_STDIO_EXT_H +# include <stdio_ext.h> +# endif # define freadable(stream) (__freadable (stream) != 0) #else diff --git a/lib/freading.h b/lib/freading.h index 1891f5a..7bef18e 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 <stdio_ext.h> +# if HAVE_STDIO_EXT_H +# include <stdio_ext.h> +# endif # define freading(stream) (__freading (stream) != 0) #else diff --git a/lib/fwritable.h b/lib/fwritable.h index 509e069..fb9c871 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 <stdio_ext.h> +# if HAVE_STDIO_EXT_H +# include <stdio_ext.h> +# endif # define fwritable(stream) (__fwritable (stream) != 0) #else diff --git a/lib/fwriting.h b/lib/fwriting.h index 2d16f42..3aa5d7f 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 <stdio_ext.h> +# if HAVE_STDIO_EXT_H +# include <stdio_ext.h> +# endif # define fwriting(stream) (__fwriting (stream) != 0) #else diff --git a/m4/fbufmode.m4 b/m4/fbufmode.m4 index 87e76e0..e2a146f 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 0796a6f..9a486e0 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 <stdio.h>]]) diff --git a/m4/freadable.m4 b/m4/freadable.m4 index 3237eff..e988054 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 440c241..6eb25ab 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 dbe887e..55db08f 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 4d7cd3e..fe2f10e 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]) ])