~clint-fewbar/gearmand/fix-const-libmemcached-gcc47

« back to all changes in this revision

Viewing changes to m4/check_sock_cloexec.m4

  • Committer: Brian Aker
  • Date: 2012-09-11 10:54:30 UTC
  • Revision ID: brian@tangent.org-20120911105430-ywcru6rqx5vzj75k
Update AX_CHECK_SOCK_CLOEXEC macro.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl CHECK_SOCK_CLOEXEC([action-if-found], [action-if-not-found])
2
 
AC_DEFUN([AX_CHECK_SOCK_CLOEXEC], [{
3
 
    AC_MSG_CHECKING(whether SOCK_CLOEXEC is supported)
4
 
    AC_LANG_SOURCE
5
 
    AC_RUN_IFELSE([AC_LANG_SOURCE([
6
 
/* SOCK_CLOEXEC test */
 
1
# Author?
 
2
# AX_CHECK_SOCK_CLOEXEC([action-if-found], [action-if-not-found])
 
3
#
 
4
 
 
5
#serial 1
 
6
 
 
7
AC_DEFUN([AX_CHECK_SOCK_CLOEXEC], [
 
8
    AC_CACHE_CHECK([whether SOCK_CLOEXEC is supported], [ax_cv_sock_cloexec], [
 
9
      AC_LANG_PUSH([C])
 
10
      AC_RUN_IFELSE([
 
11
        AC_LANG_PROGRAM([
 
12
 
 
13
          /* SOCK_CLOEXEC test */
7
14
#include <sys/types.h>
8
15
#include <sys/socket.h>
9
16
 
10
 
int main (int argc, char **argv)
11
 
{
12
 
    int s= socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
13
 
    return (s == -1);
14
 
}
15
 
    ])],
16
 
    [AC_MSG_RESULT(yes) ; ax_cv_sock_cloexec="yes" ; $1],
17
 
    [AC_MSG_RESULT(no)  ; ax_cv_sock_cloexec="no"  ; $2],
18
 
    [AC_MSG_RESULT(not during cross-compile) ; ax_cv_sock_cloexec="no"]
19
 
    )
20
 
}])
 
17
          ], [
 
18
          int s= socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
 
19
          return (s == -1);
 
20
          ])],
 
21
        [ax_cv_sock_cloexec=yes],
 
22
        [ax_cv_sock_cloexec=no])
 
23
      ])
 
24
 
 
25
    AS_IF([test x"ax_cv_sock_cloexec" = xyes], [AC_MSG_RESULT([yes]) ; $1], AC_MSG_RESULT([no]) ; $2)
 
26
    ])