tools: m4: fix compilation with glibc 2.28
[openwrt/staging/chunkeey.git] / tools / m4 / patches / 010-glibc-change-work-around.patch
1 Subject: Workaround change in glibc
2
3 Temporary workaround to compile with glibc 2.28, which
4 deprecated some constants
5
6 Taken from the rpms/m4 Fedora repository, commit 814d5921
7 (Work around change in glibc)
8
9 Original filename: m4-1.4.18-glibc-change-work-around.patch
10
11 --- a/lib/stdio-impl.h
12 +++ b/lib/stdio-impl.h
13 @@ -18,6 +18,12 @@
14 the same implementation of stdio extension API, except that some fields
15 have different naming conventions, or their access requires some casts. */
16
17 +/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
18 + problem by defining it ourselves. FIXME: Do not rely on glibc
19 + internals. */
20 +#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
21 +# define _IO_IN_BACKUP 0x100
22 +#endif
23
24 /* BSD stdio derived implementations. */
25
26 --- a/lib/fflush.c
27 +++ b/lib/fflush.c
28 @@ -33,7 +33,7 @@
29 #undef fflush
30
31
32 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
33 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
34
35 /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
36 static void
37 @@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
38
39 #endif
40
41 -#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
42 +#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
43
44 # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
45 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
46 @@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
47 if (stream == NULL || ! freading (stream))
48 return fflush (stream);
49
50 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
51 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
52
53 clear_ungetc_buffer_preserving_position (stream);
54
55 --- a/lib/fpending.c
56 +++ b/lib/fpending.c
57 @@ -32,7 +32,7 @@ __fpending (FILE *fp)
58 /* Most systems provide FILE as a struct and the necessary bitmask in
59 <stdio.h>, because they need it for implementing getc() and putc() as
60 fast macros. */
61 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
62 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
63 return fp->_IO_write_ptr - fp->_IO_write_base;
64 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
65 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
66 --- a/lib/fpurge.c
67 +++ b/lib/fpurge.c
68 @@ -62,7 +62,7 @@ fpurge (FILE *fp)
69 /* Most systems provide FILE as a struct and the necessary bitmask in
70 <stdio.h>, because they need it for implementing getc() and putc() as
71 fast macros. */
72 -# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
73 +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
74 fp->_IO_read_end = fp->_IO_read_ptr;
75 fp->_IO_write_ptr = fp->_IO_write_base;
76 /* Avoid memory leak when there is an active ungetc buffer. */
77 --- a/lib/freadahead.c
78 +++ b/lib/freadahead.c
79 @@ -25,7 +25,7 @@
80 size_t
81 freadahead (FILE *fp)
82 {
83 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
84 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
85 if (fp->_IO_write_ptr > fp->_IO_write_base)
86 return 0;
87 return (fp->_IO_read_end - fp->_IO_read_ptr)
88 --- a/lib/freading.c
89 +++ b/lib/freading.c
90 @@ -31,7 +31,7 @@ freading (FILE *fp)
91 /* Most systems provide FILE as a struct and the necessary bitmask in
92 <stdio.h>, because they need it for implementing getc() and putc() as
93 fast macros. */
94 -# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
95 +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
96 return ((fp->_flags & _IO_NO_WRITES) != 0
97 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
98 && fp->_IO_read_base != NULL));
99 --- a/lib/fseeko.c
100 +++ b/lib/fseeko.c
101 @@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int when
102 #endif
103
104 /* These tests are based on fpurge.c. */
105 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
106 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
107 if (fp->_IO_read_end == fp->_IO_read_ptr
108 && fp->_IO_write_ptr == fp->_IO_write_base
109 && fp->_IO_save_base == NULL)
110 @@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int when
111 return -1;
112 }
113
114 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
115 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
116 fp->_flags &= ~_IO_EOF_SEEN;
117 fp->_offset = pos;
118 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__