aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-10-05 08:35:55 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-10-05 08:35:55 +0000
commit0bbe184f1fa5add861f40b7fad022835dd54675e (patch)
tree29df93e50a3183c3996af15ee039d7be9a3cfaec
parent1b0af1c53a1da1b12d9cd21f2f8aac8ca9f08630 (diff)
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)
-rw-r--r--acinclude.m430
1 files 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 <unistd.h>
#include <stropts.h>
],[
-/* FIONBIO source test */
+/* FIONBIO source test (old-style unix) */
+ int socket;
int flags = ioctl(socket, FIONBIO, &flags);
],[
dnl FIONBIO test was good
@@ -62,29 +63,50 @@ dnl the code was bad, try a different program now, test 3
#include <windows.h>
],[
/* 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 <sys/ioctl.h>
],[
/* 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 <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+],[
+/* 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
])