Lucio Andrés Illanes Albornoz 77eaa7
update for glibc libio.h removal in 2.28+
Lucio Andrés Illanes Albornoz 77eaa7
Lucio Andrés Illanes Albornoz 77eaa7
see
Lucio Andrés Illanes Albornoz 77eaa7
https://src.fedoraproject.org/rpms/m4/c/814d592134fad36df757f9a61422d164ea2c6c9b?branch=master
Lucio Andrés Illanes Albornoz 77eaa7
Lucio Andrés Illanes Albornoz 77eaa7
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4af4a4a718]
Lucio Andrés Illanes Albornoz 77eaa7
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Lucio Andrés Illanes Albornoz 77eaa7
Lucio Andrés Illanes Albornoz 77eaa7
Index: m4-1.4.18/lib/fflush.c
Lucio Andrés Illanes Albornoz 77eaa7
===================================================================
Lucio Andrés Illanes Albornoz 77eaa7
--- m4-1.4.18.orig/lib/fflush.c
Lucio Andrés Illanes Albornoz 77eaa7
+++ m4-1.4.18/lib/fflush.c
Lucio Andrés Illanes Albornoz 77eaa7
@@ -33,7 +33,7 @@
Lucio Andrés Illanes Albornoz 77eaa7
 #undef fflush
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
 /* Clear the stream's ungetc buffer, preserving the value of ftello (fp).  */
Lucio Andrés Illanes Albornoz 77eaa7
 static void
Lucio Andrés Illanes Albornoz 77eaa7
@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
 #endif
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
Lucio Andrés Illanes Albornoz 77eaa7
+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
 # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
Lucio Andrés Illanes Albornoz 77eaa7
 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
Lucio Andrés Illanes Albornoz 77eaa7
@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
Lucio Andrés Illanes Albornoz 77eaa7
   if (stream == NULL || ! freading (stream))
Lucio Andrés Illanes Albornoz 77eaa7
     return fflush (stream);
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
   clear_ungetc_buffer_preserving_position (stream);
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
Index: m4-1.4.18/lib/fpending.c
Lucio Andrés Illanes Albornoz 77eaa7
===================================================================
Lucio Andrés Illanes Albornoz 77eaa7
--- m4-1.4.18.orig/lib/fpending.c
Lucio Andrés Illanes Albornoz 77eaa7
+++ m4-1.4.18/lib/fpending.c
Lucio Andrés Illanes Albornoz 77eaa7
@@ -32,7 +32,7 @@ __fpending (FILE *fp)
Lucio Andrés Illanes Albornoz 77eaa7
   /* Most systems provide FILE as a struct and the necessary bitmask in
Lucio Andrés Illanes Albornoz 77eaa7
      <stdio.h>, because they need it for implementing getc() and putc() as
Lucio Andrés Illanes Albornoz 77eaa7
      fast macros.  */
Lucio Andrés Illanes Albornoz 77eaa7
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
   return fp->_IO_write_ptr - fp->_IO_write_base;
Lucio Andrés Illanes Albornoz 77eaa7
 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
Lucio Andrés Illanes Albornoz 77eaa7
   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
Lucio Andrés Illanes Albornoz 77eaa7
Index: m4-1.4.18/lib/fpurge.c
Lucio Andrés Illanes Albornoz 77eaa7
===================================================================
Lucio Andrés Illanes Albornoz 77eaa7
--- m4-1.4.18.orig/lib/fpurge.c
Lucio Andrés Illanes Albornoz 77eaa7
+++ m4-1.4.18/lib/fpurge.c
Lucio Andrés Illanes Albornoz 77eaa7
@@ -62,7 +62,7 @@ fpurge (FILE *fp)
Lucio Andrés Illanes Albornoz 77eaa7
   /* Most systems provide FILE as a struct and the necessary bitmask in
Lucio Andrés Illanes Albornoz 77eaa7
      <stdio.h>, because they need it for implementing getc() and putc() as
Lucio Andrés Illanes Albornoz 77eaa7
      fast macros.  */
Lucio Andrés Illanes Albornoz 77eaa7
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
   fp->_IO_read_end = fp->_IO_read_ptr;
Lucio Andrés Illanes Albornoz 77eaa7
   fp->_IO_write_ptr = fp->_IO_write_base;
Lucio Andrés Illanes Albornoz 77eaa7
   /* Avoid memory leak when there is an active ungetc buffer.  */
Lucio Andrés Illanes Albornoz 77eaa7
Index: m4-1.4.18/lib/freadahead.c
Lucio Andrés Illanes Albornoz 77eaa7
===================================================================
Lucio Andrés Illanes Albornoz 77eaa7
--- m4-1.4.18.orig/lib/freadahead.c
Lucio Andrés Illanes Albornoz 77eaa7
+++ m4-1.4.18/lib/freadahead.c
Lucio Andrés Illanes Albornoz 77eaa7
@@ -25,7 +25,7 @@
Lucio Andrés Illanes Albornoz 77eaa7
 size_t
