configure: Check for stdio_ext.h

For portability, check for stdio_ext.h during configure and define
HAVE_STDIO_EXT_H accordingly.

If the current system does not provide this header, use a fallback for
__fpending(). This definition will not work on all systems as it relies
on internal data structures of libc. A more portable solution should be
preferred, for example by using gnulib.
This commit is contained in:
Rainer Müller
2013-02-20 20:10:40 +01:00
parent 538bd978a4
commit 6df4fc403d
2 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,12 @@
#include <errno.h>
#include <error.h>
#include <stdio_ext.h>
#ifdef HAVE_STDIO_EXT_H
# include <stdio_ext.h>
#else
/* FIXME: use a more portable definition of __fpending() (from gnulib?) */
# include <stdio.h>
# define __fpending(fp) ((fp)->_p - (fp)->_bf._base)
#endif
#include <stdlib.h>
#include <unistd.h>