1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-04 13:13:13 +02:00

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 099e99504f
This commit is contained in:
Bram Matthys
2023-11-01 16:59:44 +01:00
parent 7468018a7d
commit 0e7ef37a5e
2 changed files with 14 additions and 45 deletions
Vendored
+8 -30
View File
@@ -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 <sys/types.h>
@@ -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 <sys/types.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>"
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
+6 -15
View File
@@ -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 <sys/types.h>
#include <stdlib.h>
@@ -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 <sys/types.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>"
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 <sys/syslog.h> header file.]))