From 0bbe184f1fa5add861f40b7fad022835dd54675e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 5 Oct 2003 08:35:55 +0000 Subject: improved the non-block check a lot: * several tests ALWAYS failed due to bad test programs * the IoctlSocket() test now is linked on test as it could otherwise compile fine on many systems that doesn't support it * added a test for the BeOS way of doing non-blocking sockets (based on a patch from Shard) --- acinclude.m4 | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 78d9052f9..d2156d350 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -47,7 +47,8 @@ dnl the code was bad, try a different program now, test 2 #include #include ],[ -/* FIONBIO source test */ +/* FIONBIO source test (old-style unix) */ + int socket; int flags = ioctl(socket, FIONBIO, &flags); ],[ dnl FIONBIO test was good @@ -62,28 +63,49 @@ dnl the code was bad, try a different program now, test 3 #include ],[ /* ioctlsocket source code */ + int socket; int flags = ioctlsocket(socket, FIONBIO, &flags); ],[ dnl ioctlsocket test was good nonblock="ioctlsocket" AC_DEFINE(HAVE_IOCTLSOCKET, 1, [use ioctlsocket() for non-blocking sockets]) ],[ -dnl ioctlsocket didnt compile! +dnl ioctlsocket didnt compile!, go to test 4 - AC_TRY_COMPILE([ + AC_TRY_LINK([ /* headers for IoctlSocket test (Amiga?) */ #include ],[ /* IoctlSocket source code */ + int socket; int flags = IoctlSocket(socket, FIONBIO, (long)1); ],[ dnl ioctlsocket test was good nonblock="IoctlSocket" AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, [use Ioctlsocket() for non-blocking sockets]) ],[ -dnl ioctlsocket didnt compile! +dnl Ioctlsocket didnt compile, do test 5! + AC_TRY_COMPILE([ +/* headers for SO_NONBLOCK test (BeOS) */ +#include +#include +#include +],[ +/* SO_NONBLOCK source code */ + long b = 1; + int socket; + int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b)); +],[ +dnl the SO_NONBLOCK test was good +nonblock="SO_NONBLOCK" +AC_DEFINE(HAVE_SO_NONBLOCK, 1, [use SO_NONBLOCK for non-blocking sockets]) +],[ +dnl test 5 didnt compile! nonblock="nada" AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1, [disabled non-blocking sockets]) +]) +dnl end of fifth test + ]) dnl end of forth test -- cgit v1.2.3