4 dnl Using code from emacs, based on suggestions from Paul Eggert
5 dnl and Ulrich Drepper.
7 dnl Find out how to determine the number of pending output bytes on a stream.
8 dnl Solaris provides __fpending. On other systems, we have to grub around
9 dnl in the FILE struct.
11 AC_DEFUN(jm_FUNC_FPENDING,
13 AC_CHECK_HEADERS(stdio_ext.h)
14 AC_REPLACE_FUNCS([__fpending])
15 if test $ac_cv_func___fpending = no; then
17 [how to determine the number of pending output bytes on a stream],
18 ac_cv_sys_pending_output_n_bytes,
24 'fp->_IO_write_ptr - fp->_IO_write_base' \
26 '# traditional Unix' \
27 'fp->_ptr - fp->_base' \
30 'fp->_p - fp->_bf._base' \
33 'fp->__ptr - fp->__base' \
36 'fp->__bufp - fp->__buffer' \
38 '# old glibc iostream?' \
39 'fp->_pptr - fp->_pbase' \
42 '(*fp)->_ptr - (*fp)->_base' \
44 '# e.g., DGUX R4.11; the info is not available' \
48 # Skip each embedded comment.
49 case "$ac_expr" in '#'*) continue;; esac
51 DEFS="$DEFS -DPENDING_OUTPUT_N_BYTES=$ac_expr"
55 [FILE *fp = stdin; (void) ($ac_expr);],
59 test "$fp_done" = yes && break
62 ac_cv_sys_pending_output_n_bytes=$ac_expr
65 AC_DEFINE_UNQUOTED(PENDING_OUTPUT_N_BYTES,
66 $ac_cv_sys_pending_output_n_bytes,
67 [the number of pending output bytes on stream `fp'])