aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2023-05-22 19:24:43 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2023-06-01 11:31:48 +0300
commit97dec411ebb29ff1ffb0f89e54be6c4d022db822 (patch)
tree94cd31f27d00ce418558d359a13246127c62e599
parentdd4f6ff9eae62310dab578f55e116a42abc787ea (diff)
downloadlibmicrohttpd-97dec411ebb29ff1ffb0f89e54be6c4d022db822.tar.gz
libmicrohttpd-97dec411ebb29ff1ffb0f89e54be6c4d022db822.zip
Detect sysctl() symbols in configure
Symbols could be enum values, not necessary macros
-rw-r--r--configure.ac46
-rw-r--r--src/microhttpd/test_client_put_stop.c14
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]], [[
2643#ifdef HAVE_SYS_SYSCTL_H 2643#ifdef HAVE_SYS_SYSCTL_H
2644#include <sys/sysctl.h> 2644#include <sys/sysctl.h>
2645#endif 2645#endif
2646#ifdef HAVE_STDDEF_H 2646#if defined(HAVE_STDDEF_H)
2647#include <stddef.h> 2647#include <stddef.h>
2648#elif defined(HAVE_STDLIB_H)
2649#include <stdlib.h>
2648#endif 2650#endif
2649 ]], [[int mib[2] = {CTL_KERN, KERN_MAXPROC}; i][f (sysctl(mib, 2, NULL, NULL, NULL, 0)) return 1;]] 2651 ]], [[
2652 int mib[2] = {0, 0}; /* Avoid any platform-specific values */
2653 i][f (sysctl(mib, 2, NULL, NULL, NULL, 0)) return 1;
2654 ]],
2655 [
2656 AC_CHECK_DECLS([CTL_NET,PF_INET,IPPROTO_ICMP,ICMPCTL_ICMPLIM],[],[],
2657 [[
2658#ifdef HAVE_SYS_TYPES_H
2659#include <sys/types.h>
2660#endif /* HAVE_SYS_TYPES_H */
2661#ifdef HAVE_SYS_SYSCTL_H
2662#include <sys/sysctl.h>
2663#endif /* HAVE_SYS_SYSCTL_H */
2664#ifdef HAVE_SYS_SYSCTL_H
2665#include <sys/sysctl.h>
2666#endif /* HAVE_SYS_SYSCTL_H */
2667#ifdef HAVE_SYS_SOCKET_H
2668#include <sys/socket.h>
2669#endif /* HAVE_SYS_SOCKET_H */
2670#ifdef HAVE_NETINET_IN_SYSTM_H
2671#include <netinet/in_systm.h>
2672#endif /* HAVE_NETINET_IN_SYSTM_H */
2673#ifdef HAVE_NETINET_IN_H
2674#include <netinet/in.h>
2675#endif /* HAVE_NETINET_IN_H */
2676#ifdef HAVE_NETINET_IP_H
2677#include <netinet/ip.h>
2678#endif /* HAVE_NETINET_IP_H */
2679#ifdef HAVE_NETINET_IP_ICMP_H
2680#include <netinet/ip_icmp.h>
2681#endif /* HAVE_NETINET_IP_ICMP_H */
2682#ifdef HAVE_NETINET_ICMP_VAR_H
2683#include <netinet/icmp_var.h>
2684#endif /* HAVE_NETINET_ICMP_VAR_H */
2685 ]]
2686 )
2687 ]
2650) 2688)
2651 2689
2652MHD_CHECK_FUNC([[sysctlbyname]], [[ 2690MHD_CHECK_FUNC([[sysctlbyname]], [[
@@ -2656,8 +2694,10 @@ MHD_CHECK_FUNC([[sysctlbyname]], [[
2656#ifdef HAVE_SYS_SYSCTL_H 2694#ifdef HAVE_SYS_SYSCTL_H
2657#include <sys/sysctl.h> 2695#include <sys/sysctl.h>
2658#endif 2696#endif
2659#ifdef HAVE_STDDEF_H 2697#if defined(HAVE_STDDEF_H)
2660#include <stddef.h> 2698#include <stddef.h>
2699#elif defined(HAVE_STDLIB_H)
2700#include <stdlib.h>
2661#endif 2701#endif
2662 ]], [[sysctlbyname("test", NULL, NULL, NULL, 0);]] 2702 ]], [[sysctlbyname("test", NULL, NULL, NULL, 0);]]
2663) 2703)
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)
305 } 305 }
306 } 306 }
307#endif 307#endif
308#if defined(HAVE_SYSCTL) && defined(CTL_NET) && defined(PF_INET) && \ 308#if defined(HAVE_SYSCTL) && defined(HAVE_DECL_CTL_NET) && \
309 defined(IPPROTO_ICMP) && defined(ICMPCTL_ICMPLIM) 309 defined(HAVE_DECL_PF_INET) && defined(HAVE_DECL_IPPROTO_ICMP) && \
310 defined(HAVE_DECL_ICMPCTL_ICMPLIM)
311 /* Macros may have zero values */
312#if HAVE_DECL_CTL_NET && HAVE_DECL_PF_INET && HAVE_DECL_IPPROTO_ICMP && \
313 HAVE_DECL_ICMPCTL_ICMPLIM
310 if (1) 314 if (1)
311 { 315 {
312 int mib[4]; 316 int mib[4];
@@ -366,8 +370,10 @@ test_global_init (void)
366#endif /* _MHD_HEAVY_TESTS */ 370#endif /* _MHD_HEAVY_TESTS */
367 } 371 }
368 } 372 }
369#endif /* HAVE_SYSCTL && CTL_NET && PF_INET && 373#endif /* HAVE_DECL_CTL_NET && HAVE_DECL_PF_INET && HAVE_DECL_IPPROTO_ICMP && \
370 IPPROTO_ICMP && ICMPCTL_ICMPLIM */ 374 HAVE_DECL_ICMPCTL_ICMPLIM */
375#endif /* HAVE_SYSCTL && HAVE_DECL_CTL_NET && HAVE_DECL_PF_INET &&
376 HAVE_DECL_IPPROTO_ICMP && HAVE_DECL_ICMPCTL_ICMPLIM */
371 } 377 }
372 if (MHD_YES != MHD_is_feature_supported (MHD_FEATURE_AUTOSUPPRESS_SIGPIPE)) 378 if (MHD_YES != MHD_is_feature_supported (MHD_FEATURE_AUTOSUPPRESS_SIGPIPE))
373 { 379 {