diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-01-10 14:42:16 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-01-10 15:20:31 +0300 |
commit | f8d5c77fa7b88b73fce2a2049b5d7f0e7755e301 (patch) | |
tree | 3868c3fc852ceb435397cc3682d8f65a8d959c3b | |
parent | d70dd2136973e708a2afca102e89d57d5488c269 (diff) | |
download | libmicrohttpd-f8d5c77fa7b88b73fce2a2049b5d7f0e7755e301.tar.gz libmicrohttpd-f8d5c77fa7b88b73fce2a2049b5d7f0e7755e301.zip |
configure: detect unimplemented pipe2() on GNU/kFreeBSD
-rw-r--r-- | configure.ac | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 6f540a83..5a6400bb 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -430,6 +430,11 @@ AS_CASE(["$host_os"], | |||
430 | CFLAGS_ac="-no-cpp-precomp -fno-common $CFLAGS_ac" | 430 | CFLAGS_ac="-no-cpp-precomp -fno-common $CFLAGS_ac" |
431 | mhd_host_os='Darwin' | 431 | mhd_host_os='Darwin' |
432 | AC_MSG_RESULT([[$mhd_host_os]])], | 432 | AC_MSG_RESULT([[$mhd_host_os]])], |
433 | [kfreebsd*-gnu], | ||
434 | [AC_DEFINE([SOMEBSD],[1],[This is a BSD system]) | ||
435 | AC_DEFINE_UNQUOTED([FREEBSD],[1],[This is a FreeBSD system]) | ||
436 | mhd_host_os='FreeBSD kernel with GNU userland' | ||
437 | AC_MSG_RESULT([[$mhd_host_os]])], | ||
433 | [freebsd*], | 438 | [freebsd*], |
434 | [AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) | 439 | [AC_DEFINE_UNQUOTED(SOMEBSD,1,[This is a BSD system]) |
435 | AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system]) | 440 | AC_DEFINE_UNQUOTED(FREEBSD,1,[This is a FreeBSD system]) |
@@ -1640,7 +1645,7 @@ AC_INCLUDES_DEFAULT | |||
1640 | int arr[2]; | 1645 | int arr[2]; |
1641 | int res; | 1646 | int res; |
1642 | res = pipe(arr); | 1647 | res = pipe(arr); |
1643 | if (res != 0) return 1; | 1648 | if (res != 0) return 33; |
1644 | close (arr[0]); | 1649 | close (arr[0]); |
1645 | close (arr[1]); | 1650 | close (arr[1]); |
1646 | ]]) | 1651 | ]]) |
@@ -1651,7 +1656,7 @@ AC_INCLUDES_DEFAULT | |||
1651 | enable_itc="$use_itc" | 1656 | enable_itc="$use_itc" |
1652 | AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread communication]) | 1657 | 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]], [ | 1658 | AC_CACHE_CHECK([[whether pipe2(2) is usable]], [[mhd_cv_pipe2_usable]], [ |
1654 | AC_LINK_IFELSE([ | 1659 | AC_RUN_IFELSE([ |
1655 | AC_LANG_PROGRAM([ | 1660 | AC_LANG_PROGRAM([ |
1656 | AC_INCLUDES_DEFAULT | 1661 | AC_INCLUDES_DEFAULT |
1657 | #ifdef HAVE_FCNTL_H | 1662 | #ifdef HAVE_FCNTL_H |
@@ -1664,13 +1669,17 @@ AC_INCLUDES_DEFAULT | |||
1664 | int arr[2]; | 1669 | int arr[2]; |
1665 | int res; | 1670 | int res; |
1666 | res = pipe2(arr, O_CLOEXEC | O_NONBLOCK); | 1671 | res = pipe2(arr, O_CLOEXEC | O_NONBLOCK); |
1667 | if (res != 0) return 1; | 1672 | if (res != 0) return 33; |
1668 | close (arr[0]); | 1673 | close (arr[0]); |
1669 | close (arr[1]); | 1674 | close (arr[1]); |
1670 | ]]) | 1675 | ]]) |
1671 | ], [[mhd_cv_pipe2_usable='yes']], [[mhd_cv_pipe2_usable='no']]) | 1676 | ], [[mhd_cv_pipe2_usable='yes']], [[mhd_cv_pipe2_usable='no']], [ |
1677 | # Cross-compiling | ||
1678 | AS_CASE([${host_os}], [kfreebsd*-gnu], [[mhd_cv_pipe2_usable='assuming no']], | ||
1679 | [[mhd_cv_pipe2_usable='assuming yes']]) | ||
1680 | ]) | ||
1672 | ]) | 1681 | ]) |
1673 | AS_VAR_IF([[mhd_cv_pipe2_usable]], [["yes"]], | 1682 | AS_CASE([["X-${mhd_cv_pipe2_usable}"]], [[X*yes]], |
1674 | [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable pipe2(2) function])]) | 1683 | [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable pipe2(2) function])]) |
1675 | ], [ | 1684 | ], [ |
1676 | AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not usable, consider using other type of inter-thread communication]])]) | 1685 | AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not usable, consider using other type of inter-thread communication]])]) |