]> git.sesse.net Git - betaftpd/commitdiff
Multiple fixes for sendfile() where running kernel is not the same on the compilation...
authorsgunderson <sgunderson>
Sat, 2 Sep 2000 15:08:30 +0000 (15:08 +0000)
committersgunderson <sgunderson>
Sat, 2 Sep 2000 15:08:30 +0000 (15:08 +0000)
betaftpd.spec
configure
configure.in
debian/rules
ftpd.c

index 4cc67a60e605aa602c1b026c604a6c5c62a76e41..9e2dcfece61678be81b90f79d052e6e00179aa01 100644 (file)
@@ -21,7 +21,7 @@ easier for other programmers to contribute.
 %setup -q
 
 %build
-./configure --enable-xferlog --enable-ascii --enable-fork --enable-upload --enable-dcache --enable-message --enable-shadow
+./configure --enable-xferlog --enable-ascii --enable-fork --enable-upload --enable-dcache --enable-message --enable-shadow --with-linux-sendfile
 make
 
 %install
@@ -36,6 +36,9 @@ rm -rf %{buildroot}
 /usr/sbin/betaftpd
 
 %changelog
+* Wed Aug 30 2000 Steinar H. Gunderson <sgunderson@bigfoot.com>
+- gave --with-linux-sendfile to configure (see main ChangeLog for rationale)
+
 * Thu Aug 17 2000 Steinar H. Gunderson <sgunderson@bigfoot.com>
 - added some flags to configure that the average user would expect
 - increased version number again
index 20d663d40351ed45b39578f8d3ef9bd2e2ac9c37..ab01c51dfeff298644498903f01922873148ae20 100755 (executable)
--- a/configure
+++ b/configure
@@ -31,6 +31,8 @@ ac_help="$ac_help
   --enable-shadow         Enable shadow password support"
 ac_help="$ac_help
   --enable-nonroot        Do not need root access (EXPERIMENTAL)"
+ac_help="$ac_help
+  --with-linux-sendfile   Force sendfile() support"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -546,7 +548,7 @@ echo $ac_n "checking for prefix by $ac_c" 1>&6
 # Extract the first word of "ftpd", so it can be a program name with args.
 set dummy ftpd; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:550: checking for $ac_word" >&5
+echo "configure:552: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_FTPD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -587,7 +589,7 @@ fi
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:591: checking for $ac_word" >&5
+echo "configure:593: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -617,7 +619,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:621: checking for $ac_word" >&5
+echo "configure:623: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -668,7 +670,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:672: checking for $ac_word" >&5
+echo "configure:674: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -700,7 +702,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:704: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:706: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -711,12 +713,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext << EOF
 
-#line 715 "configure"
+#line 717 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -742,12 +744,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:746: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:748: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:751: checking whether we are using GNU C" >&5
+echo "configure:753: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -756,7 +758,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:760: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:762: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -775,7 +777,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:779: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:781: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -811,12 +813,12 @@ LIBS=""
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:815: checking for working const" >&5
+echo "configure:817: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 820 "configure"
+#line 822 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -865,7 +867,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:871: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -886,7 +888,7 @@ EOF
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:890: checking how to run the C preprocessor" >&5
+echo "configure:892: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -901,13 +903,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 905 "configure"
+#line 907 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:911: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:913: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -918,13 +920,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 922 "configure"
+#line 924 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:928: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:930: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -935,13 +937,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 939 "configure"
+#line 941 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:945: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -969,17 +971,17 @@ for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:973: checking for $ac_hdr" >&5
+echo "configure:975: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 978 "configure"
+#line 980 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:983: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1008,12 +1010,12 @@ done
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1012: checking for $ac_func" >&5
+echo "configure:1014: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1017 "configure"
+#line 1019 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1036,7 +1038,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1061,7 +1063,7 @@ fi
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:1065: checking for working mmap" >&5
+echo "configure:1067: checking for working mmap" >&5
 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1069,7 +1071,7 @@ else
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 1073 "configure"
+#line 1075 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -1209,7 +1211,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:1213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_mmap_fixed_mapped=yes
 else
