Zdenek Prikryl 51bf205
diff -ur less-418.orig/configure.ac less-418/configure.ac
Zdenek Prikryl 51bf205
--- less-418.orig/configure.ac	2008-12-22 07:10:44.000000000 -0500
Zdenek Prikryl 51bf205
+++ less-418/configure.ac	2008-12-22 07:28:58.000000000 -0500
Zdenek Prikryl 51bf205
@@ -203,6 +203,8 @@
Zdenek Prikryl 51bf205
 	[Define HAVE_TIME_T if your system supports the "time_t" type.])
Zdenek Prikryl 51bf205
 AH_TEMPLATE([HAVE_STRERROR],
Zdenek Prikryl 51bf205
 	[Define HAVE_STRERROR if you have the strerror() function.])
Zdenek Prikryl 51bf205
+AH_TEMPLATE([HAVE_FSYNC],
Zdenek Prikryl 51bf205
+	[Define HAVE_FSYNC if fsync() on a tty works.])
Zdenek Prikryl 51bf205
 AH_TEMPLATE([HAVE_FILENO],
Zdenek Prikryl 51bf205
 	[Define HAVE_FILENO if you have the fileno() macro.])
Zdenek Prikryl 51bf205
 AH_TEMPLATE([HAVE_ERRNO],
Zdenek Prikryl 51bf205
@@ -251,7 +253,7 @@
Zdenek Prikryl 51bf205
 
Zdenek Prikryl 51bf205
 # Checks for library functions.
Zdenek Prikryl 51bf205
 AC_TYPE_SIGNAL
4a46a54
-AC_CHECK_FUNCS([fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod realpath])
4a46a54
+AC_CHECK_FUNCS([popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod realpath])
Zdenek Prikryl 51bf205
 
Zdenek Prikryl 51bf205
 # AC_CHECK_FUNCS may not work for inline functions, so test these separately.
Zdenek Prikryl 51bf205
 AC_MSG_CHECKING(for memcpy)
Zdenek Prikryl 51bf205
@@ -298,6 +300,16 @@
Zdenek Prikryl 51bf205
 #endif], [static char *x; x = strerror(0);],
Zdenek Prikryl 51bf205
   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRERROR)], [AC_MSG_RESULT(no)])
Zdenek Prikryl 51bf205
 
Zdenek Prikryl 51bf205
+AC_MSG_CHECKING(for fsync)
Zdenek Prikryl 51bf205
+AC_TRY_RUN([
Zdenek Prikryl 51bf205
+#include <fcntl.h>
Zdenek Prikryl 51bf205
+#include <unistd.h>
Zdenek Prikryl 51bf205
+int main(void)
Zdenek Prikryl 51bf205
+{
Zdenek Prikryl 51bf205
+        int fd = open("/dev/tty", O_RDWR);
Zdenek Prikryl 51bf205
+        return fsync(fd);
Zdenek Prikryl 51bf205
+}], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FSYNC)], [AC_MSG_RESULT(no)])
Zdenek Prikryl 51bf205
+
Zdenek Prikryl 51bf205
 AC_MSG_CHECKING(for sys_errlist)
Zdenek Prikryl 51bf205
 AC_TRY_LINK(, [extern char *sys_errlist[]; static char **x; x = sys_errlist;], 
Zdenek Prikryl 51bf205
   [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_ERRLIST)], [AC_MSG_RESULT(no)])