| 1 |
# fpending.m4 |
| 2 |
# serial 23 |
| 3 |
dnl Copyright (C) 2000-2001, 2004-2025 Free Software Foundation, Inc. |
| 4 |
dnl This file is free software; the Free Software Foundation |
| 5 |
dnl gives unlimited permission to copy and/or distribute it, |
| 6 |
dnl with or without modifications, as long as this notice is preserved. |
| 7 |
dnl This file is offered as-is, without any warranty. |
| 8 |
|
| 9 |
dnl From Jim Meyering |
| 10 |
dnl Using code from emacs, based on suggestions from Paul Eggert |
| 11 |
dnl and Ulrich Drepper. |
| 12 |
|
| 13 |
dnl Find out how to determine the number of pending output bytes on a stream. |
| 14 |
dnl glibc (2.1.93 and newer) and Solaris provide __fpending. On other systems, |
| 15 |
dnl we have to grub around in the (possibly opaque) FILE struct. |
| 16 |
|
| 17 |
AC_DEFUN([gl_FUNC_FPENDING], |
| 18 |
[ |
| 19 |
AC_CHECK_HEADERS_ONCE([stdio_ext.h]) |
| 20 |
fp_headers=' |
| 21 |
#include <stdio.h> |
| 22 |
#if HAVE_STDIO_EXT_H |
| 23 |
# include <stdio_ext.h> |
| 24 |
#endif |
| 25 |
' |
| 26 |
AC_CACHE_CHECK([for __fpending], [gl_cv_func___fpending], |
| 27 |
[ |
| 28 |
AC_LINK_IFELSE( |
| 29 |
[AC_LANG_PROGRAM([[$fp_headers]], |
| 30 |
[[return ! __fpending (stdin);]])], |
| 31 |
[gl_cv_func___fpending=yes], |
| 32 |
[gl_cv_func___fpending=no]) |
| 33 |
]) |
| 34 |
if test $gl_cv_func___fpending = yes; then |
| 35 |
AC_CHECK_DECLS([__fpending], [], [], [$fp_headers]) |
| 36 |
fi |
| 37 |
]) |