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