diff options
-rw-r--r-- | source3/acconfig.h | 1 | ||||
-rwxr-xr-x | source3/configure | 97 | ||||
-rw-r--r-- | source3/configure.in | 33 | ||||
-rw-r--r-- | source3/include/config.h.in | 1 |
4 files changed, 112 insertions, 20 deletions
diff --git a/source3/acconfig.h b/source3/acconfig.h index 8ca44f7aba..40a3a7cee1 100644 --- a/source3/acconfig.h +++ b/source3/acconfig.h @@ -227,3 +227,4 @@ #undef LINUX_SENDFILE_API #undef LINUX_BROKEN_SENDFILE_API #undef WITH_SENDFILE +#undef FREEBSD_SENDFILE_API diff --git a/source3/configure b/source3/configure index 56ac8ef274..eb8d091dbc 100755 --- a/source3/configure +++ b/source3/configure @@ -13818,8 +13818,8 @@ if test "${with_sendfile_support+set}" = set; then case "$host_os" in *linux*) - echo $ac_n "checking for sendfile64 support""... $ac_c" 1>&6 -echo "configure:13823: checking for sendfile64 support" >&5 + echo $ac_n "checking for linux sendfile64 support""... $ac_c" 1>&6 +echo "configure:13823: checking for linux sendfile64 support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_SENDFILE64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -13851,8 +13851,8 @@ fi echo "$ac_t""$samba_cv_HAVE_SENDFILE64" 1>&6 - echo $ac_n "checking for sendfile support""... $ac_c" 1>&6 -echo "configure:13856: checking for sendfile support" >&5 + echo $ac_n "checking for linux sendfile support""... $ac_c" 1>&6 +echo "configure:13856: checking for linux sendfile support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_SENDFILE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -13962,6 +13962,67 @@ EOF fi ;; + *freebsd*) + echo $ac_n "checking for freebsd sendfile support""... $ac_c" 1>&6 +echo "configure:13968: checking for freebsd sendfile support" >&5 +if eval "test \"`echo '$''{'samba_cv_HAVE_SENDFILE'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext <<EOF +#line 13974 "configure" +#include "confdefs.h" +\ +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/uio.h> +int main() { +\ + int fromfd, tofd; + off_t offset, nwritten; + struct sf_hdtr hdr; + struct iovec hdtrl; + hdr->headers = &hdtrl; + hdr->hdr_cnt = 1; + hdr->trailers = NULL; + hdr->trl_cnt = 0; + hdtrl.iov_base = NULL; + hdtrl.iov_len = 0; + int ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0); + +; return 0; } +EOF +if { (eval echo configure:13996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + samba_cv_HAVE_SENDFILE=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + samba_cv_HAVE_SENDFILE=no +fi +rm -f conftest* +fi + +echo "$ac_t""$samba_cv_HAVE_SENDFILE" 1>&6 + + if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_SENDFILE 1 +EOF + + cat >> confdefs.h <<\EOF +#define FREEBSD_SENDFILE_API 1 +EOF + + cat >> confdefs.h <<\EOF +#define WITH_SENDFILE 1 +EOF + + else + echo "$ac_t""no" 1>&6; + fi + ;; *) ;; esac @@ -13983,7 +14044,7 @@ fi # (WINBIND_STARGETS) and shared libraries (WINBIND_LTARGETS). echo $ac_n "checking whether to build winbind""... $ac_c" 1>&6 -echo "configure:13987: checking whether to build winbind" >&5 +echo "configure:14048: checking whether to build winbind" >&5 # Initially, the value of $host_os decides whether winbind is supported @@ -14079,20 +14140,20 @@ fi # [#include <pwd.h>]) echo $ac_n "checking whether struct passwd has pw_comment""... $ac_c" 1>&6 -echo "configure:14083: checking whether struct passwd has pw_comment" >&5 +echo "configure:14144: checking whether struct passwd has pw_comment" >&5 if eval "test \"`echo '$''{'samba_cv_passwd_pw_comment'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 14089 "configure" +#line 14150 "configure" #include "confdefs.h" #include <pwd.h> int main() { struct passwd p; p.pw_comment; ; return 0; } EOF -if { (eval echo configure:14096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_passwd_pw_comment=yes else @@ -14117,20 +14178,20 @@ fi # [#include <pwd.h>]) echo $ac_n "checking whether struct passwd has pw_age""... $ac_c" 1>&6 -echo "configure:14121: checking whether struct passwd has pw_age" >&5 +echo "configure:14182: checking whether struct passwd has pw_age" >&5 if eval "test \"`echo '$''{'samba_cv_passwd_pw_age'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 14127 "configure" +#line 14188 "configure" #include "confdefs.h" #include <pwd.h> int main() { struct passwd p; p.pw_age; ; return 0; } EOF -if { (eval echo configure:14134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_passwd_pw_age=yes else @@ -14169,7 +14230,7 @@ fi if test x"$INCLUDED_POPT" != x"yes"; then echo $ac_n "checking for poptGetContext in -lpopt""... $ac_c" 1>&6 -echo "configure:14173: checking for poptGetContext in -lpopt" >&5 +echo "configure:14234: checking for poptGetContext in -lpopt" >&5 ac_lib_var=`echo popt'_'poptGetContext | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -14177,7 +14238,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpopt $LIBS" cat > conftest.$ac_ext <<EOF -#line 14181 "configure" +#line 14242 "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 @@ -14188,7 +14249,7 @@ int main() { poptGetContext() ; return 0; } EOF -if { (eval echo configure:14192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14253: \"$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 @@ -14212,7 +14273,7 @@ fi fi echo $ac_n "checking whether to use included popt""... $ac_c" 1>&6 -echo "configure:14216: checking whether to use included popt" >&5 +echo "configure:14277: checking whether to use included popt" >&5 if test x"$INCLUDED_POPT" = x"yes"; then echo "$ac_t""yes" 1>&6 BUILD_POPT='$(POPT_OBJS)' @@ -14251,16 +14312,16 @@ fi # final configure stuff echo $ac_n "checking configure summary""... $ac_c" 1>&6 -echo "configure:14255: checking configure summary" >&5 +echo "configure:14316: checking configure summary" >&5 if test "$cross_compiling" = yes; then echo "configure: warning: cannot run when cross-compiling" 1>&2 else cat > conftest.$ac_ext <<EOF -#line 14260 "configure" +#line 14321 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/summary.c" EOF -if { (eval echo configure:14264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:14325: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 else diff --git a/source3/configure.in b/source3/configure.in index 8f3a06b0cd..5e742f9498 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -2672,7 +2672,7 @@ AC_ARG_WITH(sendfile-support, case "$host_os" in *linux*) - AC_CACHE_CHECK([for sendfile64 support],samba_cv_HAVE_SENDFILE64,[ + AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[ AC_TRY_LINK([#include <sys/sendfile.h>], [\ int tofd, fromfd; @@ -2682,7 +2682,7 @@ ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total); ], samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)]) - AC_CACHE_CHECK([for sendfile support],samba_cv_HAVE_SENDFILE,[ + AC_CACHE_CHECK([for linux sendfile support],samba_cv_HAVE_SENDFILE,[ AC_TRY_LINK([#include <sys/sendfile.h>], [\ int tofd, fromfd; @@ -2723,6 +2723,35 @@ samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)] fi ;; + *freebsd*) + AC_CACHE_CHECK([for freebsd sendfile support],samba_cv_HAVE_SENDFILE,[ + AC_TRY_LINK([\ +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/uio.h>], +[\ + int fromfd, tofd; + off_t offset, nwritten; + struct sf_hdtr hdr; + struct iovec hdtrl; + hdr->headers = &hdtrl; + hdr->hdr_cnt = 1; + hdr->trailers = NULL; + hdr->trl_cnt = 0; + hdtrl.iov_base = NULL; + hdtrl.iov_len = 0; + int ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0); +], +samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)]) + + if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then + AC_DEFINE(HAVE_SENDFILE) + AC_DEFINE(FREEBSD_SENDFILE_API) + AC_DEFINE(WITH_SENDFILE) + else + AC_MSG_RESULT(no); + fi + ;; *) ;; esac diff --git a/source3/include/config.h.in b/source3/include/config.h.in index 119df4dd5b..9fbde2bf37 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -293,6 +293,7 @@ #undef LINUX_SENDFILE_API #undef LINUX_BROKEN_SENDFILE_API #undef WITH_SENDFILE +#undef FREEBSD_SENDFILE_API /* The number of bytes in a int. */ #undef SIZEOF_INT |