1# iperf, Copyright (c) 2014-2020, The Regents of the University of 2# California, through Lawrence Berkeley National Laboratory (subject 3# to receipt of any required approvals from the U.S. Dept. of 4# Energy). All rights reserved. 5# 6# If you have questions about your rights to use or distribute this 7# software, please contact Berkeley Lab's Technology Transfer 8# Department at [email protected]. 9# 10# NOTICE. This software is owned by the U.S. Department of Energy. 11# As such, the U.S. Government has been granted for itself and others 12# acting on its behalf a paid-up, nonexclusive, irrevocable, 13# worldwide license in the Software to reproduce, prepare derivative 14# works, and perform publicly and display publicly. Beginning five 15# (5) years after the date permission to assert copyright is obtained 16# from the U.S. Department of Energy, and subject to any subsequent 17# five (5) year renewals, the U.S. Government is granted for itself 18# and others acting on its behalf a paid-up, nonexclusive, 19# irrevocable, worldwide license in the Software to reproduce, 20# prepare derivative works, distribute copies to the public, perform 21# publicly and display publicly, and to permit others to do so. 22# 23# This code is distributed under a BSD style license, see the LICENSE 24# file for complete information. 25 26# Initialize the autoconf system for the specified tool, version and mailing list 27AC_INIT(iperf, 3.8.1, https://github.com/esnet/iperf, iperf, https://software.es.net/iperf/) 28m4_include([config/ax_check_openssl.m4]) 29m4_include([config/iperf_config_static_bin.m4]) 30AC_LANG(C) 31 32# Specify where the auxiliary files created by configure should go. The config 33# directory is picked so that they don't clutter up more useful directories. 34AC_CONFIG_AUX_DIR(config) 35 36 37# Initialize the automake system 38AM_INIT_AUTOMAKE([foreign]) 39m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 40LT_INIT 41 42AM_MAINTAINER_MODE 43AM_CONFIG_HEADER(src/iperf_config.h) 44 45AC_CANONICAL_HOST 46 47# Checks for tools: c compiler, ranlib (used for creating static libraries), 48# symlinks and libtool 49AC_PROG_CC 50AC_PROG_RANLIB 51AC_PROG_LN_S 52AC_PROG_LIBTOOL 53 54# Add -Wall if we are using GCC. 55if test "x$GCC" = "xyes"; then 56 CFLAGS="$CFLAGS -Wall" 57fi 58 59# Check if enable profiling 60AC_ARG_ENABLE([profiling], 61 AS_HELP_STRING([--enable-profiling], [Enable iperf3 profiling binary]), 62 [enable_profiling=yes], 63 [:]) 64AM_CONDITIONAL([ENABLE_PROFILING], [test x$enable_profiling = xyes]) 65 66# Checks for header files. 67AC_HEADER_STDC 68 69# Check for systems which need -lsocket and -lnsl 70#AX_LIB_SOCKET_NSL 71 72# Check for the math library (needed by cjson on some platforms) 73AC_SEARCH_LIBS(floor, [m], [], [ 74echo "floor()" 75exit 1 76]) 77 78# On illumos we need -lsocket 79AC_SEARCH_LIBS(socket, [socket], [], [ 80echo "socket()" 81exit 1 82]) 83 84# On illumos inet_ntop in in -lnsl 85AC_SEARCH_LIBS(inet_ntop, [nsl], [], [ 86echo "inet_ntop()" 87exit 1 88]) 89 90# Checks for typedefs, structures, and compiler characteristics. 91AC_C_CONST 92 93# Check for poll.h (it's in POSIX so everyone should have it?) 94AC_CHECK_HEADERS([poll.h]) 95 96# SCTP. Allow user to disable SCTP support with --without-sctp. 97# Otherwise we try to find whatever support is required. 98try_sctp=true 99AC_ARG_WITH([sctp], 100 [AS_HELP_STRING([--without-sctp], 101 [disable SCTP])], 102 [ 103 case "$withval" in 104 y | ye | yes) 105 ;; 106 n | no) 107 try_sctp=false 108 ;; 109 *) 110 AC_MSG_ERROR([Invalid --with-sctp value]) 111 ;; 112 esac 113 ], [ 114 try_sctp=true 115 ] 116) 117 118# Check for SCTP support 119if $try_sctp; then 120AC_CHECK_HEADERS([sys/socket.h]) 121AC_CHECK_HEADERS([netinet/sctp.h], 122 AC_DEFINE([HAVE_SCTP], [1], [Have SCTP support.]) 123 AC_SEARCH_LIBS(sctp_bindx, [sctp]) 124 AC_CHECK_TYPES([struct sctp_assoc_value], [], [], 125 [[#include <netinet/sctp.h>]]), 126 [], 127 [#ifdef HAVE_SYS_SOCKET_H 128#include <sys/socket.h> 129#endif 130]) 131fi 132 133AC_CHECK_HEADER([endian.h], 134 AC_DEFINE([HAVE_ENDIAN_H], [1], [Define to 1 if you have the <endian.h> header file.]), 135 AC_CHECK_HEADER([sys/endian.h], 136 AC_DEFINE([HAVE_SYS_ENDIAN_H], [1], [Define to 1 if you have the <sys/endian.h> header file.]), 137 AC_MSG_WARN([Couldn't find endian.h or sys/endian.h files: doing compile-time tests.]) 138 ) 139 ) 140 141if test "x$with_openssl" = "xno"; then 142 AC_MSG_WARN( [Building without OpenSSL; disabling iperf_auth functionality.] ) 143else 144 # Check for OPENSSL support 145 havs_ssl=false 146 AX_CHECK_OPENSSL( 147 [ AC_DEFINE([HAVE_SSL], [1], [OpenSSL Is Available]) 148 have_ssl=true ], 149 [ if test "x$with_openssl" != "x"; then 150 AC_MSG_FAILURE([--with-openssl was given, but test for OpenSSL failed]) 151 fi ] 152 ) 153 if $have_ssl; then 154 case $host in 155 *-*-cygwin) 156 CFLAGS="$CFLAGS -DNOCRYPT" 157 ;; 158 esac 159 LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" 160 LIBS="$OPENSSL_LIBS $LIBS" 161 CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" 162 fi 163fi 164 165# Check for TCP_CONGESTION sockopt (believed to be Linux and FreeBSD only) 166AC_CACHE_CHECK([TCP_CONGESTION socket option], 167[iperf3_cv_header_tcp_congestion], 168AC_EGREP_CPP(yes, 169[#include <netinet/tcp.h> 170#ifdef TCP_CONGESTION 171 yes 172#endif 173],iperf3_cv_header_tcp_congestion=yes,iperf3_cv_header_tcp_congestion=no)) 174if test "x$iperf3_cv_header_tcp_congestion" = "xyes"; then 175 AC_DEFINE([HAVE_TCP_CONGESTION], [1], [Have TCP_CONGESTION sockopt.]) 176fi 177 178# Check for IPv6 flowlabel support (believed to be Linux only) 179# We check for IPV6_FLOWLABEL_MGR in <linux/in6.h> even though we 180# don't use that file directly (we have our own stripped-down 181# copy, see src/flowlabel.h for more details). 182AC_CACHE_CHECK([IPv6 flowlabel support], 183[iperf3_cv_header_flowlabel], 184AC_EGREP_CPP(yes, 185[#include <sys/types.h> 186#include <linux/in6.h> 187#ifdef IPV6_FLOWLABEL_MGR 188 yes 189#endif 190],iperf3_cv_header_flowlabel=yes,iperf3_cv_header_flowlabel=no)) 191if test "x$iperf3_cv_header_flowlabel" = "xyes"; then 192 AC_DEFINE([HAVE_FLOWLABEL], [1], [Have IPv6 flowlabel support.]) 193fi 194 195# Check for CPU affinity support. FreeBSD and Linux do this differently 196# unfortunately so we have to check separately for each of them. 197# FreeBSD uses cpuset_setaffinity while Linux uses sched_setaffinity. 198# Define HAVE_CPU_AFFINITY to indicate the CPU affinity setting as a 199# generic concept is available. 200AC_CHECK_FUNCS([cpuset_setaffinity sched_setaffinity SetProcessAffinityMask], 201 AC_DEFINE([HAVE_CPU_AFFINITY], [1], 202 [Have CPU affinity support.])) 203 204# Check for daemon(). Most systems have this but a few (IRIX) don't. 205AC_CHECK_FUNCS([daemon]) 206 207# Check for sendfile support. FreeBSD, Linux, and MacOS all support 208# this system call, but they're all different in terms of what headers 209# it needs and what arguments it expects. 210AC_CHECK_FUNCS([sendfile]) 211 212# Check for getline support, used as a part of authenticated 213# connections. 214AC_CHECK_FUNCS([getline]) 215 216# Check for packet pacing socket option (Linux only for now). 217AC_CACHE_CHECK([SO_MAX_PACING_RATE socket option], 218[iperf3_cv_header_so_max_pacing_rate], 219AC_EGREP_CPP(yes, 220[#include <sys/socket.h> 221#ifdef SO_MAX_PACING_RATE 222 yes 223#endif 224],iperf3_cv_header_so_max_pacing_rate=yes,iperf3_cv_header_so_max_pacing_rate=no)) 225if test "x$iperf3_cv_header_so_max_pacing_rate" = "xyes"; then 226 AC_DEFINE([HAVE_SO_MAX_PACING_RATE], [1], [Have SO_MAX_PACING_RATE sockopt.]) 227fi 228 229# Check if we need -lrt for clock_gettime 230AC_SEARCH_LIBS(clock_gettime, [rt posix4]) 231# Check for clock_gettime support 232AC_CHECK_FUNCS([clock_gettime]) 233 234AC_OUTPUT([Makefile src/Makefile src/version.h examples/Makefile iperf3.spec]) 235