]> arthur.barton.de Git - netatalk.git/blobdiff - configure.in
sendfile for LARGE_FILE. use sys_ftruncate in ad_open too, temporary fix with
[netatalk.git] / configure.in
index 52c1165b05d6a12f76baaba57f5376bc6633ae34..dd09973cf2b158b799357f89b580d5e156247cdf 100644 (file)
@@ -1,4 +1,4 @@
-dnl $Id: configure.in,v 1.179.2.3.2.6 2003-09-26 23:46:21 bfernhomberg Exp $
+dnl $Id: configure.in,v 1.179.2.3.2.7 2003-10-17 00:01:10 didg Exp $
 dnl configure.in for netatalk
 
 AC_INIT(bin/adv1tov2/adv1tov2.c)
@@ -722,20 +722,42 @@ if test x"$this_os" = "xlinux"; then
         )
 
        if test x"$linux_sendfile" = "xyes"; then 
-           dnl --- added by Yoshinobu Ishizaki (2001.03.13) ---
-           dnl ----- check if version is newer than 2.2.x
-           changequote(<<,>>)
-           majorvers="`uname -r | sed 's/\([0-9]\)..*/\1/'`"
-           minorvers="`uname -r | sed 's/[0-9]\.\([0-9]\)\..*/\1/'`"
-           if [ $majorvers -ge 2 ]; then
-               if [ $minorvers -ge 2 ]; then
-                       changequote([,])
-                       AC_MSG_RESULT([ * found Linux 2.2.x or higher])
-                       AC_DEFINE(SENDFILE_FLAVOR_LINUX, 1, [Define if the sendfile() function uses Linux semantics])
-               else
-                       AC_MSG_RESULT([ * found Linux 2.0.x ]) 
-               fi
-            fi
+           AC_CACHE_CHECK([for linux sendfile support],netatalk_cv_HAVE_SENDFILE,[
+           AC_TRY_LINK([#include <sys/sendfile.h>],
+[\
+int tofd, fromfd;
+off_t offset;
+size_t total;
+ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
+],
+netatalk_cv_HAVE_SENDFILE=yes,netatalk_cv_HAVE_SENDFILE=no)])
+
+# Try and cope with broken Linux sendfile....
+           AC_CACHE_CHECK([for broken linux sendfile support],samba_cv_HAVE_BROKEN_LINUX_SENDFILE,[
+           AC_TRY_LINK([\
+#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
+#undef _FILE_OFFSET_BITS
+#endif
+#include <sys/sendfile.h>],
+[\
+int tofd, fromfd;
+off_t offset;
+size_t total;
+ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
+],
+netatalk_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,netatalk_cv_HAVE_BROKEN_LINUX_SENDFILE=no)])
+
+           if test x"$netatalk_cv_HAVE_SENDFILE" = x"yes"; then
+               AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
+               AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
+               AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used])
+           elif test x"$netatalk_cv_HAVE_BROKEN_LINUX_SENDFILE" = x"yes"; then
+               AC_DEFINE(SENDFILE_FLAVOR_LINUX,1,[Whether linux sendfile() API is available])
+               AC_DEFINE(LINUX_BROKEN_SENDFILE_API,1,[Whether (linux) sendfile() is broken])
+               AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile should be used])
+           else
+               AC_MSG_RESULT(no);
+           fi
        fi
 
        dnl ----- Linux/alpha specific -----