aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-08-02 12:37:08 +0000
committerLRN <lrn1986@gmail.com>2013-08-02 12:37:08 +0000
commita8f8a27bc027d4a0f565a6e4e579d64192f5b846 (patch)
tree19a7030923a38b1f766964dfa4da5133f663ec25
parent7056c9e811352498bba2765a4c47893906a2bc19 (diff)
downloadlibmicrohttpd-a8f8a27bc027d4a0f565a6e4e579d64192f5b846.tar.gz
libmicrohttpd-a8f8a27bc027d4a0f565a6e4e579d64192f5b846.zip
Fix compiling for systems without SOCK_NONBLOCK
-rw-r--r--configure.ac22
-rw-r--r--src/microhttpd/daemon.c4
2 files changed, 26 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 8f64f6c7..1f472830 100644
--- a/configure.ac
+++ b/configure.ac
@@ -232,6 +232,28 @@ AM_CONDITIONAL(USE_PRIVATE_PLIBC_H, test x$our_private_plibc_h = x1)
232AC_CHECK_FUNCS_ONCE(memmem) 232AC_CHECK_FUNCS_ONCE(memmem)
233AC_CHECK_FUNCS_ONCE(accept4) 233AC_CHECK_FUNCS_ONCE(accept4)
234 234
235AC_COMPILE_IFELSE(
236 [AC_LANG_PROGRAM(
237 [
238 #if defined HAVE_SYS_TYPES_H
239 # include <sys/types.h>
240 #endif
241 #if defined HAVE_SYS_SOCKET_H
242 # include <sys/socket.h>
243 #elif defined HAVE_WINSOCK2_H
244 # include <winsock2.h>
245 #endif],
246 [
247 #ifndef SOCK_NONBLOCK
248 # error do not have SOCK_NONBLOCK
249 #endif
250 ])
251 ],
252 [
253 AC_DEFINE([HAVE_SOCK_NONBLOCK], [1], [SOCK_NONBLOCK is defined in a socket header])
254 ])
255
256
235AC_SEARCH_LIBS([clock_gettime], [rt], [ 257AC_SEARCH_LIBS([clock_gettime], [rt], [
236 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Have clock_gettime]) 258 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Have clock_gettime])
237]) 259])
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 52b73e8a..a6a93e77 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1329,7 +1329,11 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
1329 memset (addr, 0, sizeof (addrstorage)); 1329 memset (addr, 0, sizeof (addrstorage));
1330 if (-1 == (fd = daemon->socket_fd)) 1330 if (-1 == (fd = daemon->socket_fd))
1331 return MHD_NO; 1331 return MHD_NO;
1332#ifdef HAVE_SOCK_NONBLOCK
1332 nonblock = SOCK_NONBLOCK; 1333 nonblock = SOCK_NONBLOCK;
1334#else
1335 nonblock = 0;
1336#endif
1333#ifdef CYGWIN 1337#ifdef CYGWIN
1334 if (0 == (daemon->options & MHD_USE_SSL)) 1338 if (0 == (daemon->options & MHD_USE_SSL))
1335 nonblock = 0; 1339 nonblock = 0;