X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=m4%2Fcheck_sock_cloexec.m4;h=8dcd14f54e7e3a0bbe6b3c9d3dc0d9d07e50929e;hb=641b3d37fe96eadfea520035cc1703328163e357;hp=305877454643d261f6fa14e89c97567fa4ca6454;hpb=d4758957f0b472a5f247004862fef55f58edcc8f;p=awesomized%2Flibmemcached diff --git a/m4/check_sock_cloexec.m4 b/m4/check_sock_cloexec.m4 index 30587745..8dcd14f5 100644 --- a/m4/check_sock_cloexec.m4 +++ b/m4/check_sock_cloexec.m4 @@ -1,18 +1,27 @@ -dnl CHECK_SOCK_CLOEXEC([action-if-found], [action-if-not-found]) -AC_DEFUN([AX_CHECK_SOCK_CLOEXEC], [{ - AC_MSG_CHECKING(whether SOCK_CLOEXEC is supported) - AC_TRY_RUN([/* SOCK_CLOEXEC test */ +# Author? +# AX_CHECK_SOCK_CLOEXEC([action-if-found], [action-if-not-found]) +# + +#serial 2 + +AC_DEFUN([AX_CHECK_SOCK_CLOEXEC], [ + AC_CACHE_CHECK([whether SOCK_CLOEXEC is supported], [ax_cv_sock_cloexec], [ + AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([ + + /* SOCK_CLOEXEC test */ #include #include -int main (int argc, char *argv []) -{ - int s= socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); - return (s == -1); -} - ], - [AC_MSG_RESULT(yes) ; ax_cv_sock_cloexec="yes" ; $1], - [AC_MSG_RESULT(no) ; ax_cv_sock_cloexec="no" ; $2], - [AC_MSG_RESULT(not during cross-compile) ; ax_cv_sock_cloexec="no"] - ) -}]) + ], [ + int s= socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); + return (s == -1); + ])], + [ax_cv_sock_cloexec=yes], + [ax_cv_sock_cloexec=no], + [AC_MSG_WARN([test program execution failed])]) + ]) + + AS_IF([test x"ax_cv_sock_cloexec" = xyes], [AC_MSG_RESULT([yes]) ; $1], AC_MSG_RESULT([no]) ; $2) + ])