From 0e7ef37a5e4b69f31cd0319253dee303fa2b9575 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Wed, 1 Nov 2023 16:59:44 +0100 Subject: [PATCH] Detect getsockopt TCP_INFO on FreeBSD and get rid of unnecessary other check On FreeBSD one of the fields is slightly different, that's all it seems. This improves 099e99504f40d1be30fab2d82d81ad11fd18820d --- configure | 38 ++++++++------------------------------ configure.ac | 21 ++++++--------------- 2 files changed, 14 insertions(+), 45 deletions(-) diff --git a/configure b/configure index 4b5b35192..43d6e0a49 100755 --- a/configure +++ b/configure @@ -6330,6 +6330,8 @@ if test "$ac_cv_ip6" = "no"; then as_fn_error $? "Your system does not support IPv6" "$LINENO" 5 fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if you have getsockopt TCP_INFO" >&5 +printf %s "checking if you have getsockopt TCP_INFO... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6346,7 +6348,11 @@ main (void) struct tcp_info ti; ti.tcpi_rtt = 0; ti.tcpi_rttvar = 0; + #if defined(__FreeBSD__) + ti.__tcpi_pmtu = 0; + #else ti.tcpi_pmtu = 0; + #endif ti.tcpi_snd_cwnd = 0; ti.tcpi_snd_mss = 0; ti.tcpi_rcv_mss = 0; @@ -6361,38 +6367,10 @@ then : printf "%s\n" "#define HAVE_TCP_INFO 1" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if you have getsockopt TCP_INFO" >&5 -printf %s "checking if you have getsockopt TCP_INFO... " >&6; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -#include -#include " - -int foo(void); - - -int -main (void) -{ -foo() - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else $as_nop - ax_pthread_extra_flags= - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext diff --git a/configure.ac b/configure.ac index de9b024ae..af60de5a3 100644 --- a/configure.ac +++ b/configure.ac @@ -370,6 +370,7 @@ if test "$ac_cv_ip6" = "no"; then AC_MSG_ERROR([Your system does not support IPv6]) fi +AC_MSG_CHECKING([if you have getsockopt TCP_INFO]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include #include @@ -382,28 +383,18 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( struct tcp_info ti; ti.tcpi_rtt = 0; ti.tcpi_rttvar = 0; + #if defined(__FreeBSD__) + ti.__tcpi_pmtu = 0; + #else ti.tcpi_pmtu = 0; + #endif ti.tcpi_snd_cwnd = 0; ti.tcpi_snd_mss = 0; ti.tcpi_rcv_mss = 0; getsockopt(0, IPPROTO_TCP, TCP_INFO, &ti, &optlen); ]])], [AC_DEFINE(HAVE_TCP_INFO, 1, [Have getsockopt TCP_INFO]) - AC_MSG_CHECKING(if you have getsockopt TCP_INFO)],[]) - -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -#include -#include -#include -#include " - -int foo(void); - -],[foo()])], - [AC_MSG_RESULT([yes])], - [ax_pthread_extra_flags= - AC_MSG_RESULT([no])]) + AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)]) AC_CHECK_HEADER(sys/syslog.h, AC_DEFINE([SYSSYSLOGH], [], [Define if you have the header file.]))