@@ -1232,12 +1234,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1236: checking return type of signal handlers" >&5
+echo "configure:1238: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1241 "configure"
+#line 1243 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -1254,7 +1256,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:1258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -1275,12 +1277,12 @@ EOF
 for ac_func in snprintf vsnprintf
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1279: checking for $ac_func" >&5
+echo "configure:1281: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1284 "configure"
+#line 1286 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1303,7 +1305,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1329,7 +1331,7 @@ done
 
 
 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:1333: checking for socket in -lsocket" >&5
+echo "configure:1335: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1337,7 +1339,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1341 "configure"
+#line 1343 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1348,7 +1350,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:1352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1373,7 +1375,7 @@ if test "$result" = "yes"; then
   LIBS="$LIBS -lsocket"
 else
   echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:1377: checking for connect in -lsocket" >&5
+echo "configure:1379: checking for connect in -lsocket" >&5
 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1381,7 +1383,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1385 "configure"
+#line 1387 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1392,7 +1394,7 @@ int main() {
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:1396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1419,7 +1421,7 @@ fi
 fi
 
 echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:1423: checking for crypt in -lcrypt" >&5
+echo "configure:1425: checking for crypt in -lcrypt" >&5
 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1427,7 +1429,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcrypt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1431 "configure"
+#line 1433 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1438,7 +1440,7 @@ int main() {
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:1442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1467,7 +1469,7 @@ fi
 
 
 echo $ac_n "checking whether to enable xferlog""... $ac_c" 1>&6
-echo "configure:1471: checking whether to enable xferlog" >&5
+echo "configure:1473: checking whether to enable xferlog" >&5
 # Check whether --enable-xferlog or --disable-xferlog was given.
 if test "${enable_xferlog+set}" = set; then
   enableval="$enable_xferlog"
@@ -1490,7 +1492,7 @@ echo "$ac_t""$enableval" 1>&6
 
 
 echo $ac_n "checking whether to enable ascii""... $ac_c" 1>&6
-echo "configure:1494: checking whether to enable ascii" >&5
+echo "configure:1496: checking whether to enable ascii" >&5
 # Check whether --enable-ascii or --disable-ascii was given.
 if test "${enable_ascii+set}" = set; then
   enableval="$enable_ascii"
@@ -1513,7 +1515,7 @@ echo "$ac_t""$enableval" 1>&6
 
 
 echo $ac_n "checking whether to enable fullscreen""... $ac_c" 1>&6
-echo "configure:1517: checking whether to enable fullscreen" >&5
+echo "configure:1519: checking whether to enable fullscreen" >&5
 # Check whether --enable-fullscreen or --disable-fullscreen was given.
 if test "${enable_fullscreen+set}" = set; then
   enableval="$enable_fullscreen"
@@ -1538,7 +1540,7 @@ echo "$ac_t""$enableval" 1>&6
 if test "$enableval" = "no"; then
        
 echo $ac_n "checking whether to enable fork""... $ac_c" 1>&6
-echo "configure:1542: checking whether to enable fork" >&5
+echo "configure:1544: checking whether to enable fork" >&5
 # Check whether --enable-fork or --disable-fork was given.
 if test "${enable_fork+set}" = set; then
   enableval="$enable_fork"
@@ -1563,7 +1565,7 @@ fi
 
 
 echo $ac_n "checking whether to enable upload""... $ac_c" 1>&6
-echo "configure:1567: checking whether to enable upload" >&5
+echo "configure:1569: checking whether to enable upload" >&5
 # Check whether --enable-upload or --disable-upload was given.
 if test "${enable_upload+set}" = set; then
   enableval="$enable_upload"
@@ -1586,7 +1588,7 @@ echo "$ac_t""$enableval" 1>&6
 
 
 echo $ac_n "checking whether to enable stat""... $ac_c" 1>&6
-echo "configure:1590: checking whether to enable stat" >&5
+echo "configure:1592: checking whether to enable stat" >&5
 # Check whether --enable-stat or --disable-stat was given.
 if test "${enable_stat+set}" = set; then
   enableval="$enable_stat"
@@ -1609,7 +1611,7 @@ echo "$ac_t""$enableval" 1>&6
 
 
 echo $ac_n "checking whether to enable dcache""... $ac_c" 1>&6
