| 1 |
AC_DEFUN([ACX_PTHREAD], [ |
|---|
| 2 |
AC_REQUIRE([AC_CANONICAL_HOST]) |
|---|
| 3 |
AC_LANG_SAVE |
|---|
| 4 |
AC_LANG_C |
|---|
| 5 |
acx_pthread_ok=no |
|---|
| 6 |
|
|---|
| 7 |
# We used to check for pthread.h first, but this fails if pthread.h |
|---|
| 8 |
# requires special compiler flags (e.g. on True64 or Sequent). |
|---|
| 9 |
# It gets checked for in the link test anyway. |
|---|
| 10 |
|
|---|
| 11 |
# First of all, check if the user has set any of the PTHREAD_LIBS, |
|---|
| 12 |
# etcetera environment variables, and if threads linking works using |
|---|
| 13 |
# them: |
|---|
| 14 |
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then |
|---|
| 15 |
save_CFLAGS="$CFLAGS" |
|---|
| 16 |
CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
|---|
| 17 |
save_LIBS="$LIBS" |
|---|
| 18 |
LIBS="$PTHREAD_LIBS $LIBS" |
|---|
| 19 |
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) |
|---|
| 20 |
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) |
|---|
| 21 |
AC_MSG_RESULT($acx_pthread_ok) |
|---|
| 22 |
if test x"$acx_pthread_ok" = xno; then |
|---|
| 23 |
PTHREAD_LIBS="" |
|---|
| 24 |
PTHREAD_CFLAGS="" |
|---|
| 25 |
fi |
|---|
| 26 |
LIBS="$save_LIBS" |
|---|
| 27 |
CFLAGS="$save_CFLAGS" |
|---|
| 28 |
fi |
|---|
| 29 |
|
|---|
| 30 |
# We must check for the threads library under a number of different |
|---|
| 31 |
# names; the ordering is very important because some systems |
|---|
| 32 |
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the |
|---|
| 33 |
# libraries is broken (non-POSIX). |
|---|
| 34 |
|
|---|
| 35 |
# Create a list of thread flags to try. Items starting with a "-" are |
|---|
| 36 |
# C compiler flags, and other items are library names, except for "none" |
|---|
| 37 |
# which indicates that we try without any flags at all. |
|---|
| 38 |
|
|---|
| 39 |
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" |
|---|
| 40 |
|
|---|
| 41 |
# The ordering *is* (sometimes) important. Some notes on the |
|---|
| 42 |
# individual items follow: |
|---|
| 43 |
|
|---|
| 44 |
# pthreads: AIX (must check this before -lpthread) |
|---|
| 45 |
# none: in case threads are in libc; should be tried before -Kthread and |
|---|
| 46 |
# other compiler flags to prevent continual compiler warnings |
|---|
| 47 |
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) |
|---|
| 48 |
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) |
|---|
| 49 |
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) |
|---|
| 50 |
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) |
|---|
| 51 |
# -pthreads: Solaris/gcc |
|---|
| 52 |
# -mthreads: Mingw32/gcc, Lynx/gcc |
|---|
| 53 |
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it |
|---|
| 54 |
# doesn't hurt to check since this sometimes defines pthreads too; |
|---|
| 55 |
# also defines -D_REENTRANT) |
|---|
| 56 |
# pthread: Linux, etcetera |
|---|
| 57 |
# --thread-safe: KAI C++ |
|---|
| 58 |
|
|---|
| 59 |
case "${host_cpu}-${host_os}" in |
|---|
| 60 |
*solaris*) |
|---|
| 61 |
|
|---|
| 62 |
# On Solaris (at least, for some versions), libc contains stubbed |
|---|
| 63 |
# (non-functional) versions of the pthreads routines, so link-based |
|---|
| 64 |
# tests will erroneously succeed. (We need to link with -pthread or |
|---|
| 65 |
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather |
|---|
| 66 |
# a function called by this macro, so we could check for that, but |
|---|
| 67 |
# who knows whether they'll stub that too in a future libc.) So, |
|---|
| 68 |
# we'll just look for -pthreads and -lpthread first: |
|---|
| 69 |
|
|---|
| 70 |
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" |
|---|
| 71 |
;; |
|---|
| 72 |
esac |
|---|
| 73 |
|
|---|
| 74 |
if test x"$acx_pthread_ok" = xno; then |
|---|
| 75 |
for flag in $acx_pthread_flags; do |
|---|
| 76 |
|
|---|
| 77 |
case $flag in |
|---|
| 78 |
none) |
|---|
| 79 |
AC_MSG_CHECKING([whether pthreads work without any flags]) |
|---|
| 80 |
;; |
|---|
| 81 |
|
|---|
| 82 |
-*) |
|---|
| 83 |
AC_MSG_CHECKING([whether pthreads work with $flag]) |
|---|
| 84 |
PTHREAD_CFLAGS="$flag" |
|---|
| 85 |
;; |
|---|
| 86 |
|
|---|
| 87 |
*) |
|---|
| 88 |
AC_MSG_CHECKING([for the pthreads library -l$flag]) |
|---|
| 89 |
PTHREAD_LIBS="-l$flag" |
|---|
| 90 |
;; |
|---|
| 91 |
esac |
|---|
| 92 |
|
|---|
| 93 |
save_LIBS="$LIBS" |
|---|
| 94 |
save_CFLAGS="$CFLAGS" |
|---|
| 95 |
LIBS="$PTHREAD_LIBS $LIBS" |
|---|
| 96 |
CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
|---|
| 97 |
|
|---|
| 98 |
# Check for various functions. We must include pthread.h, |
|---|
| 99 |
# since some functions may be macros. (On the Sequent, we |
|---|
| 100 |
# need a special flag -Kthread to make this header compile.) |
|---|
| 101 |
# We check for pthread_join because it is in -lpthread on IRIX |
|---|
| 102 |
# while pthread_create is in libc. We check for pthread_attr_init |
|---|
| 103 |
# due to DEC craziness with -lpthreads. We check for |
|---|
| 104 |
# pthread_cleanup_push because it is one of the few pthread |
|---|
| 105 |
# functions on Solaris that doesn't have a non-functional libc stub. |
|---|
| 106 |
# We try pthread_create on general principles. |
|---|
| 107 |
AC_TRY_LINK([#include <pthread.h>], |
|---|
| 108 |
[pthread_t th; pthread_join(th, 0); |
|---|
| 109 |
pthread_attr_init(0); pthread_cleanup_push(0, 0); |
|---|
| 110 |
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], |
|---|
| 111 |
[acx_pthread_ok=yes]) |
|---|
| 112 |
|
|---|
| 113 |
LIBS="$save_LIBS" |
|---|
| 114 |
CFLAGS="$save_CFLAGS" |
|---|
| 115 |
|
|---|
| 116 |
AC_MSG_RESULT($acx_pthread_ok) |
|---|
| 117 |
if test "x$acx_pthread_ok" = xyes; then |
|---|
| 118 |
break; |
|---|
| 119 |
fi |
|---|
| 120 |
|
|---|
| 121 |
PTHREAD_LIBS="" |
|---|
| 122 |
PTHREAD_CFLAGS="" |
|---|
| 123 |
done |
|---|
| 124 |
fi |
|---|
| 125 |
|
|---|
| 126 |
# Various other checks: |
|---|
| 127 |
if test "x$acx_pthread_ok" = xyes; then |
|---|
| 128 |
save_LIBS="$LIBS" |
|---|
| 129 |
LIBS="$PTHREAD_LIBS $LIBS" |
|---|
| 130 |
save_CFLAGS="$CFLAGS" |
|---|
| 131 |
CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
|---|
| 132 |
|
|---|
| 133 |
# Detect AIX lossage: threads are created detached by default |
|---|
| 134 |
# and the JOINABLE attribute has a nonstandard name (UNDETACHED). |
|---|
| 135 |
AC_MSG_CHECKING([for joinable pthread attribute]) |
|---|
| 136 |
AC_TRY_LINK([#include <pthread.h>], |
|---|
| 137 |
[int attr=PTHREAD_CREATE_JOINABLE;], |
|---|
| 138 |
ok=PTHREAD_CREATE_JOINABLE, ok=unknown) |
|---|
| 139 |
if test x"$ok" = xunknown; then |
|---|
| 140 |
AC_TRY_LINK([#include <pthread.h>], |
|---|
| 141 |
[int attr=PTHREAD_CREATE_UNDETACHED;], |
|---|
| 142 |
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) |
|---|
| 143 |
fi |
|---|
| 144 |
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then |
|---|
| 145 |
AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, |
|---|
| 146 |
[Define to the necessary symbol if this constant |
|---|
| 147 |
uses a non-standard name on your system.]) |
|---|
| 148 |
fi |
|---|
| 149 |
AC_MSG_RESULT(${ok}) |
|---|
| 150 |
if test x"$ok" = xunknown; then |
|---|
| 151 |
AC_MSG_WARN([we do not know how to create joinable pthreads]) |
|---|
| 152 |
fi |
|---|
| 153 |
|
|---|
| 154 |
AC_MSG_CHECKING([if more special flags are required for pthreads]) |
|---|
| 155 |
flag=no |
|---|
| 156 |
case "${host_cpu}-${host_os}" in |
|---|
| 157 |
*-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; |
|---|
| 158 |
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; |
|---|
| 159 |
esac |
|---|
| 160 |
AC_MSG_RESULT(${flag}) |
|---|
| 161 |
if test "x$flag" != xno; then |
|---|
| 162 |
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" |
|---|
| 163 |
fi |
|---|
| 164 |
|
|---|
| 165 |
LIBS="$save_LIBS" |
|---|
| 166 |
CFLAGS="$save_CFLAGS" |
|---|
| 167 |
|
|---|
| 168 |
# More AIX lossage: must compile with cc_r |
|---|
| 169 |
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) |
|---|
| 170 |
else |
|---|
| 171 |
PTHREAD_CC="$CC" |
|---|
| 172 |
fi |
|---|
| 173 |
|
|---|
| 174 |
AC_SUBST(PTHREAD_LIBS) |
|---|
| 175 |
AC_SUBST(PTHREAD_CFLAGS) |
|---|
| 176 |
AC_SUBST(PTHREAD_CC) |
|---|
| 177 |
|
|---|
| 178 |
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: |
|---|
| 179 |
if test x"$acx_pthread_ok" = xyes; then |
|---|
| 180 |
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) |
|---|
| 181 |
: |
|---|
| 182 |
else |
|---|
| 183 |
acx_pthread_ok=no |
|---|
| 184 |
$2 |
|---|
| 185 |
fi |
|---|
| 186 |
AC_LANG_RESTORE |
|---|
| 187 |
])dnl ACX_PTHREAD |
|---|
| 188 |
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 |
AC_DEFUN([SAMBA_SENDFILE], [ |
|---|
| 193 |
|
|---|
| 194 |
################################################# |
|---|
| 195 |
# check for sendfile support |
|---|
| 196 |
|
|---|
| 197 |
with_sendfile_support=yes |
|---|
| 198 |
AC_MSG_CHECKING(whether to check to support sendfile) |
|---|
| 199 |
AC_ARG_WITH(sendfile-support, |
|---|
| 200 |
[ --with-sendfile-support Check for sendfile support (default=yes)], |
|---|
| 201 |
[ case "$withval" in |
|---|
| 202 |
yes) |
|---|
| 203 |
|
|---|
| 204 |
AC_MSG_RESULT(yes); |
|---|
| 205 |
|
|---|
| 206 |
case "$host_os" in |
|---|
| 207 |
*linux*) |
|---|
| 208 |
AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[ |
|---|
| 209 |
AC_TRY_LINK([#include <sys/sendfile.h>], |
|---|
| 210 |
[\ |
|---|
| 211 |
int tofd, fromfd; |
|---|
| 212 |
off64_t offset; |
|---|
| 213 |
size_t total; |
|---|
| 214 |
ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total); |
|---|
| 215 |
], |
|---|
| 216 |
samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)]) |
|---|
| 217 |
|
|---|
| 218 |
AC_CACHE_CHECK([for linux sendfile support],samba_cv_HAVE_SENDFILE,[ |
|---|
| 219 |
AC_TRY_LINK([#include <sys/sendfile.h>], |
|---|
| 220 |
[\ |
|---|
| 221 |
int tofd, fromfd; |
|---|
| 222 |
off_t offset; |
|---|
| 223 |
size_t total; |
|---|
| 224 |
ssize_t nwritten = sendfile(tofd, fromfd, &offset, total); |
|---|
| 225 |
], |
|---|
| 226 |
samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)]) |
|---|
| 227 |
|
|---|
| 228 |
# Try and cope with broken Linux sendfile.... |
|---|
| 229 |
AC_CACHE_CHECK([for broken linux sendfile support],samba_cv_HAVE_BROKEN_LINUX_SENDFILE,[ |
|---|
| 230 |
AC_TRY_LINK([\ |
|---|
| 231 |
#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64) |
|---|
| 232 |
#undef _FILE_OFFSET_BITS |
|---|
| 233 |
#endif |
|---|
| 234 |
#include <sys/sendfile.h>], |
|---|
| 235 |
[\ |
|---|
| 236 |
int tofd, fromfd; |
|---|
| 237 |
off_t offset; |
|---|
| 238 |
size_t total; |
|---|
| 239 |
ssize_t nwritten = sendfile(tofd, fromfd, &offset, total); |
|---|
| 240 |
], |
|---|
| 241 |
samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)]) |
|---|
| 242 |
|
|---|
| 243 |
if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then |
|---|
| 244 |
AC_DEFINE(HAVE_SENDFILE64,1,[Whether 64-bit sendfile() is available]) |
|---|
| 245 |
AC_DEFINE(LINUX_SENDFILE_API,1,[Whether linux sendfile() API is available]) |
|---|
| 246 |
AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used]) |
|---|
| 247 |
elif test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then |
|---|
| 248 |
AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available]) |
|---|
| 249 |
AC_DEFINE(LINUX_SENDFILE_API,1,[Whether linux sendfile() API is available]) |
|---|
| 250 |
AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() should be used]) |
|---|
| 251 |
elif test x"$samba_cv_HAVE_BROKEN_LINUX_SENDFILE" = x"yes"; then |
|---|
| 252 |
AC_DEFINE(LINUX_BROKEN_SENDFILE_API,1,[Whether (linux) sendfile() is broken]) |
|---|
| 253 |
AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile should be used]) |
|---|
| 254 |
else |
|---|
| 255 |
AC_MSG_RESULT(no); |
|---|
| 256 |
fi |
|---|
| 257 |
|
|---|
| 258 |
;; |
|---|
| 259 |
*freebsd*) |
|---|
| 260 |
AC_CACHE_CHECK([for freebsd sendfile support],samba_cv_HAVE_SENDFILE,[ |
|---|
| 261 |
AC_TRY_LINK([\ |
|---|
| 262 |
#include <sys/types.h> |
|---|
| 263 |
#include <unistd.h> |
|---|
| 264 |
#include <sys/socket.h> |
|---|
| 265 |
#include <sys/uio.h>], |
|---|
| 266 |
[\ |
|---|
| 267 |
int fromfd, tofd, ret, total=0; |
|---|
| 268 |
off_t offset, nwritten; |
|---|
| 269 |
struct sf_hdtr hdr; |
|---|
| 270 |
struct iovec hdtrl; |
|---|
| 271 |
hdr.headers = &hdtrl; |
|---|
| 272 |
hdr.hdr_cnt = 1; |
|---|
| 273 |
hdr.trailers = NULL; |
|---|
| 274 |
hdr.trl_cnt = 0; |
|---|
| 275 |
hdtrl.iov_base = NULL; |
|---|
| 276 |
hdtrl.iov_len = 0; |
|---|
| 277 |
ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0); |
|---|
| 278 |
], |
|---|
| 279 |
samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)]) |
|---|
| 280 |
|
|---|
| 281 |
if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then |
|---|
| 282 |
AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() support is available]) |
|---|
| 283 |
AC_DEFINE(FREEBSD_SENDFILE_API,1,[Whether the FreeBSD sendfile() API is available]) |
|---|
| 284 |
AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included]) |
|---|
| 285 |
else |
|---|
| 286 |
AC_MSG_RESULT(no); |
|---|
| 287 |
fi |
|---|
| 288 |
;; |
|---|
| 289 |
|
|---|
| 290 |
*hpux*) |
|---|
| 291 |
AC_CACHE_CHECK([for hpux sendfile64 support],samba_cv_HAVE_SENDFILE64,[ |
|---|
| 292 |
AC_TRY_LINK([\ |
|---|
| 293 |
#include <sys/socket.h> |
|---|
| 294 |
#include <sys/uio.h>], |
|---|
| 295 |
[\ |
|---|
| 296 |
int fromfd, tofd; |
|---|
| 297 |
size_t total=0; |
|---|
| 298 |
struct iovec hdtrl[2]; |
|---|
| 299 |
ssize_t nwritten; |
|---|
| 300 |
off64_t offset; |
|---|
| 301 |
|
|---|
| 302 |
hdtrl[0].iov_base = 0; |
|---|
| 303 |
hdtrl[0].iov_len = 0; |
|---|
| 304 |
|
|---|
| 305 |
nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0); |
|---|
| 306 |
], |
|---|
| 307 |
samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)]) |
|---|
| 308 |
if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then |
|---|
| 309 |
AC_DEFINE(HAVE_SENDFILE64,1,[Whether sendfile64() is available]) |
|---|
| 310 |
AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available]) |
|---|
| 311 |
AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included]) |
|---|
| 312 |
else |
|---|
| 313 |
AC_MSG_RESULT(no); |
|---|
| 314 |
fi |
|---|
| 315 |
|
|---|
| 316 |
AC_CACHE_CHECK([for hpux sendfile support],samba_cv_HAVE_SENDFILE,[ |
|---|
| 317 |
AC_TRY_LINK([\ |
|---|
| 318 |
#include <sys/socket.h> |
|---|
| 319 |
#include <sys/uio.h>], |
|---|
| 320 |
[\ |
|---|
| 321 |
int fromfd, tofd; |
|---|
| 322 |
size_t total=0; |
|---|
| 323 |
struct iovec hdtrl[2]; |
|---|
| 324 |
ssize_t nwritten; |
|---|
| 325 |
off_t offset; |
|---|
| 326 |
|
|---|
| 327 |
hdtrl[0].iov_base = 0; |
|---|
| 328 |
hdtrl[0].iov_len = 0; |
|---|
| 329 |
|
|---|
| 330 |
nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0); |
|---|
| 331 |
], |
|---|
| 332 |
samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)]) |
|---|
| 333 |
if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then |
|---|
| 334 |
AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available]) |
|---|
| 335 |
AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available]) |
|---|
| 336 |
AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included]) |
|---|
| 337 |
else |
|---|
| 338 |
AC_MSG_RESULT(no); |
|---|
| 339 |
fi |
|---|
| 340 |
;; |
|---|
| 341 |
|
|---|
| 342 |
*solaris*) |
|---|
| 343 |
AC_CHECK_LIB(sendfile,sendfilev) |
|---|
| 344 |
AC_CACHE_CHECK([for solaris sendfilev64 support],samba_cv_HAVE_SENDFILEV64,[ |
|---|
| 345 |
AC_TRY_LINK([\ |
|---|
| 346 |
#include <sys/sendfile.h>], |
|---|
| 347 |
[\ |
|---|
| 348 |
int sfvcnt; |
|---|
| 349 |
size_t xferred; |
|---|
| 350 |
struct sendfilevec vec[2]; |
|---|
| 351 |
ssize_t nwritten; |
|---|
| 352 |
int tofd; |
|---|
| 353 |
|
|---|
| 354 |
sfvcnt = 2; |
|---|
| 355 |
|
|---|
| 356 |
vec[0].sfv_fd = SFV_FD_SELF; |
|---|
| 357 |
vec[0].sfv_flag = 0; |
|---|
| 358 |
vec[0].sfv_off = 0; |
|---|
| 359 |
vec[0].sfv_len = 0; |
|---|
| 360 |
|
|---|
| 361 |
vec[1].sfv_fd = 0; |
|---|
| 362 |
vec[1].sfv_flag = 0; |
|---|
| 363 |
vec[1].sfv_off = 0; |
|---|
| 364 |
vec[1].sfv_len = 0; |
|---|
| 365 |
nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred); |
|---|
| 366 |
], |
|---|
| 367 |
samba_cv_HAVE_SENDFILEV64=yes,samba_cv_HAVE_SENDFILEV64=no)]) |
|---|
| 368 |
|
|---|
| 369 |
if test x"$samba_cv_HAVE_SENDFILEV64" = x"yes"; then |
|---|
| 370 |
AC_DEFINE(HAVE_SENDFILEV64,1,[Whether sendfilev64() is available]) |
|---|
| 371 |
AC_DEFINE(SOLARIS_SENDFILE_API,1,[Whether the soloris sendfile() API is available]) |
|---|
| 372 |
AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included]) |
|---|
| 373 |
else |
|---|
| 374 |
AC_MSG_RESULT(no); |
|---|
| 375 |
fi |
|---|
| 376 |
|
|---|
| 377 |
AC_CACHE_CHECK([for solaris sendfilev support],samba_cv_HAVE_SENDFILEV,[ |
|---|
| 378 |
AC_TRY_LINK([\ |
|---|
| 379 |
#include <sys/sendfile.h>], |
|---|
| 380 |
[\ |
|---|
| 381 |
int sfvcnt; |
|---|
| 382 |
size_t xferred; |
|---|
| 383 |
struct sendfilevec vec[2]; |
|---|
| 384 |
ssize_t nwritten; |
|---|
| 385 |
int tofd; |
|---|
| 386 |
|
|---|
| 387 |
sfvcnt = 2; |
|---|
| 388 |
|
|---|
| 389 |
vec[0].sfv_fd = SFV_FD_SELF; |
|---|
| 390 |
vec[0].sfv_flag = 0; |
|---|
| 391 |
vec[0].sfv_off = 0; |
|---|
| 392 |
vec[0].sfv_len = 0; |
|---|
| 393 |
|
|---|
| 394 |
vec[1].sfv_fd = 0; |
|---|
| 395 |
vec[1].sfv_flag = 0; |
|---|
| 396 |
vec[1].sfv_off = 0; |
|---|
| 397 |
vec[1].sfv_len = 0; |
|---|
| 398 |
nwritten = sendfilev(tofd, vec, sfvcnt, &xferred); |
|---|
| 399 |
], |
|---|
| 400 |
samba_cv_HAVE_SENDFILEV=yes,samba_cv_HAVE_SENDFILEV=no)]) |
|---|
| 401 |
|
|---|
| 402 |
if test x"$samba_cv_HAVE_SENDFILEV" = x"yes"; then |
|---|
| 403 |
AC_DEFINE(HAVE_SENDFILEV,1,[Whether sendfilev() is available]) |
|---|
| 404 |
AC_DEFINE(SOLARIS_SENDFILE_API,1,[Whether the solaris sendfile() API is available]) |
|---|
| 405 |
AC_DEFINE(WITH_SENDFILE,1,[Whether to include sendfile() support]) |
|---|
| 406 |
else |
|---|
| 407 |
AC_MSG_RESULT(no); |
|---|
| 408 |
fi |
|---|
| 409 |
;; |
|---|
| 410 |
|
|---|
| 411 |
*) |
|---|
| 412 |
;; |
|---|
| 413 |
esac |
|---|
| 414 |
;; |
|---|
| 415 |
*) |
|---|
| 416 |
AC_MSG_RESULT(no) |
|---|
| 417 |
;; |
|---|
| 418 |
esac ], |
|---|
| 419 |
AC_MSG_RESULT(yes) |
|---|
| 420 |
) |
|---|
| 421 |
|
|---|
| 422 |
]) |
|---|
| 423 |
|
|---|
| 424 |
|
|---|
| 425 |
|
|---|
| 426 |
|
|---|
| 427 |
AC_DEFUN([HYDRA_TCP_CORK], [ |
|---|
| 428 |
|
|---|
| 429 |
AC_MSG_CHECKING([whether TCP_CORK is a valid TCP socket option]) |
|---|
| 430 |
AC_TRY_COMPILE( |
|---|
| 431 |
#include <sys/socket.h> |
|---|
| 432 |
#include <netinet/tcp.h> |
|---|
| 433 |
#include <netinet/in.h> |
|---|
| 434 |
,[ |
|---|
| 435 |
int one = 1, fd; |
|---|
| 436 |
if (setsockopt(fd, IPPROTO_TCP, TCP_CORK, |
|---|
| 437 |
(void *) &one, sizeof (one)) == -1) |
|---|
| 438 |
return -1; |
|---|
| 439 |
return 0; |
|---|
| 440 |
|
|---|
| 441 |
], |
|---|
| 442 |
dnl *** FOUND |
|---|
| 443 |
AC_DEFINE( HAVE_TCP_CORK, 1, [TCP_CORK was found and will be used]) |
|---|
| 444 |
AC_MSG_RESULT(yes), |
|---|
| 445 |
dnl *** NOT FOUND |
|---|
| 446 |
AC_MSG_RESULT(no) |
|---|
| 447 |
) |
|---|
| 448 |
|
|---|
| 449 |
]) |
|---|