Add CVS checkout update instructions.
[gnulib.git] / m4 / fflush.m4
index a9889d4..f796a55 100755 (executable)
@@ -1,4 +1,4 @@
-#serial 1
+# fflush.m4 serial 4
 
 # Copyright (C) 2007 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -8,8 +8,7 @@
 dnl From Eric Blake
 
 dnl Find out how to obey POSIX semantics of fflush(stdin) discarding
-dnl unread input, rather than C99 undefined semantics.  fpurge is not
-dnl standardized, but has the desired properties.
+dnl unread input on seekable streams, rather than C99 undefined semantics.
 
 AC_DEFUN([gl_FUNC_FFLUSH],
 [
@@ -21,9 +20,9 @@ AC_DEFUN([gl_FUNC_FFLUSH],
 #include <stdio.h>
 #include <unistd.h>
        ]], [[FILE *f = fopen ("conftest.txt", "r");
-         char buffer[10];
+        char buffer[10];
         int fd = fileno (f);
-         if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5)
+        if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5)
           return 2;
         /* For deterministic results, ensure f read a bigger buffer.  */
         if (lseek (fd, 0, SEEK_CUR) == 5)
@@ -45,16 +44,9 @@ AC_DEFUN([gl_FUNC_FFLUSH],
 
 AC_DEFUN([gl_REPLACE_FFLUSH],
 [
-  AC_CHECK_HEADERS_ONCE([stdio_ext.h])
-  AC_CHECK_FUNCS_ONCE([fpurge __fpurge])
-dnl Linux documents int fpurge(), but only declares void __fpurge().
-  AC_CHECK_DECLS([fpurge], [], [], [[
-#include <stdio.h>
-#if HAVE_STDIO_EXT_H
-# include <stdio_ext.h>
-#endif
-]])
   AC_LIBOBJ([fflush])
+  AC_LIBOBJ([fseeko])
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   REPLACE_FFLUSH=1
+  REPLACE_FSEEKO=1
 ])