-echo "configure:1613: checking whether to enable dcache" >&5
+echo "configure:1615: checking whether to enable dcache" >&5
 # Check whether --enable-dcache or --disable-dcache was given.
 if test "${enable_dcache+set}" = set; then
   enableval="$enable_dcache"
@@ -1632,7 +1634,7 @@ echo "$ac_t""$enableval" 1>&6
 
 
 echo $ac_n "checking whether to enable message""... $ac_c" 1>&6
-echo "configure:1636: checking whether to enable message" >&5
+echo "configure:1638: checking whether to enable message" >&5
 # Check whether --enable-message or --disable-message was given.
 if test "${enable_message+set}" = set; then
   enableval="$enable_message"
@@ -1656,7 +1658,7 @@ echo "$ac_t""$enableval" 1>&6
 
 
 echo $ac_n "checking whether to enable shadow""... $ac_c" 1>&6
-echo "configure:1660: checking whether to enable shadow" >&5
+echo "configure:1662: checking whether to enable shadow" >&5
 # Check whether --enable-shadow or --disable-shadow was given.
 if test "${enable_shadow+set}" = set; then
   enableval="$enable_shadow"
@@ -1685,17 +1687,17 @@ if test "$enableval" = "yes"; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1689: checking for $ac_hdr" >&5
+echo "configure:1691: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1694 "configure"
+#line 1696 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1699: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1701: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1729,7 +1731,7 @@ fi
 if test "$nonroot_support" = "yes"; then
        
 echo $ac_n "checking whether to enable nonroot""... $ac_c" 1>&6
-echo "configure:1733: checking whether to enable nonroot" >&5
+echo "configure:1735: checking whether to enable nonroot" >&5
 # Check whether --enable-nonroot or --disable-nonroot was given.
 if test "${enable_nonroot+set}" = set; then
   enableval="$enable_nonroot"
@@ -1761,7 +1763,7 @@ if test "$enableval" = "yes"; then
 else
 
        echo $ac_n "checking how to get effective uid""... $ac_c" 1>&6
-echo "configure:1765: checking how to get effective uid" >&5
+echo "configure:1767: checking how to get effective uid" >&5
        if test -n "$EUID"; then
                B_UID=$EUID
                echo "$ac_t""\$EUID ($EUID)" 1>&6
@@ -1794,12 +1796,12 @@ echo "configure:1765: checking how to get effective uid" >&5
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1798: checking for ANSI C header files" >&5
+echo "configure:1800: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1803 "configure"
+#line 1805 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1807,7 +1809,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1824,7 +1826,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1828 "configure"
+#line 1830 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1842,7 +1844,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1846 "configure"
+#line 1848 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1863,7 +1865,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1867 "configure"
+#line 1869 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1874,7 +1876,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:1878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1898,12 +1900,12 @@ EOF
 fi
 
 echo $ac_n "checking for uid_t""... $ac_c" 1>&6
-echo "configure:1902: checking for uid_t" >&5
+echo "configure:1904: checking for uid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1907 "configure"
+#line 1909 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1931,12 +1933,12 @@ EOF
 fi
 
 echo $ac_n "checking for gid_t""... $ac_c" 1>&6
