Updating for 1.0.2 release
[awesomized/libmemcached] / m4 / socket_send_flags.m4
1 dnl Copyright (C) 2011 Trond Norbye
2 dnl This file is free software; Trond Norbye
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
5 dnl ---------------------------------------------------------------------------
6 dnl Macro: SOCKET_SEND_FLAGS
7 dnl ---------------------------------------------------------------------------
8
9 AC_DEFUN([SOCKET_SEND_FLAGS],
10 [
11 AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
12 AC_LANG_PUSH([C])
13 save_CFLAGS="$CFLAGS"
14 CFLAGS="$CFLAGS -I${srcdir}"
15 AC_TRY_LINK([
16 #include <sys/socket.h>
17 ], [
18 int flags= MSG_NOSIGNAL;
19 ],
20 [ ac_cv_msg_nosignal=yes ],
21 [ ac_cv_msg_nosignal=no ])
22 CFLAGS="$save_CFLAGS"
23 AC_LANG_POP
24 ])
25
26 AC_CACHE_CHECK([for MSG_DONTWAIT], [ac_cv_msg_dontwait], [
27 AC_LANG_PUSH([C])
28 save_CFLAGS="$CFLAGS"
29 CFLAGS="$CFLAGS -I${srcdir}"
30 AC_TRY_LINK([
31 #include <sys/socket.h>
32 ], [
33 int flags= MSG_DONTWAIT;
34 ],
35 [ ac_cv_msg_dontwait=yes ],
36 [ ac_cv_msg_dontwait=no ])
37 CFLAGS="$save_CFLAGS"
38 AC_LANG_POP
39 ])
40
41 AC_CACHE_CHECK([for MSG_MORE], [ac_cv_msg_more], [
42 AC_LANG_PUSH([C])
43 save_CFLAGS="$CFLAGS"
44 CFLAGS="$CFLAGS -I${srcdir}"
45 AC_TRY_LINK([
46 #include <sys/socket.h>
47 ], [
48 int flags= MSG_MORE;
49 ],
50 [ ac_cv_msg_more=yes ],
51 [ ac_cv_msg_more=no ])
52 CFLAGS="$save_CFLAGS"
53 AC_LANG_POP
54 ])
55
56 AS_IF([test "x$ac_cv_msg_nosignal" = "xyes"],[
57 AC_DEFINE(HAVE_MSG_NOSIGNAL, 1, [Define to 1 if you have a MSG_NOSIGNAL])])
58 AS_IF([test "x$ac_cv_msg_dontwait" = "xyes"],[
59 AC_DEFINE(HAVE_MSG_DONTWAIT, 1, [Define to 1 if you have a MSG_DONTWAIT])])
60 AS_IF([test "x$ac_cv_msg_more" = "xyes"],[
61 AC_DEFINE(HAVE_MSG_MORE, 1, [Define to 1 if you have a HAVE_MSG_MORE])])
62 ])
63
64 dnl ---------------------------------------------------------------------------
65 dnl End Macro: SOCKET_SEND_FLAGS
66 dnl ---------------------------------------------------------------------------