- 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
+ netatalk_cv_linux_sendfile=no
+ AC_ARG_ENABLE(sendfile,
+ [ --enable-sendfile use sendfile syscall default (no) ],[
+ if test "$enableval" = "yes"; then
+ netatalk_cv_linux_sendfile=yes
+ fi
+ AC_MSG_RESULT([enabling sendfile syscall])
+ ]
+ )
+
+ if test x"$netatalk_cv_linux_sendfile" = "xyes"; then
+ 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],netatalk_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,netatalk_cv_HAVE_BROKEN_SENDFILE=cross)])
+
+ 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
+ netatalk_cv_linux_sendfile=no
+ AC_MSG_RESULT(no);
+ fi