mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
configure: used better detection of some functions when cross-compiling
This commit is contained in:
+27
-52
@@ -1750,29 +1750,11 @@ AC_CHECK_MEMBERS([struct sockaddr_in.sin_len, struct sockaddr_in6.sin6_len,
|
||||
#endif
|
||||
])
|
||||
|
||||
MHD_CHECK_FUNC([getsockname],
|
||||
[[
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
]],
|
||||
MHD_CHECK_LINK_RUN([[for working getsockname()]],[[mhd_cv_getsockname_usable]],
|
||||
[[mhd_cv_getsockname_usable='assuming yes']],
|
||||
[
|
||||
struct sockaddr_storage ss;
|
||||
(void)getsockname(socket(0,0,0),(struct sockaddr *)&ss,(void*)0);
|
||||
],
|
||||
[
|
||||
AC_CACHE_CHECK([[whether getsockname() is usable]], [[mhd_cv_getsockname_usable]],
|
||||
[
|
||||
AC_RUN_IFELSE(
|
||||
[
|
||||
AC_LANG_SOURCE(
|
||||
[[
|
||||
AC_LANG_SOURCE(
|
||||
[[
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
@@ -1853,18 +1835,10 @@ int main(void)
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
]]
|
||||
)
|
||||
],
|
||||
[[mhd_cv_getsockname_usable='yes']],
|
||||
[[mhd_cv_getsockname_usable='no']],
|
||||
[[mhd_cv_getsockname_usable='assuming yes']]
|
||||
)
|
||||
]
|
||||
)
|
||||
AS_VAR_IF([[mhd_cv_getsockname_usable]], [["no"]], [:],
|
||||
[AC_DEFINE([[MHD_USE_GETSOCKNAME]], [[1]], [Define if you have usable `getsockname' function.])])
|
||||
]
|
||||
]]
|
||||
)
|
||||
],
|
||||
[AC_DEFINE([[MHD_USE_GETSOCKNAME]], [[1]], [Define if you have usable `getsockname' function.])]
|
||||
)
|
||||
|
||||
AC_CACHE_CHECK([for usable PAGESIZE macro], [mhd_cv_macro_pagesize_usable],
|
||||
@@ -2074,8 +2048,13 @@ AC_INCLUDES_DEFAULT
|
||||
use_itc='pipe'
|
||||
enable_itc="$use_itc"
|
||||
AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread communication])
|
||||
AC_CACHE_CHECK([[whether pipe2(2) is usable]], [[mhd_cv_pipe2_usable]], [
|
||||
AC_RUN_IFELSE([
|
||||
MHD_CHECK_LINK_RUN([[whether pipe2(2) is usable]],[[mhd_cv_pipe2_usable]],
|
||||
[
|
||||
# Cross-compiling
|
||||
AS_CASE([${host_os}], [kfreebsd*-gnu], [[mhd_cv_pipe2_usable='assuming no']],
|
||||
[[mhd_cv_pipe2_usable='assuming yes']])
|
||||
],
|
||||
[
|
||||
AC_LANG_PROGRAM([
|
||||
AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_FCNTL_H
|
||||
@@ -2084,22 +2063,18 @@ AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
], [[
|
||||
int arr[2];
|
||||
int res;
|
||||
res = pipe2(arr, O_CLOEXEC | O_NONBLOCK);
|
||||
if (res != 0) return 33;
|
||||
close (arr[0]);
|
||||
close (arr[1]);
|
||||
]])
|
||||
], [[mhd_cv_pipe2_usable='yes']], [[mhd_cv_pipe2_usable='no']], [
|
||||
# Cross-compiling
|
||||
AS_CASE([${host_os}], [kfreebsd*-gnu], [[mhd_cv_pipe2_usable='assuming no']],
|
||||
[[mhd_cv_pipe2_usable='assuming yes']])
|
||||
])
|
||||
])
|
||||
AS_CASE([["X-${mhd_cv_pipe2_usable}"]], [[X*yes]],
|
||||
[AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable pipe2(2) function])])
|
||||
], [[
|
||||
int arr[2];
|
||||
int res;
|
||||
res = pipe2(arr, O_CLOEXEC | O_NONBLOCK);
|
||||
if (res != 0) return 33;
|
||||
close (arr[0]);
|
||||
close (arr[1]);
|
||||
]]
|
||||
)
|
||||
],
|
||||
[AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable pipe2(2) function])]
|
||||
)
|
||||
], [
|
||||
AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not usable, consider using other type of inter-thread communication]])])
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user