aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-12-23 16:38:13 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-12-23 16:38:13 +0300
commit2efc013917d69a2fc60fbb3eb44fa21801fe0580 (patch)
treefbbebb117431156e2b3555eb8bcb019c32c9da25
parent84dfd52f13102cea21b2a932556fac49ed770cee (diff)
downloadlibmicrohttpd-2efc013917d69a2fc60fbb3eb44fa21801fe0580.tar.gz
libmicrohttpd-2efc013917d69a2fc60fbb3eb44fa21801fe0580.zip
configure: used better detection of some functions when cross-compiling
-rw-r--r--configure.ac79
1 files changed, 27 insertions, 52 deletions
diff --git a/configure.ac b/configure.ac
index b032badc..eb323051 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1750,29 +1750,11 @@ AC_CHECK_MEMBERS([struct sockaddr_in.sin_len, struct sockaddr_in6.sin6_len,
1750#endif 1750#endif
1751 ]) 1751 ])
1752 1752
1753MHD_CHECK_FUNC([getsockname], 1753MHD_CHECK_LINK_RUN([[for working getsockname()]],[[mhd_cv_getsockname_usable]],
1754 [[ 1754 [[mhd_cv_getsockname_usable='assuming yes']],
1755#ifdef HAVE_SYS_TYPES_H
1756#include <sys/types.h>
1757#endif
1758#ifdef HAVE_SYS_SOCKET_H
1759#include <sys/socket.h>
1760#endif
1761#ifdef HAVE_WINSOCK2_H
1762#include <winsock2.h>
1763#endif
1764 ]],
1765 [
1766 struct sockaddr_storage ss;
1767 (void)getsockname(socket(0,0,0),(struct sockaddr *)&ss,(void*)0);
1768 ],
1769 [ 1755 [
1770 AC_CACHE_CHECK([[whether getsockname() is usable]], [[mhd_cv_getsockname_usable]], 1756 AC_LANG_SOURCE(
1771 [ 1757 [[
1772 AC_RUN_IFELSE(
1773 [
1774 AC_LANG_SOURCE(
1775 [[
1776#ifdef HAVE_SYS_TYPES_H 1758#ifdef HAVE_SYS_TYPES_H
1777#include <sys/types.h> 1759#include <sys/types.h>
1778#endif 1760#endif
@@ -1853,18 +1835,10 @@ int main(void)
1853#endif 1835#endif
1854 return ret; 1836 return ret;
1855} 1837}
1856 ]] 1838 ]]
1857 ) 1839 )
1858 ], 1840 ],
1859 [[mhd_cv_getsockname_usable='yes']], 1841 [AC_DEFINE([[MHD_USE_GETSOCKNAME]], [[1]], [Define if you have usable `getsockname' function.])]
1860 [[mhd_cv_getsockname_usable='no']],
1861 [[mhd_cv_getsockname_usable='assuming yes']]
1862 )
1863 ]
1864 )
1865 AS_VAR_IF([[mhd_cv_getsockname_usable]], [["no"]], [:],
1866 [AC_DEFINE([[MHD_USE_GETSOCKNAME]], [[1]], [Define if you have usable `getsockname' function.])])
1867 ]
1868) 1842)
1869 1843
1870AC_CACHE_CHECK([for usable PAGESIZE macro], [mhd_cv_macro_pagesize_usable], 1844AC_CACHE_CHECK([for usable PAGESIZE macro], [mhd_cv_macro_pagesize_usable],
@@ -2074,8 +2048,13 @@ AC_INCLUDES_DEFAULT
2074 use_itc='pipe' 2048 use_itc='pipe'
2075 enable_itc="$use_itc" 2049 enable_itc="$use_itc"
2076 AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread communication]) 2050 AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread communication])
2077 AC_CACHE_CHECK([[whether pipe2(2) is usable]], [[mhd_cv_pipe2_usable]], [ 2051 MHD_CHECK_LINK_RUN([[whether pipe2(2) is usable]],[[mhd_cv_pipe2_usable]],
2078 AC_RUN_IFELSE([ 2052 [
2053 # Cross-compiling
2054 AS_CASE([${host_os}], [kfreebsd*-gnu], [[mhd_cv_pipe2_usable='assuming no']],
2055 [[mhd_cv_pipe2_usable='assuming yes']])
2056 ],
2057 [
2079 AC_LANG_PROGRAM([ 2058 AC_LANG_PROGRAM([
2080AC_INCLUDES_DEFAULT 2059AC_INCLUDES_DEFAULT
2081#ifdef HAVE_FCNTL_H 2060#ifdef HAVE_FCNTL_H
@@ -2084,22 +2063,18 @@ AC_INCLUDES_DEFAULT
2084#ifdef HAVE_UNISTD_H 2063#ifdef HAVE_UNISTD_H
2085#include <unistd.h> 2064#include <unistd.h>
2086#endif 2065#endif
2087 ], [[ 2066 ], [[
2088 int arr[2]; 2067 int arr[2];
2089 int res; 2068 int res;
2090 res = pipe2(arr, O_CLOEXEC | O_NONBLOCK); 2069 res = pipe2(arr, O_CLOEXEC | O_NONBLOCK);
2091 if (res != 0) return 33; 2070 if (res != 0) return 33;
2092 close (arr[0]); 2071 close (arr[0]);
2093 close (arr[1]); 2072 close (arr[1]);
2094 ]]) 2073 ]]
2095 ], [[mhd_cv_pipe2_usable='yes']], [[mhd_cv_pipe2_usable='no']], [ 2074 )
2096 # Cross-compiling 2075 ],
2097 AS_CASE([${host_os}], [kfreebsd*-gnu], [[mhd_cv_pipe2_usable='assuming no']], 2076 [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable pipe2(2) function])]
2098 [[mhd_cv_pipe2_usable='assuming yes']]) 2077 )
2099 ])
2100 ])
2101 AS_CASE([["X-${mhd_cv_pipe2_usable}"]], [[X*yes]],
2102 [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable pipe2(2) function])])
2103 ], [ 2078 ], [
2104 AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not usable, consider using other type of inter-thread communication]])]) 2079 AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not usable, consider using other type of inter-thread communication]])])
2105 ]) 2080 ])