Allow disabling auto-detect of SCTP (#1008)

* feat: Add a mechanism to disable checks for SCTP (--without-sctp).

The use case for this is building a static iperf3 binary on CentOS 7,
on a system with SCTP installed (but it has no static SCTP libraries).
In that case we need to disable SCTP detection to prevent a linking
error at runtime.

While here, s/iperf /iperf3 / in a couple of help strings.
This commit is contained in:
Bruce A. Mah 2020-05-28 10:10:21 -07:00 committed by GitHub
parent 99b79f2102
commit f72054ebaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# Also link binaries as static
AC_ARG_ENABLE([static-bin],
AS_HELP_STRING([--enable-static-bin], [link iperf binary statically]),
AS_HELP_STRING([--enable-static-bin], [link iperf3 binary statically]),
[enable_static_bin=yes
AC_DISABLE_SHARED],
[:])

34
configure vendored
View File

@ -775,6 +775,7 @@ with_sysroot
enable_libtool_lock
enable_maintainer_mode
enable_profiling
with_sctp
with_openssl
'
ac_precious_vars='build_alias
@ -1405,7 +1406,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-static-bin link iperf binary statically
--enable-static-bin link iperf3 binary statically
--enable-shared[=PKGS] build shared libraries [default=no]
--enable-silent-rules less verbose build output (undo: "make V=1")
--disable-silent-rules verbose build output (undo: "make V=0")
@ -1420,7 +1421,7 @@ Optional Features:
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
--enable-profiling Enable iperf profiling binary
--enable-profiling Enable iperf3 profiling binary
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -1433,6 +1434,7 @@ Optional Packages:
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-sysroot[=DIR] Search for dependent libraries within DIR (or the
compiler's sysroot if not specified).
--without-sctp disable SCTP
--with-openssl=DIR root of the OpenSSL directory
Some influential environment variables:
@ -13361,7 +13363,34 @@ fi
done
# SCTP. Allow user to disable SCTP support with --without-sctp.
# Otherwise we try to find whatever support is required.
try_sctp=true
# Check whether --with-sctp was given.
if test "${with_sctp+set}" = set; then :
withval=$with_sctp;
case "$withval" in
y | ye | yes)
;;
n | no)
try_sctp=false
;;
*)
as_fn_error $? "Invalid --with-sctp value" "$LINENO" 5
;;
esac
else
try_sctp=true
fi
# Check for SCTP support
if $try_sctp; then
for ac_header in sys/socket.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default"
@ -13513,6 +13542,7 @@ fi
done
fi
ac_fn_c_check_header_mongrel "$LINENO" "endian.h" "ac_cv_header_endian_h" "$ac_includes_default"
if test "x$ac_cv_header_endian_h" = xyes; then :

View File

@ -1,4 +1,4 @@
# iperf, Copyright (c) 2014-2018, The Regents of the University of
# iperf, Copyright (c) 2014-2020, The Regents of the University of
# California, through Lawrence Berkeley National Laboratory (subject
# to receipt of any required approvals from the U.S. Dept. of
# Energy). All rights reserved.
@ -58,7 +58,7 @@ fi
# Check if enable profiling
AC_ARG_ENABLE([profiling],
AS_HELP_STRING([--enable-profiling], [Enable iperf profiling binary]),
AS_HELP_STRING([--enable-profiling], [Enable iperf3 profiling binary]),
[enable_profiling=yes],
[:])
AM_CONDITIONAL([ENABLE_PROFILING], [test x$enable_profiling = xyes])
@ -93,7 +93,30 @@ AC_C_CONST
# Check for poll.h (it's in POSIX so everyone should have it?)
AC_CHECK_HEADERS([poll.h])
# SCTP. Allow user to disable SCTP support with --without-sctp.
# Otherwise we try to find whatever support is required.
try_sctp=true
AC_ARG_WITH([sctp],
[AS_HELP_STRING([--without-sctp],
[disable SCTP])],
[
case "$withval" in
y | ye | yes)
;;
n | no)
try_sctp=false
;;
*)
AC_MSG_ERROR([Invalid --with-sctp value])
;;
esac
], [
try_sctp=true
]
)
# Check for SCTP support
if $try_sctp; then
AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([netinet/sctp.h],
AC_DEFINE([HAVE_SCTP], [1], [Have SCTP support.])
@ -105,6 +128,7 @@ AC_CHECK_HEADERS([netinet/sctp.h],
#include <sys/socket.h>
#endif
])
fi
AC_CHECK_HEADER([endian.h],
AC_DEFINE([HAVE_ENDIAN_H], [1], [Define to 1 if you have the <endian.h> header file.]),