Lucio Andrés Illanes Albornoz 77eaa7
 freadahead (FILE *fp)
Lucio Andrés Illanes Albornoz 77eaa7
 {
Lucio Andrés Illanes Albornoz 77eaa7
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
   if (fp->_IO_write_ptr > fp->_IO_write_base)
Lucio Andrés Illanes Albornoz 77eaa7
     return 0;
Lucio Andrés Illanes Albornoz 77eaa7
   return (fp->_IO_read_end - fp->_IO_read_ptr)
Lucio Andrés Illanes Albornoz 77eaa7
Index: m4-1.4.18/lib/freading.c
Lucio Andrés Illanes Albornoz 77eaa7
===================================================================
Lucio Andrés Illanes Albornoz 77eaa7
--- m4-1.4.18.orig/lib/freading.c
Lucio Andrés Illanes Albornoz 77eaa7
+++ m4-1.4.18/lib/freading.c
Lucio Andrés Illanes Albornoz 77eaa7
@@ -31,7 +31,7 @@ freading (FILE *fp)
Lucio Andrés Illanes Albornoz 77eaa7
   /* Most systems provide FILE as a struct and the necessary bitmask in
Lucio Andrés Illanes Albornoz 77eaa7
      <stdio.h>, because they need it for implementing getc() and putc() as
Lucio Andrés Illanes Albornoz 77eaa7
      fast macros.  */
Lucio Andrés Illanes Albornoz 77eaa7
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
   return ((fp->_flags & _IO_NO_WRITES) != 0
Lucio Andrés Illanes Albornoz 77eaa7
           || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
Lucio Andrés Illanes Albornoz 77eaa7
               && fp->_IO_read_base != NULL));
Lucio Andrés Illanes Albornoz 77eaa7
Index: m4-1.4.18/lib/fseeko.c
Lucio Andrés Illanes Albornoz 77eaa7
===================================================================
Lucio Andrés Illanes Albornoz 77eaa7
--- m4-1.4.18.orig/lib/fseeko.c
Lucio Andrés Illanes Albornoz 77eaa7
+++ m4-1.4.18/lib/fseeko.c
Lucio Andrés Illanes Albornoz 77eaa7
@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int when
Lucio Andrés Illanes Albornoz 77eaa7
 #endif
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
   /* These tests are based on fpurge.c.  */
Lucio Andrés Illanes Albornoz 77eaa7
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
   if (fp->_IO_read_end == fp->_IO_read_ptr
Lucio Andrés Illanes Albornoz 77eaa7
       && fp->_IO_write_ptr == fp->_IO_write_base
Lucio Andrés Illanes Albornoz 77eaa7
       && fp->_IO_save_base == NULL)
Lucio Andrés Illanes Albornoz 77eaa7
@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int when
Lucio Andrés Illanes Albornoz 77eaa7
           return -1;
Lucio Andrés Illanes Albornoz 77eaa7
         }
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
Lucio Andrés Illanes Albornoz 77eaa7
       fp->_flags &= ~_IO_EOF_SEEN;
Lucio Andrés Illanes Albornoz 77eaa7
       fp->_offset = pos;
Lucio Andrés Illanes Albornoz 77eaa7
 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
Lucio Andrés Illanes Albornoz 77eaa7
Index: m4-1.4.18/lib/stdio-impl.h
Lucio Andrés Illanes Albornoz 77eaa7
===================================================================
Lucio Andrés Illanes Albornoz 77eaa7
--- m4-1.4.18.orig/lib/stdio-impl.h
Lucio Andrés Illanes Albornoz 77eaa7
+++ m4-1.4.18/lib/stdio-impl.h
Lucio Andrés Illanes Albornoz 77eaa7
@@ -18,6 +18,12 @@
Lucio Andrés Illanes Albornoz 77eaa7
    the same implementation of stdio extension API, except that some fields
Lucio Andrés Illanes Albornoz 77eaa7
    have different naming conventions, or their access requires some casts.  */
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
+/* Glibc 2.28 made _IO_IN_BACKUP private.  For now, work around this
Lucio Andrés Illanes Albornoz 77eaa7
+   problem by defining it ourselves.  FIXME: Do not rely on glibc
Lucio Andrés Illanes Albornoz 77eaa7
+   internals.  */
Lucio Andrés Illanes Albornoz 77eaa7
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
Lucio Andrés Illanes Albornoz 77eaa7
+# define _IO_IN_BACKUP 0x100
Lucio Andrés Illanes Albornoz 77eaa7
+#endif
Lucio Andrés Illanes Albornoz 77eaa7
 
Lucio Andrés Illanes Albornoz 77eaa7
 /* BSD stdio derived implementations.  */
Lucio Andrés Illanes Albornoz 77eaa7