[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 41/156: configure: used better detection of some functio
From: |
gnunet |
Subject: |
[libmicrohttpd] 41/156: configure: used better detection of some functions when cross-compiling |
Date: |
Sun, 28 May 2023 17:51:34 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to tag v0.9.77
in repository libmicrohttpd.
commit e6f63b1c7ec4636e9632544fb58509f08b49c0a6
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Dec 23 16:38:13 2022 +0300
configure: used better detection of some functions when cross-compiling
---
configure.ac | 91 +++++++++++++++++++++----------------------------
src/microhttpd/daemon.c | 4 +--
2 files changed, 40 insertions(+), 55 deletions(-)
diff --git a/configure.ac b/configure.ac
index 1acd1a0c..3e4cbd7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1333,29 +1333,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
- ]],
- [
- struct sockaddr_storage ss;
- (void)getsockname(socket(0,0,0),(struct sockaddr *)&ss,(void*)0);
- ],
+MHD_CHECK_LINK_RUN([[for working getsockname()]],[[mhd_cv_getsockname_usable]],
+ [[mhd_cv_getsockname_usable='assuming yes']],
[
- 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
@@ -1436,18 +1418,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],
@@ -1644,18 +1618,25 @@ AC_INCLUDES_DEFAULT
], [[
int arr[2];
int res;
- res = pipe(arr)
+ res = pipe(arr);
+ if (res != 0) return 33;
+ close (arr[0]);
+ close (arr[1]);
]])
], [[mhd_cv_pipe_usable='yes']], [[mhd_cv_pipe_usable='no']])
])
- ])
- AS_VAR_IF([[mhd_cv_pipe_usable]], [["yes"]], [
- 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_LINK_IFELSE([
- AC_LANG_PROGRAM([
+ AS_VAR_IF([[mhd_cv_pipe_usable]], [["yes"]], [
+ use_itc='pipe'
+ enable_itc="$use_itc"
+ AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread
communication])
+ 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
#include <fcntl.h>
@@ -1663,17 +1644,21 @@ AC_INCLUDES_DEFAULT
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
- ], [[
- int arr[2];
- int res;
- res = pipe2(arr, O_CLOEXEC | O_NONBLOCK)
- ]])
- ], [[mhd_cv_pipe2_usable='yes']], [[mhd_cv_pipe2_usable='no']])
+ ], [[
+ 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]])])
])
- AS_VAR_IF([[mhd_cv_pipe2_usable]], [["yes"]],
- [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]])])
])
])
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index daacf692..e04418c4 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -6995,7 +6995,7 @@ MHD_start_daemon_va (unsigned int flags,
listen_fd = daemon->listen_fd;
}
-#ifdef HAVE_GETSOCKNAME
+#ifdef MHD_USE_GETSOCKNAME
if ( (0 == daemon->port) &&
(0 == (*pflags & MHD_USE_NO_LISTEN_SOCKET)) )
{ /* Get port number. */
@@ -7073,7 +7073,7 @@ MHD_start_daemon_va (unsigned int flags,
}
}
}
-#endif /* HAVE_GETSOCKNAME */
+#endif /* MHD_USE_GETSOCKNAME */
if (MHD_INVALID_SOCKET != listen_fd)
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] 37/156: testcurl: fixed checking response headers as null-terminated string, (continued)
- [libmicrohttpd] 37/156: testcurl: fixed checking response headers as null-terminated string, gnunet, 2023/05/28
- [libmicrohttpd] 34/156: daemon: fixed delayed notification callback in thread-per-connection mode, gnunet, 2023/05/28
- [libmicrohttpd] 38/156: test_upgrade{,_large}: fixed HTTP/1.1 compatibility, gnunet, 2023/05/28
- [libmicrohttpd] 42/156: configure: try to detect whether eventfd is enabled, gnunet, 2023/05/28
- [libmicrohttpd] 35/156: mhd_assert: use "DEBUG" macro defined by some toolchains, gnunet, 2023/05/28
- [libmicrohttpd] 33/156: mhd_str: fixed compiler warning for compact code, gnunet, 2023/05/28
- [libmicrohttpd] 26/156: Fixed very rare data races when closing upgraded connection, gnunet, 2023/05/28
- [libmicrohttpd] 30/156: configure: fixed underquoting, typos, wording, gnunet, 2023/05/28
- [libmicrohttpd] 32/156: configure: fixed typos in messages, gnunet, 2023/05/28
- [libmicrohttpd] 23/156: Fixed wrong variable type used for result of gnutls_priority_init(), gnunet, 2023/05/28
- [libmicrohttpd] 41/156: configure: used better detection of some functions when cross-compiling,
gnunet <=
- [libmicrohttpd] 27/156: test_http_reasons: fixed compiler warnings, gnunet, 2023/05/28
- [libmicrohttpd] 29/156: Remove double adding of MHD_HTTP_HEADER_CONNECTION response header, gnunet, 2023/05/28
- [libmicrohttpd] 31/156: connection: skip no-op calling of body generation functions when response body is not used, gnunet, 2023/05/28
- [libmicrohttpd] 43/156: -typo, gnunet, 2023/05/28
- [libmicrohttpd] 21/156: internal.h: fixed incorrect use of enum value as preprocessor value, gnunet, 2023/05/28
- [libmicrohttpd] 40/156: Added new M4 helper macro, gnunet, 2023/05/28
- [libmicrohttpd] 39/156: test_get_iovec: fixed missing include headers, gnunet, 2023/05/28
- [libmicrohttpd] 45/156: MHD_get_version_bin(): added new function, gnunet, 2023/05/28
- [libmicrohttpd] 44/156: add assertion to guard against bad behavior described in #7196, also document that after suspending one must return MHD_YES, gnunet, 2023/05/28
- [libmicrohttpd] 49/156: mhd_check_func.m4: fixed macro, gnunet, 2023/05/28