aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-01-10 14:19:22 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-01-10 15:20:06 +0300
commitd70dd2136973e708a2afca102e89d57d5488c269 (patch)
treece8775ceeaeb2e5f938e028818def140516e5309
parent0a76e006e5ce9c15332e3733d825e4ee342f6dbe (diff)
downloadlibmicrohttpd-d70dd2136973e708a2afca102e89d57d5488c269.tar.gz
libmicrohttpd-d70dd2136973e708a2afca102e89d57d5488c269.zip
configure: minor fixes in ITC type detection
-rw-r--r--configure.ac49
1 files changed, 28 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac
index dbfa0bea..6f540a83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1599,7 +1599,7 @@ AS_CASE([[$enable_itc]],
1599 [[no]], [AC_MSG_ERROR([[inter-thread communication cannot be disabled]])], 1599 [[no]], [AC_MSG_ERROR([[inter-thread communication cannot be disabled]])],
1600 [AC_MSG_ERROR([[unrecognized type "$enable_itc" of inter-thread communication specified by "--enable-itc=$enable_itc"]])] 1600 [AC_MSG_ERROR([[unrecognized type "$enable_itc" of inter-thread communication specified by "--enable-itc=$enable_itc"]])]
1601) 1601)
1602# AS_UNSET([[use_itc]]) 1602AS_UNSET([[use_itc]])
1603 1603
1604AS_IF([[test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"]], [ 1604AS_IF([[test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"]], [
1605 AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [ 1605 AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [
@@ -1611,7 +1611,8 @@ AS_IF([[test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"]], [
1611#include <sys/eventfd.h> 1611#include <sys/eventfd.h>
1612 ]], [[ 1612 ]], [[
1613 int ef = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); 1613 int ef = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
1614 if (ef) return ef - 1; 1614 if (ef < 0) return 1;
1615 close (ef);
1615 ]]) 1616 ]])
1616 ], [[mhd_cv_eventfd_usable='yes']], [[mhd_cv_eventfd_usable='no']]) 1617 ], [[mhd_cv_eventfd_usable='yes']], [[mhd_cv_eventfd_usable='no']])
1617 ]) 1618 ])
@@ -1638,18 +1639,20 @@ AC_INCLUDES_DEFAULT
1638 ], [[ 1639 ], [[
1639 int arr[2]; 1640 int arr[2];
1640 int res; 1641 int res;
1641 res = pipe(arr) 1642 res = pipe(arr);
1643 if (res != 0) return 1;
1644 close (arr[0]);
1645 close (arr[1]);
1642 ]]) 1646 ]])
1643 ], [[mhd_cv_pipe_usable='yes']], [[mhd_cv_pipe_usable='no']]) 1647 ], [[mhd_cv_pipe_usable='yes']], [[mhd_cv_pipe_usable='no']])
1644 ]) 1648 ])
1645 ]) 1649 AS_VAR_IF([[mhd_cv_pipe_usable]], [["yes"]], [
1646 AS_VAR_IF([[mhd_cv_pipe_usable]], [["yes"]], [ 1650 use_itc='pipe'
1647 use_itc='pipe' 1651 enable_itc="$use_itc"
1648 enable_itc="$use_itc" 1652 AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread communication])
1649 AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread communication]) 1653 AC_CACHE_CHECK([[whether pipe2(2) is usable]], [[mhd_cv_pipe2_usable]], [
1650 AC_CACHE_CHECK([[whether pipe2(2) is usable]], [[mhd_cv_pipe2_usable]], [ 1654 AC_LINK_IFELSE([
1651 AC_LINK_IFELSE([ 1655 AC_LANG_PROGRAM([
1652 AC_LANG_PROGRAM([
1653AC_INCLUDES_DEFAULT 1656AC_INCLUDES_DEFAULT
1654#ifdef HAVE_FCNTL_H 1657#ifdef HAVE_FCNTL_H
1655#include <fcntl.h> 1658#include <fcntl.h>
@@ -1657,17 +1660,21 @@ AC_INCLUDES_DEFAULT
1657#ifdef HAVE_UNISTD_H 1660#ifdef HAVE_UNISTD_H
1658#include <unistd.h> 1661#include <unistd.h>
1659#endif 1662#endif
1660 ], [[ 1663 ], [[
1661 int arr[2]; 1664 int arr[2];
1662 int res; 1665 int res;
1663 res = pipe2(arr, O_CLOEXEC | O_NONBLOCK) 1666 res = pipe2(arr, O_CLOEXEC | O_NONBLOCK);
1664 ]]) 1667 if (res != 0) return 1;
1665 ], [[mhd_cv_pipe2_usable='yes']], [[mhd_cv_pipe2_usable='no']]) 1668 close (arr[0]);
1669 close (arr[1]);
1670 ]])
1671 ], [[mhd_cv_pipe2_usable='yes']], [[mhd_cv_pipe2_usable='no']])
1672 ])
1673 AS_VAR_IF([[mhd_cv_pipe2_usable]], [["yes"]],
1674 [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable pipe2(2) function])])
1675 ], [
1676 AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not usable, consider using other type of inter-thread communication]])])
1666 ]) 1677 ])
1667 AS_VAR_IF([[mhd_cv_pipe2_usable]], [["yes"]],
1668 [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable pipe2(2) function])])
1669 ], [
1670 AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not usable, consider using other type of inter-thread communication]])])
1671 ]) 1678 ])
1672]) 1679])
1673 1680