-echo "configure:1935: checking for gid_t" >&5
+echo "configure:1937: checking for gid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_gid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1940 "configure"
+#line 1942 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1968,17 +1970,17 @@ for ac_hdr in crypt.h unistd.h time.h sys/time.h errno.h netinet/in.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1972: checking for $ac_hdr" >&5
+echo "configure:1974: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1977 "configure"
+#line 1979 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1982: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2008,17 +2010,17 @@ for ac_hdr in netinet/ip.h stropts.h sys/conf.h arpa/inet.h sys/filio.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2012: checking for $ac_hdr" >&5
+echo "configure:2014: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2017 "configure"
+#line 2019 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2048,17 +2050,17 @@ for ac_hdr in netinet/tcp.h sys/types.h netdb.h glob.h stdio.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2052: checking for $ac_hdr" >&5
+echo "configure:2054: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2057 "configure"
+#line 2059 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2062: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2064: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2088,17 +2090,17 @@ for ac_hdr in stdlib.h stdarg.h stdlib.h string.h strings.h fcntl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2092: checking for $ac_hdr" >&5
+echo "configure:2094: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2097 "configure"
+#line 2099 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2102: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2104: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2128,17 +2130,17 @@ for ac_hdr in sys/ioctl.h sys/socket.h sys/stat.h sys/param.h signal.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2132: checking for $ac_hdr" >&5
+echo "configure:2134: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2137 "configure"
+#line 2139 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2142: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2144: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2168,17 +2170,17 @@ for ac_hdr in sys/signal.h dirent.h pwd.h grp.h netinet/in_systm.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2172: checking for $ac_hdr" >&5
+echo "configure:2174: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2177 "configure"
+#line 2179 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2182: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2184: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2208,17 +2210,17 @@ for ac_hdr in assert.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2212: checking for $ac_hdr" >&5
+echo "configure:2214: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2217 "configure"
+#line 2219 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2222: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2224: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2247,17 +2249,17 @@ done
 
 ac_safe=`echo "netinet/tcp.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for netinet/tcp.h""... $ac_c" 1>&6
-echo "configure:2251: checking for netinet/tcp.h" >&5
+echo "configure:2253: checking for netinet/tcp.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2256 "configure"
+#line 2258 "configure"
 #include "confdefs.h"
 #include <netinet/tcp.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2261: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2283,9 +2285,9 @@ fi
 
 if test "$result" = "yes"; then
      echo $ac_n "checking if netinet/tcp.h is enough""... $ac_c" 1>&6
-echo "configure:2287: checking if netinet/tcp.h is enough" >&5
+echo "configure:2289: checking if netinet/tcp.h is enough" >&5
      cat > conftest.$ac_ext <<EOF
-#line 2289 "configure"
+#line 2291 "configure"
 #include "confdefs.h"
 #include <netinet/tcp.h>
 #ifndef TCP_NODELAY
@@ -2309,17 +2311,17 @@ fi
 if test "$result" = "no"; then
        ac_safe=`echo "linux/socket.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for linux/socket.h""... $ac_c" 1>&6
-echo "configure:2313: checking for linux/socket.h" >&5
+echo "configure:2315: checking for linux/socket.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2318 "configure"
+#line 2320 "configure"
 #include "confdefs.h"
 #include <linux/socket.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2323: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2325: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2346,17 +2348,17 @@ for ac_hdr in sys/poll.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2350: checking for $ac_hdr" >&5
+echo "configure:2352: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2355 "configure"
+#line 2357 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2360: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2362: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2384,9 +2386,9 @@ done
 
 
 echo $ac_n "checking for poll()""... $ac_c" 1>&6
-echo "configure:2388: checking for poll()" >&5
+echo "configure:2390: checking for poll()" >&5
 cat > conftest.$ac_ext <<EOF
-#line 2390 "configure"
+#line 2392 "configure"
 #include "confdefs.h"
 
 #if HAVE_SYS_POLL_H
@@ -2403,7 +2405,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2407: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2409: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   enableval=yes
 else
@@ -2426,17 +2428,17 @@ for ac_hdr in sys/sendfile.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2430: checking for $ac_hdr" >&5
+echo "configure:2432: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2435 "configure"
+#line 2437 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2440: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2442: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2466,9 +2468,9 @@ done
 
 if test "$result" = "yes"; then
        echo $ac_n "checking for Linux sendfile()""... $ac_c" 1>&6
-echo "configure:2470: checking for Linux sendfile()" >&5
+echo "configure:2472: checking for Linux sendfile()" >&5
        cat > conftest.$ac_ext <<EOF
-#line 2472 "configure"
+#line 2474 "configure"
 #include "confdefs.h"
 
 #if HAVE_SYS_SOCKET_H
@@ -2491,9 +2493,14 @@ echo "configure:2470: checking for Linux sendfile()" >&5
 #include <sys/types.h>
 #endif
 
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
 #if HAVE_SYS_UIO_H
 #include <sys/uio.h>
 #endif
