[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 25/36: Detect sysctl() symbols in configure
From: |
gnunet |
Subject: |
[libmicrohttpd] 25/36: Detect sysctl() symbols in configure |
Date: |
Thu, 01 Jun 2023 12:30:30 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 97dec411ebb29ff1ffb0f89e54be6c4d022db822
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon May 22 19:24:43 2023 +0300
Detect sysctl() symbols in configure
Symbols could be enum values, not necessary macros
---
configure.ac | 46 ++++++++++++++++++++++++++++++++---
src/microhttpd/test_client_put_stop.c | 14 ++++++++---
2 files changed, 53 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6b4a0378..44ac85c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2643,10 +2643,48 @@ MHD_CHECK_FUNC([[sysctl]], [[
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#endif
-#ifdef HAVE_STDDEF_H
+#if defined(HAVE_STDDEF_H)
#include <stddef.h>
+#elif defined(HAVE_STDLIB_H)
+#include <stdlib.h>
#endif
- ]], [[int mib[2] = {CTL_KERN, KERN_MAXPROC}; i][f (sysctl(mib, 2, NULL,
NULL, NULL, 0)) return 1;]]
+ ]], [[
+ int mib[2] = {0, 0}; /* Avoid any platform-specific values */
+ i][f (sysctl(mib, 2, NULL, NULL, NULL, 0)) return 1;
+ ]],
+ [
+ AC_CHECK_DECLS([CTL_NET,PF_INET,IPPROTO_ICMP,ICMPCTL_ICMPLIM],[],[],
+ [[
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif /* HAVE_SYS_SYSCTL_H */
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif /* HAVE_SYS_SYSCTL_H */
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif /* HAVE_SYS_SOCKET_H */
+#ifdef HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif /* HAVE_NETINET_IN_SYSTM_H */
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif /* HAVE_NETINET_IN_H */
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif /* HAVE_NETINET_IP_H */
+#ifdef HAVE_NETINET_IP_ICMP_H
+#include <netinet/ip_icmp.h>
+#endif /* HAVE_NETINET_IP_ICMP_H */
+#ifdef HAVE_NETINET_ICMP_VAR_H
+#include <netinet/icmp_var.h>
+#endif /* HAVE_NETINET_ICMP_VAR_H */
+ ]]
+ )
+ ]
)
MHD_CHECK_FUNC([[sysctlbyname]], [[
@@ -2656,8 +2694,10 @@ MHD_CHECK_FUNC([[sysctlbyname]], [[
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#endif
-#ifdef HAVE_STDDEF_H
+#if defined(HAVE_STDDEF_H)
#include <stddef.h>
+#elif defined(HAVE_STDLIB_H)
+#include <stdlib.h>
#endif
]], [[sysctlbyname("test", NULL, NULL, NULL, 0);]]
)
diff --git a/src/microhttpd/test_client_put_stop.c
b/src/microhttpd/test_client_put_stop.c
index cda8f1d1..3785599d 100644
--- a/src/microhttpd/test_client_put_stop.c
+++ b/src/microhttpd/test_client_put_stop.c
@@ -305,8 +305,12 @@ test_global_init (void)
}
}
#endif
-#if defined(HAVE_SYSCTL) && defined(CTL_NET) && defined(PF_INET) && \
- defined(IPPROTO_ICMP) && defined(ICMPCTL_ICMPLIM)
+#if defined(HAVE_SYSCTL) && defined(HAVE_DECL_CTL_NET) && \
+ defined(HAVE_DECL_PF_INET) && defined(HAVE_DECL_IPPROTO_ICMP) && \
+ defined(HAVE_DECL_ICMPCTL_ICMPLIM)
+ /* Macros may have zero values */
+#if HAVE_DECL_CTL_NET && HAVE_DECL_PF_INET && HAVE_DECL_IPPROTO_ICMP && \
+ HAVE_DECL_ICMPCTL_ICMPLIM
if (1)
{
int mib[4];
@@ -366,8 +370,10 @@ test_global_init (void)
#endif /* _MHD_HEAVY_TESTS */
}
}
-#endif /* HAVE_SYSCTL && CTL_NET && PF_INET &&
- IPPROTO_ICMP && ICMPCTL_ICMPLIM */
+#endif /* HAVE_DECL_CTL_NET && HAVE_DECL_PF_INET && HAVE_DECL_IPPROTO_ICMP && \
+ HAVE_DECL_ICMPCTL_ICMPLIM */
+#endif /* HAVE_SYSCTL && HAVE_DECL_CTL_NET && HAVE_DECL_PF_INET &&
+ HAVE_DECL_IPPROTO_ICMP && HAVE_DECL_ICMPCTL_ICMPLIM */
}
if (MHD_YES != MHD_is_feature_supported (MHD_FEATURE_AUTOSUPPRESS_SIGPIPE))
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] 07/36: configure: renamed macro, (continued)
- [libmicrohttpd] 07/36: configure: renamed macro, gnunet, 2023/06/01
- [libmicrohttpd] 11/36: test_client_put_stop: fixed typo in comment, gnunet, 2023/06/01
- [libmicrohttpd] 17/36: examples/sessions.c: removed non-portable function and improved safety, gnunet, 2023/06/01
- [libmicrohttpd] 18/36: configure: fixed detection of __FUNCTION__ magic macro, gnunet, 2023/06/01
- [libmicrohttpd] 06/36: test_toolarge: fixed reported error description, gnunet, 2023/06/01
- [libmicrohttpd] 13/36: test_timeout: moved to heavy tests, gnunet, 2023/06/01
- [libmicrohttpd] 16/36: test_post: fixed caseless key name match, gnunet, 2023/06/01
- [libmicrohttpd] 19/36: Simplified usage of the function name magic macros, gnunet, 2023/06/01
- [libmicrohttpd] 23/36: .gitignore: force include all *.{c,h} files, gnunet, 2023/06/01
- [libmicrohttpd] 26/36: test_client_put_stop: fixed typo in diag message, gnunet, 2023/06/01
- [libmicrohttpd] 25/36: Detect sysctl() symbols in configure,
gnunet <=
- [libmicrohttpd] 28/36: contrib/make-dist.sh: added use of zopfli if available, gnunet, 2023/06/01
- [libmicrohttpd] 29/36: daemon.c: redesigned code for clarity and formatting, gnunet, 2023/06/01
- [libmicrohttpd] 35/36: autoinit_funcs.h: fixed warning on MSVC, gnunet, 2023/06/01
- [libmicrohttpd] 27/36: Added support for custom command for tarball compression, gnunet, 2023/06/01
- [libmicrohttpd] 15/36: examples/largepost.c: fixed caseless method match, gnunet, 2023/06/01
- [libmicrohttpd] 20/36: tests: unified use of function name macros, gnunet, 2023/06/01
- [libmicrohttpd] 21/36: Added internal preprocessor macro for magic macro presence, gnunet, 2023/06/01
- [libmicrohttpd] 30/36: Fixed compiler warning when built without poll() support, gnunet, 2023/06/01
- [libmicrohttpd] 31/36: Avoided potential compiler warnings, gnunet, 2023/06/01
- [libmicrohttpd] 32/36: Added macro for base64 decoded size, gnunet, 2023/06/01