summaryrefslogtreecommitdiff
path: root/package/findutils/patches/patch-gnulib_m4_fflush_m4
blob: 5cee53cc0cd59aa922ad3c8f74e2b6a3801d80a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- findutils-4.4.2.orig/gnulib/m4/fflush.m4	2009-05-10 23:23:57.000000000 +0200
+++ findutils-4.4.2/gnulib/m4/fflush.m4	2014-03-23 16:40:29.000000000 +0100
@@ -32,14 +32,20 @@ AC_DEFUN([gl_FUNC_FFLUSH],
 	   return 4;
 	 return !(lseek (fd, 0, SEEK_CUR) == 5);
        ]])], [gl_cv_func_fflush_stdin=yes], [gl_cv_func_fflush_stdin=no],
-     [dnl Pessimistically assume fflush is broken.  This is wrong for
-      dnl at least glibc and cygwin; but lib/fflush.c takes this into account.
-      gl_cv_func_fflush_stdin=no])
+	[gl_cv_func_fflush_stdin=cross])
      rm conftest.txt
     ])
-  if test $gl_cv_func_fflush_stdin = no; then
+  if test $gl_cv_func_fflush_stdin != yes; then
     gl_REPLACE_FFLUSH
   fi
+  case $gl_cv_func_fflush_stdin in
+    yes) gl_func_fflush_stdin=1 ;;
+    no)  gl_func_fflush_stdin=0 ;;
+    *)   gl_func_fflush_stdin='(-1)' ;;
+  esac
+  AC_DEFINE_UNQUOTED([FUNC_FFLUSH_STDIN], [$gl_func_fflush_stdin],
+    [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008,
+     0 if fflush is known to not work, -1 if unknown.])
 ])
 
 AC_DEFUN([gl_REPLACE_FFLUSH],