+
 int main() {
 
        int out_fd = 1, in_fd = 0;
@@ -2504,7 +2511,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2508: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2515: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   enableval=yes
 else
@@ -2517,26 +2524,108 @@ rm -f conftest*
        echo "$ac_t""$enableval" 1>&6
 
        if test "$enableval" = "yes"; then
-               cat >> confdefs.h <<\EOF
+                                                                               echo $ac_n "checking that sendfile() really is implemented""... $ac_c" 1>&6
+echo "configure:2529: checking that sendfile() really is implemented" >&5
+
+               if test "$cross_compiling" = yes; then
+  enableval="cross-compiling, not checked"
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2535 "configure"
+#include "confdefs.h"
+
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#if HAVE_SYS_LIMITS_H
+#include <sys/limits.h>
+#endif
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if HAVE_SYS_SENDFILE_H
+#include <sys/sendfile.h>
+#endif
+
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#if HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
+int main() {
+        int out_fd = 1, in_fd = 0;
+        off_t offset = 0;
+        size_t size = 1024;
+
+       errno = 0;
+       sendfile(out_fd, in_fd, &offset, size);
+       if (errno == ENOSYS)
+               return 0;
+       else
+               return 1;
+}
+EOF
+if { (eval echo configure:2579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  enableval=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  enableval=yes
+fi
+rm -fr conftest*
+fi
+
+               echo "$ac_t""$enableval" 1>&6
+
+               has_sendfile=$enableval
+
+                                                               # Check whether --with-linux-sendfile or --without-linux-sendfile was given.
+if test "${with_linux_sendfile+set}" = set; then
+  withval="$with_linux_sendfile"
+  has_sendfile=$withval
+fi
+
+
+               if test $has_sendfile != "no"; then
+                       cat >> confdefs.h <<\EOF
 #define HAVE_LINUX_SENDFILE 1
 EOF
 
+                       has_sendfile=enabled
+               else
+                       has_sendfile=disabled
+               fi
+               echo $ac_n "checking final status of Linux sendfile() support""... $ac_c" 1>&6
+echo "configure:2612: checking final status of Linux sendfile() support" >&5
+               echo "$ac_t""$has_sendfile" 1>&6
        fi
 fi
 
 ac_safe=`echo "sys/uio.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/uio.h""... $ac_c" 1>&6
-echo "configure:2530: checking for sys/uio.h" >&5
+echo "configure:2619: checking for sys/uio.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2535 "configure"
+#line 2624 "configure"
 #include "confdefs.h"
 #include <sys/uio.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2540: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2629: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2560,9 +2649,9 @@ fi
 
 if test "$result" = "yes"; then
        echo $ac_n "checking for BSD sendfile()""... $ac_c" 1>&6
-echo "configure:2564: checking for BSD sendfile()" >&5
+echo "configure:2653: checking for BSD sendfile()" >&5
        cat > conftest.$ac_ext <<EOF
-#line 2566 "configure"
+#line 2655 "configure"
 #include "confdefs.h"
 
 #if HAVE_SYS_LIMITS_H
@@ -2603,7 +2692,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2607: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   enableval=yes
 else
index cddb6a18c41478bf6819a2249b8d40a072c567f9..10286bb8c8792e54a96830401ef61d521d307fd3 100644 (file)
@@ -194,6 +194,9 @@ dnl
 dnl sendfile() is not standard -- we'll have to check the different
 dnl versions one by one :-)
 dnl
+dnl Unfortunately, we'll have to run the program too -- this is a
+dnl problem with newer libc's and not-so-new kernels :-)
+dnl
 AC_CHECK_HEADERS(sys/sendfile.h,result=yes,result=no)
 
 if test "$result" = "yes"; then
@@ -219,9 +222,14 @@ if test "$result" = "yes"; then
 #include <sys/types.h>
 #endif
 
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
 #if HAVE_SYS_UIO_H
 #include <sys/uio.h>
-#endif],[
+#endif
+],[
        int out_fd = 1, in_fd = 0;
        off_t offset = 0;
        size_t size = 1024;
@@ -231,7 +239,71 @@ if test "$result" = "yes"; then
        AC_MSG_RESULT($enableval)
 
        if test "$enableval" = "yes"; then
-               AC_DEFINE(HAVE_LINUX_SENDFILE, 1, [Define if you have sendfile() with the Linux semantics.])
+               dnl
+               dnl If the compile fails now, we assume sendfile() exists (since this
+               dnl is by far the most common case)
+               dnl
+               AC_MSG_CHECKING([that sendfile() really is implemented])
+
+               AC_TRY_RUN([
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#if HAVE_SYS_LIMITS_H
+#include <sys/limits.h>
+#endif
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if HAVE_SYS_SENDFILE_H
+#include <sys/sendfile.h>
+#endif
+
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#if HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
+int main() {
+        int out_fd = 1, in_fd = 0;
+        off_t offset = 0;
+        size_t size = 1024;
+
+       errno = 0;
+       sendfile(out_fd, in_fd, &offset, size);
+       if (errno == ENOSYS)
+               return 0;
+       else
+               return 1;
+}],
+               enableval=no,enableval=yes,[enableval="cross-compiling, not checked"])
+               AC_MSG_RESULT($enableval)
+
+               has_sendfile=$enableval
+
+               dnl
+               dnl Force sendfile() `state' if the user tells us to
+               dnl
+               AC_ARG_WITH(linux-sendfile,[  --with-linux-sendfile   Force sendfile() support],has_sendfile=$withval)
+
+               if test $has_sendfile != "no"; then
+                       AC_DEFINE(HAVE_LINUX_SENDFILE, 1, [Define if you have sendfile() with the Linux semantics.])
+                       has_sendfile=enabled
+               else
+                       has_sendfile=disabled
+               fi
+               AC_MSG_CHECKING([final status of Linux sendfile() support])
+               AC_MSG_RESULT($has_sendfile)
        fi
 fi
 
index ad0585197742efb4362d1c9611900f089901237b..59864ad76f40ebbbcbec19179442c08ad9c3de2d 100755 (executable)
@@ -6,7 +6,7 @@ package=betaftpd
 
 build:
        $(checkdir)
-       CFLAGS="-O6 -Wall" ./configure --prefix=/usr --enable-xferlog --enable-ascii --enable-fork --enable-upload --enable-dcache --enable-message --enable-shadow
+       CFLAGS="-O6 -Wall" ./configure --prefix=/usr --enable-xferlog --enable-ascii --enable-fork --enable-upload --enable-dcache --enable-message --enable-shadow --with-linux-sendfile
        $(MAKE) CFLAGS="-O6 -Wall"
        touch build
 
diff --git a/ftpd.c b/ftpd.c
index 637469b9a2b4c98cc41220cf4fbe9209c5d45ec9..3982a74e2d4812a1f42ccafd345995f55a1ceb1a 100644 (file)
--- a/ftpd.c
+++ b/ftpd.c
@@ -198,6 +198,10 @@ fd_set master_fds, master_send_fds;
 FILE *xferlog = NULL;
 #endif
 
+#if HAVE_LINUX_SENDFILE
+int sendfile_supported = 1;
+#endif
+
 /*
  * This variable specifies if it's soon time to check for timed out
  * clients, and timed out directory listing cache entries. It is
@@ -790,7 +794,7 @@ int do_download(struct ftran *f)
         * Here we use a rather simplified sending `algorithm',
         * leaving most of the quirks to the system calls.
         */
-       if (f->dir_listing == 0) {
+       if (sendfile_supported == 1 && f->dir_listing == 0) {
                int err;
                size = f->size - f->pos;
 
@@ -997,6 +1001,19 @@ int main(void)
        alarm(60);
        signal(SIGALRM, handle_alarm);
 
+#if HAVE_LINUX_SENDFILE
+       /* check that sendfile() is really implemented (same check as configure does) */
+       {
+               int out_fd = 1, in_fd = 0;
+               off_t offset = 0;
+               size_t size = 1024;
+
+               errno = 0;
+               sendfile(out_fd, in_fd, &offset, size);
+               if (errno == ENOSYS) sendfile_supported = 0;
+       }
+#endif
+
        for ( ;; ) {
                int i;
 #ifndef HAVE_POLL
@@ -1373,7 +1390,7 @@ void init_file_transfer(struct ftran * const f)
 #if HAVE_MMAP
        if (f->dir_listing == 0) {
 #if HAVE_LINUX_SENDFILE
-               int do_mmap = 0;
+               int do_mmap = (sendfile_supported) ? 0 : 1;
 #else
                int do_mmap = 1;
 #endif