diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 66 |
1 files changed, 42 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac index eb323051..e224cd88 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1998,32 +1998,50 @@ AS_CASE([[$enable_itc]], | |||
1998 | ) | 1998 | ) |
1999 | AS_UNSET([[use_itc]]) | 1999 | AS_UNSET([[use_itc]]) |
2000 | 2000 | ||
2001 | AS_IF([[test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"]], [ | 2001 | AS_IF([[test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"]], |
2002 | AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [ | 2002 | [ |
2003 | AC_CHECK_HEADERS([sys/eventfd.h], [], [], [AC_INCLUDES_DEFAULT]) | 2003 | MHD_CHECK_LINK_RUN([[for working eventfd(2)]],[[mhd_cv_eventfd_usable]],[[mhd_cv_eventfd_usable='assuming no']], |
2004 | AS_VAR_IF([[ac_cv_header_sys_eventfd_h]], [["yes"]], [ | 2004 | [ |
2005 | AC_CACHE_CHECK([whether eventfd(2) is usable], [[mhd_cv_eventfd_usable]], [ | 2005 | AC_LANG_SOURCE([[ |
2006 | AC_LINK_IFELSE([ | ||
2007 | AC_LANG_PROGRAM([[ | ||
2008 | #include <sys/eventfd.h> | 2006 | #include <sys/eventfd.h> |
2009 | #include <unistd.h> | 2007 | #include <unistd.h> |
2010 | ]], [[ | 2008 | |
2011 | int ef = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); | 2009 | int main(void) |
2012 | if (ef < 0) return 1; | 2010 | { |
2013 | close (ef); | 2011 | unsigned char buf[8]; |
2014 | ]]) | 2012 | int ret; |
2015 | ], [[mhd_cv_eventfd_usable='yes']], [[mhd_cv_eventfd_usable='no']]) | 2013 | int efd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); |
2016 | ]) | 2014 | if (0 > efd) |
2017 | ]) | 2015 | return 2; |
2018 | ]) | 2016 | ret = 0; |
2019 | AS_VAR_IF([[mhd_cv_eventfd_usable]], [["yes"]], [ | 2017 | buf[3] = 1; |
2020 | use_itc='eventfd' | 2018 | if (8 != write(efd, buf, 8)) |
2021 | enable_itc="$use_itc" | 2019 | ret = 3; |
2022 | AC_DEFINE([[_MHD_ITC_EVENTFD]], [[1]], [Define to use eventFD for inter-thread communication]) | 2020 | else |
2023 | ], [ | 2021 | { |
2024 | AS_VAR_IF([[enable_itc]], [["eventfd"]], [AC_MSG_ERROR([[eventfd(2) is not usable, consider using other type of inter-thread communication]])]) | 2022 | if (8 != read(efd, buf, 8)) |
2025 | ]) | 2023 | ret = 4; |
2026 | ]) | 2024 | } |
2025 | close(efd); | ||
2026 | return ret; | ||
2027 | } | ||
2028 | ]] | ||
2029 | ) | ||
2030 | ], | ||
2031 | [ | ||
2032 | use_itc='eventfd' | ||
2033 | enable_itc="$use_itc" | ||
2034 | AC_DEFINE([[_MHD_ITC_EVENTFD]], [[1]], [Define to use eventFD for inter-thread communication]) | ||
2035 | ], | ||
2036 | [ | ||
2037 | AS_VAR_IF([[enable_itc]], [["eventfd"]], [AC_MSG_ERROR([[eventfd(2) is not usable, consider using other type of inter-thread communication]])]) | ||
2038 | ] | ||
2039 | ) | ||
2040 | AS_VAR_IF([mhd_cv_eventfd_usable],["assuming no"], | ||
2041 | [AC_MSG_WARN([if you have 'eventfd' support enabled on your target system consider overriding test result by "mhd_cv_eventfd_usable=yes" configure parameter])] | ||
2042 | ) | ||
2043 | ] | ||
2044 | ) | ||
2027 | 2045 | ||
2028 | AS_IF([[test "x$enable_itc" = "xpipe" || test "x$enable_itc" = "xauto"]], [ | 2046 | AS_IF([[test "x$enable_itc" = "xpipe" || test "x$enable_itc" = "xauto"]], [ |
2029 | AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [ | 2047 | AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [ |