Rich Felker wrote: > 1. freadahead is inherently non-portable and has no working portable > fallback version. At some point in the discussions, it was suggested > that this function should not be pulled in except on old broken > systems where stdio doesn't work and needs replacement functions. > However, at least some packages, notably GNU M4, seem to use it > directly.
freadahead is one of the "extended" stdio functions that gnulib provides portably. "Portable" sometimes means that some porting effort is needed. Find attached a draft patch for gnulib, to support the stdioext functions on musl. It was tested using the recipe from http://lists.gnu.org/archive/html/bug-gnulib/2012-02/msg00022.html All tests pass, except for a bug in setvbuf or __fbufsize, that I have reported separately. There are two areas where musl libc can be modified to reduce the size of this patch. 1) Currently, gnulib has to go to a great length to detect musl. It uses the presence of __stdio_read and __stdio_write as an indicator; no other system has these functions. Why does musl make it so hard? Can't you just define a preprocessor symbol that indicates musl? Like so many other systems do? http://sourceforge.net/apps/mediawiki/predef/index.php?title=Operating_Systems http://sourceforge.net/apps/mediawiki/predef/index.php?title=Libraries The idea is that once a program includes <stdio.h> (or any other standard .h file) it can use a "#ifdef __MUSL__". gnulib needs this because some implementations provide the same functions but they behave differently. E.g. __freading is broken in glibc < 2.7 but not in musl. And __freading and __fwriting don't implement exactly the same semantics as glibc. That's why real-life programs need to #ifdef according to OS and libraries. 2) Provide 4 primitive functions. Specified in gnulib's freadahead.h: /* Assuming the stream FP is open for reading: Return the number of bytes waiting in the input buffer of FP. This includes both the bytes that have been read from the underlying input source and the bytes that have been pushed back through 'ungetc'. If this number is 0 and the stream is not currently writing, fflush (FP) is known to be a no-op. FP must not be wide-character oriented. */ size_t __freadahead (FILE *fp) { if (!__freadable (fp)) return 0; return fp->rend - fp->rpos; } Specified in gnulib's freadptr.h: /* Assuming the stream FP is open for reading: Return a pointer to the input buffer of FP, or NULL. If the returned pointer is non-NULL, *SIZEP is set to the (positive) size of the input buffer. If the returned pointer is NULL, you should use getc (FP), fgetc (FP), or fread (..., FP) to access the input from FP. The resulting pointer becomes invalid upon any operation on FP. FP must not be wide-character oriented. */ const char * __freadptr (FILE *fp, size_t *sizep) { if (fp->rpos >= fp->rend) return NULL; *sizep = fp->rend - fp->rpos; return fp->rpos; } /* Increment the in-memory pointer. INCREMENT must be at most the buffer size returned by freadptr(). */ void __freadptrinc (FILE *fp, size_t increment) { fp->rpos += increment; } Specified in gnulib' fseterr.h: /* Set the error indicator of the stream FP. The "error indicator" is set when an I/O operation on the stream fails, and is cleared (together with the "end-of-file" indicator) by clearerr (FP). */ void __fseterr (FILE *fp) { fp->flags |= F_ERR; } Rich Felker wrote on 2012-06-11: > would adding __freadahead be sufficient to make it use > __freadahead, or does gnulib hard-code knowledge about which systems > have which stdio extension functions? Adding __freadahead is one of the things needed for gnulib. Another thing is to add an indicator such as __MUSL__, because gnulib hard-codes the knowledge of which of these functions are known to work or known to be buggy. Rich Felker wrote on 2012-06-11: > If you're willing > to put in a test for it, I'm willing to add the function. 4 functions proposals are above. Please let us know what you put into musl, so that I can reduce the size of the patch I put into gnulib. Bruno --- lib/fbufmode.c.orig Sun Jun 17 22:26:32 2012 +++ lib/fbufmode.c Sun Jun 17 21:43:36 2012 @@ -79,6 +79,10 @@ if (fp->__linebuf) return _IOLBF; return (fp->__bufsize > 0 ? _IOFBF : _IONBF); +#elif defined __MUSL__ /* musl libc */ + if (__flbf (fp)) + return _IOLBF; + return (__fbufsize (fp) > 0 ? _IOFBF : _IONBF); #elif defined EPLAN9 /* Plan9 */ if (fp->flags & 2 /* LINEBUF */) return _IOLBF; --- lib/fpurge.c.orig Sun Jun 17 22:26:32 2012 +++ lib/fpurge.c Sun Jun 17 21:06:31 2012 @@ -29,7 +29,7 @@ int fpurge (FILE *fp) { -#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7 */ +#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7, musl libc */ __fpurge (fp); /* The __fpurge function does not have a return value. */ --- lib/freadable.c.orig Sun Jun 17 22:26:32 2012 +++ lib/freadable.c Sun Jun 17 21:44:20 2012 @@ -45,6 +45,8 @@ return (fp->_Mode & 0x1 /* _MOPENR */) != 0; #elif defined __MINT__ /* Atari FreeMiNT */ return fp->__mode.__read; +#elif defined __MUSL__ /* musl libc */ + return __freadable (fp); #elif defined EPLAN9 /* Plan9 */ int fd = fp->fd; if (fd >= 0) --- lib/freadable.h.orig Sun Jun 17 22:26:32 2012 +++ lib/freadable.h Sun Jun 17 21:06:31 2012 @@ -22,7 +22,7 @@ STREAM must not be wide-character oriented. The result doesn't change until the stream is closed or re-opened. */ -#if HAVE___FREADABLE /* glibc >= 2.2, Solaris >= 7 */ +#if HAVE___FREADABLE /* glibc >= 2.2, Solaris >= 7, musl libc */ # include <stdio_ext.h> # define freadable(stream) (__freadable (stream) != 0) --- lib/freadahead.c.orig Sun Jun 17 22:26:32 2012 +++ lib/freadahead.c Sun Jun 17 21:06:31 2012 @@ -80,6 +80,10 @@ return (fp->__pushed_back ? fp->__get_limit - fp->__pushback_bufp + 1 : fp->__get_limit - fp->__bufp); +#elif defined __MUSL__ /* musl libc */ + if (!__freadable (fp)) + return 0; + return fp_->rend - fp_->rpos; #elif defined EPLAN9 /* Plan9 */ if (fp->state == 4 /* WR */ || fp->rp >= fp->wp) return 0; --- lib/freading.c.orig Sun Jun 17 22:26:32 2012 +++ lib/freading.c Sun Jun 17 21:30:18 2012 @@ -23,7 +23,7 @@ /* Don't use glibc's __freading function in glibc < 2.7, see <http://sourceware.org/bugzilla/show_bug.cgi?id=4359> */ -#if !(HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))) +#if !(HAVE___FREADING && ((!defined __GLIBC__ && !defined __MUSL__) || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))) bool freading (FILE *fp) @@ -62,6 +62,8 @@ # else return (fp->__buffer < fp->__get_limit /*|| fp->__bufp == fp->__put_limit ??*/); # endif +# elif defined __MUSL__ /* musl libc */ + return !__fwritable (fp) || __freading (fp); # elif defined EPLAN9 /* Plan9 */ if (fp->state == 0 /* CLOSED */ || fp->state == 4 /* WR */) return 0; --- lib/freading.h.orig Sun Jun 17 22:26:32 2012 +++ lib/freading.h Sun Jun 17 21:29:25 2012 @@ -32,8 +32,8 @@ STREAM must not be wide-character oriented. */ -#if HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)) -/* Solaris >= 7, not glibc >= 2.2, but glibc >= 2.7 */ +#if HAVE___FREADING && ((!defined __GLIBC__ && !defined __MUSL__) || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)) +/* Solaris >= 7, not glibc >= 2.2, but glibc >= 2.7, and not musl libc */ # include <stdio_ext.h> # define freading(stream) (__freading (stream) != 0) --- lib/freadptr.c.orig Sun Jun 17 22:26:32 2012 +++ lib/freadptr.c Sun Jun 17 21:06:31 2012 @@ -101,6 +101,11 @@ return NULL; *sizep = size; return fp->__bufp; +#elif defined __MUSL__ /* musl libc */ + if (fp_->rpos >= fp_->rend) + return NULL; + *sizep = fp_->rend - fp_->rpos; + return fp_->rpos; #elif defined EPLAN9 /* Plan9 */ if (fp->state == 4 /* WR */) return NULL; --- lib/freadseek.c.orig Sun Jun 17 22:26:32 2012 +++ lib/freadseek.c Sun Jun 17 21:06:31 2012 @@ -58,6 +58,8 @@ fp->_Next += increment; #elif defined __MINT__ /* Atari FreeMiNT */ fp->__bufp += increment; +#elif defined __MUSL__ /* musl libc */ + fp_->rpos += increment; #elif defined EPLAN9 /* Plan9 */ fp->rp += increment; #elif defined SLOW_BUT_NO_HACKS /* users can define this */ --- lib/fseeko.c.orig Sun Jun 17 22:26:32 2012 +++ lib/fseeko.c Sun Jun 17 21:47:42 2012 @@ -96,6 +96,9 @@ && fp->__get_limit == fp->__bufp && fp->__put_limit == fp->__bufp && !fp->__pushed_back) +#elif defined __MUSL__ /* musl libc */ + if (fp_->rpos == fp_->rend + && fp_->wpos == fp_->wbase) #elif defined EPLAN9 /* Plan9 */ if (fp->rp == fp->buf && fp->wp == fp->buf) @@ -146,6 +149,8 @@ #elif defined __MINT__ /* Atari FreeMiNT */ fp->__offset = pos; fp->__eof = 0; +#elif defined __MUSL__ /* musl libc */ + fp_->flags &= ~F_EOF; #endif return 0; } --- lib/fseterr.c.orig Sun Jun 17 22:26:32 2012 +++ lib/fseterr.c Sun Jun 17 21:47:06 2012 @@ -45,6 +45,8 @@ fp->_Mode |= 0x200 /* _MERR */; #elif defined __MINT__ /* Atari FreeMiNT */ fp->__error = 1; +#elif defined __MUSL__ /* musl libc */ + fp_->flags |= F_ERR; #elif defined EPLAN9 /* Plan9 */ if (fp->state != 0 /* CLOSED */) fp->state = 5 /* ERR */; --- lib/fwritable.c.orig Sun Jun 17 22:26:32 2012 +++ lib/fwritable.c Sun Jun 17 21:44:41 2012 @@ -45,6 +45,8 @@ return (fp->_Mode & 0x2 /* _MOPENW */) != 0; #elif defined __MINT__ /* Atari FreeMiNT */ return fp->__mode.__write; +#elif defined __MUSL__ /* musl libc */ + return __fwritable (fp); #elif defined EPLAN9 /* Plan9 */ int fd = fp->fd; if (fd >= 0) --- lib/fwritable.h.orig Sun Jun 17 22:26:32 2012 +++ lib/fwritable.h Sun Jun 17 21:06:31 2012 @@ -22,7 +22,7 @@ STREAM must not be wide-character oriented. The result doesn't change until the stream is closed or re-opened. */ -#if HAVE___FWRITABLE /* glibc >= 2.2, Solaris >= 7 */ +#if HAVE___FWRITABLE /* glibc >= 2.2, Solaris >= 7, musl libc */ # include <stdio_ext.h> # define fwritable(stream) (__fwritable (stream) != 0) --- lib/fwriting.c.orig Sun Jun 17 22:26:32 2012 +++ lib/fwriting.c Sun Jun 17 21:39:56 2012 @@ -21,42 +21,48 @@ #include "stdio-impl.h" +#if !(HAVE___FWRITING && !defined __MUSL__) + bool fwriting (FILE *fp) { /* 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_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ +# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ return (fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) != 0; -#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ +# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ return (fp_->_flags & __SWR) != 0; -#elif defined __EMX__ /* emx+gcc */ +# elif defined __EMX__ /* emx+gcc */ return (fp->_flags & _IOWRT) != 0; -#elif defined __minix /* Minix */ +# elif defined __minix /* Minix */ return (fp->_flags & _IOWRITING) != 0; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */ +# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */ return (fp->_flag & _IOWRT) != 0; -#elif defined __UCLIBC__ /* uClibc */ +# elif defined __UCLIBC__ /* uClibc */ return (fp->__modeflags & __FLAG_WRITING) != 0; -#elif defined __QNX__ /* QNX */ +# elif defined __QNX__ /* QNX */ return ((fp->_Mode & 0x1 /* _MOPENR */) == 0 || (fp->_Mode & 0x2000 /* _MWRITE */) != 0); -#elif defined __MINT__ /* Atari FreeMiNT */ +# elif defined __MINT__ /* Atari FreeMiNT */ if (!fp->__mode.__read) return 1; if (!fp->__mode.__write) return 0; -# ifdef _IO_CURRENTLY_PUTTING /* Flag added on 2009-02-28 */ +# ifdef _IO_CURRENTLY_PUTTING /* Flag added on 2009-02-28 */ return (fp->__flags & _IO_CURRENTLY_PUTTING) != 0; -# else +# else return (fp->__buffer < fp->__put_limit /*|| fp->__bufp == fp->__get_limit ??*/); -# endif -#elif defined EPLAN9 /* Plan9 */ +# endif +# elif defined __MUSL__ /* musl libc */ + return !__freadable (fp) || __fwriting (fp); +# elif defined EPLAN9 /* Plan9 */ if (fp->state == 0 /* CLOSED */ || fp->state == 3 /* RD */) return 0; return (fp->state == 4 /* WR */ && (fp->bufl == 0 || fp->wp < fp->rp)); -#else -# error "Please port gnulib fwriting.c to your platform!" -#endif +# else +# error "Please port gnulib fwriting.c to your platform!" +# endif } + +#endif --- lib/fwriting.h.orig Sun Jun 17 22:26:32 2012 +++ lib/fwriting.h Sun Jun 17 21:45:49 2012 @@ -33,7 +33,8 @@ STREAM must not be wide-character oriented. */ -#if HAVE___FWRITING /* glibc >= 2.2, Solaris >= 7 */ +#if HAVE___FWRITING && !defined __MUSL__ +/* glibc >= 2.2, Solaris >= 7, and not musl libc */ # include <stdio_ext.h> # define fwriting(stream) (__fwriting (stream) != 0) --- lib/stdio-impl.h.orig Sun Jun 17 22:26:32 2012 +++ lib/stdio-impl.h Sun Jun 17 21:53:25 2012 @@ -110,3 +110,22 @@ # endif #endif + + +/* musl implementation. */ + +#ifdef __MUSL__ +# include <stdio_ext.h> +# define fp_ ((struct { unsigned flags; \ + unsigned char *rpos; \ + unsigned char *rend; \ + int (*close)(FILE *); \ + unsigned char *wend; \ + unsigned char *wpos; \ + unsigned char *mustbezero_1; \ + unsigned char *wbase; \ + /* many more fields follow */ \ + } *) fp) +# define F_EOF 16 +# define F_ERR 32 +#endif --- m4/fbufmode.m4.orig Sun Jun 17 22:26:32 2012 +++ m4/fbufmode.m4 Sun Jun 17 22:14:27 2012 @@ -1,4 +1,4 @@ -# fbufmode.m4 serial 1 +# fbufmode.m4 serial 2 dnl Copyright (C) 2007, 2009-2012 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 @@ AC_DEFUN([gl_FUNC_FBUFMODE], [ dnl Prerequisites of lib/fbufmode.c. + AC_REQUIRE([gl_STDIO_IMPL]) AC_CHECK_FUNCS_ONCE([__flbf]) ]) --- m4/freadable.m4.orig Sun Jun 17 22:26:32 2012 +++ m4/freadable.m4 Sun Jun 17 22:14:16 2012 @@ -1,4 +1,4 @@ -# freadable.m4 serial 2 +# freadable.m4 serial 3 dnl Copyright (C) 2007, 2009-2012 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 @@ AC_DEFUN([gl_FUNC_FREADABLE], [ + AC_REQUIRE([gl_STDIO_IMPL]) AC_CHECK_FUNCS_ONCE([__freadable]) ]) Changing permissions from . to 100644 --- m4/freadahead.m4.orig Thu May 10 02:22:35 2012 +++ m4/freadahead.m4 Sun Jun 17 22:16:17 2012 @@ -0,0 +1,10 @@ +# freadahead.m4 serial 1 +dnl Copyright (C) 2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FREADAHEAD], +[ + AC_REQUIRE([gl_STDIO_IMPL]) +]) --- m4/freading.m4.orig Sun Jun 17 22:26:32 2012 +++ m4/freading.m4 Sun Jun 17 22:14:07 2012 @@ -1,4 +1,4 @@ -# freading.m4 serial 1 +# freading.m4 serial 2 dnl Copyright (C) 2007, 2009-2012 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 @@ AC_DEFUN([gl_FUNC_FREADING], [ + AC_REQUIRE([gl_STDIO_IMPL]) AC_CHECK_FUNCS_ONCE([__freading]) ]) Changing permissions from . to 100644 --- m4/freadptr.m4.orig Thu May 10 02:22:35 2012 +++ m4/freadptr.m4 Sun Jun 17 22:16:33 2012 @@ -0,0 +1,10 @@ +# freadptr.m4 serial 1 +dnl Copyright (C) 2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FREADPTR], +[ + AC_REQUIRE([gl_STDIO_IMPL]) +]) Changing permissions from . to 100644 --- m4/freadseek.m4.orig Thu May 10 02:22:35 2012 +++ m4/freadseek.m4 Sun Jun 17 22:17:13 2012 @@ -0,0 +1,11 @@ +# freadseek.m4 serial 1 +dnl Copyright (C) 2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FREADSEEK], +[ + AC_REQUIRE([gl_STDIO_IMPL]) + AC_REQUIRE([AC_C_INLINE]) +]) --- m4/fseeko.m4.orig Sun Jun 17 22:26:33 2012 +++ m4/fseeko.m4 Sun Jun 17 22:13:42 2012 @@ -1,4 +1,4 @@ -# fseeko.m4 serial 16 +# fseeko.m4 serial 17 dnl Copyright (C) 2007-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -67,6 +67,7 @@ # Prerequisites of lib/fseeko.c. AC_DEFUN([gl_PREREQ_FSEEKO], [ + AC_REQUIRE([gl_STDIO_IMPL]) dnl Native Windows has the function _fseeki64. mingw hides it, but mingw64 dnl makes it usable again. AC_CHECK_FUNCS([_fseeki64]) Changing permissions from . to 100644 --- m4/fseterr.m4.orig Thu May 10 02:22:35 2012 +++ m4/fseterr.m4 Sun Jun 17 22:17:33 2012 @@ -0,0 +1,10 @@ +# fseterr.m4 serial 1 +dnl Copyright (C) 2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FSETERR], +[ + AC_REQUIRE([gl_STDIO_IMPL]) +]) --- m4/fwritable.m4.orig Sun Jun 17 22:26:33 2012 +++ m4/fwritable.m4 Sun Jun 17 22:13:53 2012 @@ -1,4 +1,4 @@ -# fwritable.m4 serial 2 +# fwritable.m4 serial 3 dnl Copyright (C) 2007, 2009-2012 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 @@ AC_DEFUN([gl_FUNC_FWRITABLE], [ + AC_REQUIRE([gl_STDIO_IMPL]) AC_CHECK_FUNCS_ONCE([__fwritable]) ]) --- m4/fwriting.m4.orig Sun Jun 17 22:26:33 2012 +++ m4/fwriting.m4 Sun Jun 17 22:14:01 2012 @@ -1,4 +1,4 @@ -# fwriting.m4 serial 2 +# fwriting.m4 serial 3 dnl Copyright (C) 2007, 2009-2012 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 @@ AC_DEFUN([gl_FUNC_FWRITING], [ + AC_REQUIRE([gl_STDIO_IMPL]) AC_CHECK_FUNCS_ONCE([__fwriting]) ]) Changing permissions from . to 100644 --- m4/stdio-impl.m4.orig Thu May 10 02:22:35 2012 +++ m4/stdio-impl.m4 Sun Jun 17 22:09:57 2012 @@ -0,0 +1,19 @@ +# stdio-impl.m4 serial 1 +dnl Copyright (C) 2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Check for specific stdio implementations. +AC_DEFUN([gl_STDIO_IMPL], +[ + AC_CHECK_FUNCS_ONCE([__stdio_read __stdio_write]) + dnl This must end up in config.h in a position after the HAVE_* macros are + dnl defined. Could also use AH_BOTTOM. + AH_VERBATIM([musl], +[/* Define __MUSL__ when using musl libc. */ +#if defined HAVE___STDIO_READ && defined HAVE___STDIO_WRITE +# define __MUSL__ 1 +#endif +]) +]) --- modules/fbufmode.orig Sun Jun 17 22:26:33 2012 +++ modules/fbufmode Sun Jun 17 22:10:39 2012 @@ -6,6 +6,7 @@ lib/fbufmode.c lib/stdio-impl.h m4/fbufmode.m4 +m4/stdio-impl.m4 Depends-on: --- modules/freadable.orig Sun Jun 17 22:26:33 2012 +++ modules/freadable Sun Jun 17 22:10:39 2012 @@ -6,6 +6,7 @@ lib/freadable.c lib/stdio-impl.h m4/freadable.m4 +m4/stdio-impl.m4 Depends-on: stdbool --- modules/freadahead.orig Sun Jun 17 22:26:33 2012 +++ modules/freadahead Sun Jun 17 22:16:05 2012 @@ -6,10 +6,13 @@ lib/freadahead.h lib/freadahead.c lib/stdio-impl.h +m4/freadahead.m4 +m4/stdio-impl.m4 Depends-on: configure.ac: +gl_FUNC_FREADAHEAD Makefile.am: lib_SOURCES += freadahead.c --- modules/freading.orig Sun Jun 17 22:26:33 2012 +++ modules/freading Sun Jun 17 22:10:39 2012 @@ -6,6 +6,7 @@ lib/freading.c lib/stdio-impl.h m4/freading.m4 +m4/stdio-impl.m4 Depends-on: stdbool --- modules/freadptr.orig Sun Jun 17 22:26:33 2012 +++ modules/freadptr Sun Jun 17 22:16:32 2012 @@ -5,10 +5,13 @@ lib/freadptr.h lib/freadptr.c lib/stdio-impl.h +m4/freadptr.m4 +m4/stdio-impl.m4 Depends-on: configure.ac: +gl_FUNC_FREADPTR Makefile.am: lib_SOURCES += freadptr.c --- modules/freadseek.orig Sun Jun 17 22:26:33 2012 +++ modules/freadseek Sun Jun 17 22:17:08 2012 @@ -5,6 +5,8 @@ lib/freadseek.h lib/freadseek.c lib/stdio-impl.h +m4/freadseek.m4 +m4/stdio-impl.m4 Depends-on: freadahead @@ -13,7 +15,7 @@ lseek configure.ac: -AC_REQUIRE([AC_C_INLINE]) +gl_FUNC_FREADSEEK Makefile.am: lib_SOURCES += freadseek.c --- modules/fseeko.orig Sun Jun 17 22:26:33 2012 +++ modules/fseeko Sun Jun 17 22:10:39 2012 @@ -5,6 +5,7 @@ lib/fseeko.c lib/stdio-impl.h m4/fseeko.m4 +m4/stdio-impl.m4 Depends-on: extensions --- modules/fseterr.orig Sun Jun 17 22:26:33 2012 +++ modules/fseterr Sun Jun 17 22:17:32 2012 @@ -5,10 +5,13 @@ lib/fseterr.h lib/fseterr.c lib/stdio-impl.h +m4/fseterr.m4 +m4/stdio-impl.m4 Depends-on: configure.ac: +gl_FUNC_FSETERR Makefile.am: lib_SOURCES += fseterr.c --- modules/fwritable.orig Sun Jun 17 22:26:33 2012 +++ modules/fwritable Sun Jun 17 22:10:39 2012 @@ -6,6 +6,7 @@ lib/fwritable.c lib/stdio-impl.h m4/fwritable.m4 +m4/stdio-impl.m4 Depends-on: stdbool --- modules/fwriting.orig Sun Jun 17 22:26:33 2012 +++ modules/fwriting Sun Jun 17 22:10:39 2012 @@ -6,17 +6,16 @@ lib/fwriting.c lib/stdio-impl.h m4/fwriting.m4 +m4/stdio-impl.m4 Depends-on: stdbool configure.ac: gl_FUNC_FWRITING -if test $ac_cv_func___fwriting = no; then - AC_LIBOBJ([fwriting]) -fi Makefile.am: +lib_SOURCES += fwriting.c Include: "fwriting.h"