Github user fr0stbyte commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/427#discussion_r156860284 --- Diff: src/c/configure.ac --- @@ -130,18 +130,66 @@ main() else exit(0); } -], AC_MSG_RESULT(yes) - ipv6=yes, - AC_MSG_RESULT(no) - ipv6=no, - AC_MSG_RESULT(no) +], AC_MSG_RESULT(yes) + ipv6=yes, + AC_MSG_RESULT(no) + ipv6=no, + AC_MSG_RESULT(no) ipv6=no) if test x"$ipv6" = xyes; then USEIPV6="-DZOO_IPV6_ENABLED" AC_SUBST(USEIPV6) fi +# use SOCK_CLOEXEC if available and wanted +AC_ARG_WITH([sock_cloexec], +[AS_HELP_STRING([--with-sock-cloexec],[build with SOCK_CLOEXEC flag set on the connections])], +[],[with_sock_cloexec=no]) + +AC_MSG_CHECKING([whether SOCK_CLOEXEC is available]) + +AC_TRY_RUN([ /* is SOCK_CLOEXEC available ? */ +#include <sys/types.h> +#include <sys/socket.h> +#include <stdlib.h> +main() +{ +#ifdef SOCK_CLOEXEC + exit(0); +#else + exit(1); +#endif +} +], AC_MSG_RESULT(yes) + has_sock_cloexec=yes, + AC_MSG_RESULT(no) + has_sock_cloexec=no, + AC_MSG_RESULT(no) + has_sock_cloexec=no) + +if test "x$with_sock_cloexec" != xno && test "x$has_sock_cloexec" = xno; then + AC_MSG_WARN([cannot use SOCK_CLOEXEC -- SOCK_CLOEXEC undefined on this platform]) + with_sock_cloexec=no +fi + +if test "x$with_sock_cloexec" != xno; then +AC_MSG_NOTICE([building with SOCK_CLOEXEC]) +else +AC_MSG_NOTICE([building without SOCK_CLOEXEC]) +fi + +AS_IF([test x"$with_sock_cloexec" != xno], [AC_DEFINE([SOCK_CLOEXEC_ENABLED], [1], [Define to 1, if SOCK_CLOEXEC is defined and wanted])]) +AM_CONDITIONAL([SOCK_CLOEXEC_ENABLED],[test "x$with_sock_cloexec" != xno]) + +# Determine which libraries we need to use clock_gettime --- End diff -- @phunt I think it was : https://github.com/apache/zookeeper/pull/410/files#diff-79599273360e5b5ede514927c8033356R182
---