Alain Guibert wrote: > On my old Linux box (Intel Pentium 200 MMX, Debian bo, kernel 2.0.40, > gcc 2.7.2.1, libc 5.4.33, ... > ... > | gcc -I. -g -O2 -c fpurge.c > | fpurge.c:117: #error "Please port gnulib fpurge.c to your platform! Look at > the definitions of fflush, setvbuf and ungetc on your system, then report > this to bug-gnulib." > | make[3]: *** [fpurge.o] Error 1
OK, I'm adding tentative support for Linux libc5. The predefine test could be defined __linux__ && defined __ELF__ && !defined __UCLIBC__ or __GNU_LIBRARY__ == 1 I'm using the latter, since it's simpler. 2008-04-16 Bruno Haible <[EMAIL PROTECTED]> Add tentative support for Linux libc5. * lib/fbufmode.c (fbufmode) [__GNU_LIBRARY__==1]: Reuse glibc2 code. * lib/fpurge.c (fpurge): Likewise. * lib/freadable.c (freadable): Likewise. * lib/freadahead.c (freadahead): Likewise. * lib/freading.c (freading): Likewise. * lib/freadptr.c (freadptr): Likewise. * lib/freadseek.c (freadptrinc): Likewise. * lib/fseeko.c (rpl_fseeko): Likewise. * lib/fseterr.c (fseterr): Likewise. * lib/fwritable.c (fwritable): Likewise. * lib/fwriting.c (fwriting): Likewise. Reported by Alain Guibert <[EMAIL PROTECTED]>. --- lib/fbufmode.c.orig 2008-04-17 01:55:14.000000000 +0200 +++ lib/fbufmode.c 2008-04-17 01:54:36.000000000 +0200 @@ -29,7 +29,7 @@ /* Most systems provide FILE as a struct and the necessary bitmask in <stdio.h>, because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ # if HAVE___FLBF /* glibc >= 2.2 */ if (__flbf (fp)) return _IOLBF; --- lib/fpurge.c.orig 2008-04-17 01:55:14.000000000 +0200 +++ lib/fpurge.c 2008-04-17 01:54:36.000000000 +0200 @@ -59,7 +59,7 @@ /* Most systems provide FILE as a struct and the necessary bitmask in <stdio.h>, because they need it for implementing getc() and putc() as fast macros. */ -# if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +# if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ fp->_IO_read_end = fp->_IO_read_ptr; fp->_IO_write_ptr = fp->_IO_write_base; /* Avoid memory leak when there is an active ungetc buffer. */ --- lib/freadable.c.orig 2008-04-17 01:55:14.000000000 +0200 +++ lib/freadable.c 2008-04-17 01:54:36.000000000 +0200 @@ -25,7 +25,7 @@ /* Most systems provide FILE as a struct and the necessary bitmask in <stdio.h>, because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ return (fp->_flags & _IO_NO_READS) == 0; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ return (fp->_flags & (__SRW | __SRD)) != 0; --- lib/freadahead.c.orig 2008-04-17 01:55:14.000000000 +0200 +++ lib/freadahead.c 2008-04-17 01:54:36.000000000 +0200 @@ -22,7 +22,7 @@ size_t freadahead (FILE *fp) { -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ if (fp->_IO_write_ptr > fp->_IO_write_base) return 0; return (fp->_IO_read_end - fp->_IO_read_ptr) --- lib/freading.c.orig 2008-04-17 01:55:14.000000000 +0200 +++ lib/freading.c 2008-04-17 01:54:36.000000000 +0200 @@ -29,7 +29,7 @@ /* Most systems provide FILE as a struct and the necessary bitmask in <stdio.h>, because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ return ((fp->_flags & _IO_NO_WRITES) != 0 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 && fp->_IO_read_base != NULL)); --- lib/freadptr.c.orig 2008-04-17 01:55:14.000000000 +0200 +++ lib/freadptr.c 2008-04-17 01:54:36.000000000 +0200 @@ -27,7 +27,7 @@ size_t size; /* Keep this code in sync with freadahead! */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ if (fp->_IO_write_ptr > fp->_IO_write_base) return NULL; size = fp->_IO_read_end - fp->_IO_read_ptr; --- lib/freadseek.c.orig 2008-04-17 01:55:14.000000000 +0200 +++ lib/freadseek.c 2008-04-17 01:54:36.000000000 +0200 @@ -32,7 +32,7 @@ freadptrinc (FILE *fp, size_t increment) { /* Keep this code in sync with freadptr! */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ fp->_IO_read_ptr += increment; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ fp->_p += increment; --- lib/fseeko.c.orig 2008-04-17 01:55:14.000000000 +0200 +++ lib/fseeko.c 2008-04-17 01:54:36.000000000 +0200 @@ -39,7 +39,7 @@ #endif /* These tests are based on fpurge.c. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ if (fp->_IO_read_end == fp->_IO_read_ptr && fp->_IO_write_ptr == fp->_IO_write_base && fp->_IO_save_base == NULL) --- lib/fseterr.c.orig 2008-04-17 01:55:14.000000000 +0200 +++ lib/fseterr.c 2008-04-17 01:54:36.000000000 +0200 @@ -27,7 +27,7 @@ /* Most systems provide FILE as a struct and the necessary bitmask in <stdio.h>, because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ fp->_flags |= _IO_ERR_SEEN; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ fp->_flags |= __SERR; --- lib/fwritable.c.orig 2008-04-17 01:55:14.000000000 +0200 +++ lib/fwritable.c 2008-04-17 01:54:36.000000000 +0200 @@ -25,7 +25,7 @@ /* Most systems provide FILE as a struct and the necessary bitmask in <stdio.h>, because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ return (fp->_flags & _IO_NO_WRITES) == 0; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ return (fp->_flags & (__SRW | __SWR)) != 0; --- lib/fwriting.c.orig 2008-04-17 01:55:15.000000000 +0200 +++ lib/fwriting.c 2008-04-17 01:54:36.000000000 +0200 @@ -25,7 +25,7 @@ /* Most systems provide FILE as a struct and the necessary bitmask in <stdio.h>, because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_ferror_unlocked /* GNU libc, BeOS */ +#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Linux libc5 */ return (fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) != 0; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ return (fp->_flags & __SWR) != 0;