4 dnl Using code from emacs, based on suggestions from Paul Eggert
5 dnl and Ulrich Drepper.
7 AC_DEFUN(jm_FUNC_FPENDING,
9 AC_CHECK_HEADERS(stdio_ext.h)
10 AC_REPLACE_FUNCS([__fpending])
11 if test $ac_cv_func___fpending = no; then
13 [how to determine the number of pending output bytes on a stream],
14 ac_cv_sys_pending_output_n_bytes,
20 'fp->_IO_write_ptr - fp->_IO_write_x_base' \
22 '# traditional Unix' \
23 'fp->_ptr - fp->_base' \
26 'fp->_p - fp->_bf._base' \
29 'fp->__ptr - fp->__base' \
32 'fp->__bufp - fp->__buffer' \
34 '# old glibc iostream?' \
35 'fp->_pptr - fp->_pbase' \
38 '(*fp)->_ptr - (*fp)->_base' \
40 '# e.g., DGUX R4.11; the info is not available' \
44 # Skip each embedded comment.
45 case "$ac_expr" in '#'*) continue;; esac
47 DEFS="$DEFS -DPENDING_OUTPUT_N_BYTES=$ac_expr"
51 [FILE *fp = stdin; (void) ($ac_expr);],
55 test "$fp_done" = yes && break
58 ac_cv_sys_pending_output_n_bytes=$ac_expr
61 AC_DEFINE_UNQUOTED(PENDING_OUTPUT_N_BYTES,
62 $ac_cv_sys_pending_output_n_bytes,
63 [the number of pending output bytes on stream `fp'])