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 TTD@lbl.gov. 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.9, 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])) 62AM_CONDITIONAL([ENABLE_PROFILING], [test x$enable_profiling = xyes]) 63 64# Checks for header files. 65AC_HEADER_STDC 66 67# Check for systems which need -lsocket and -lnsl 68#AX_LIB_SOCKET_NSL 69 70# Check for the math library (needed by cjson on some platforms) 71AC_SEARCH_LIBS(floor, [m], [], [ 72echo "floor()" 73exit 1 74]) 75 76# On illumos we need -lsocket 77AC_SEARCH_LIBS(socket, [socket], [], [ 78echo "socket()" 79exit 1 80]) 81 82# On illumos inet_ntop in in -lnsl 83AC_SEARCH_LIBS(inet_ntop, [nsl], [], [ 84echo "inet_ntop()" 85exit 1 86]) 87 88# Checks for typedefs, structures, and compiler characteristics. 89AC_C_CONST 90 91# Check for poll.h (it's in POSIX so everyone should have it?) 92AC_CHECK_HEADERS([poll.h]) 93 94# SCTP. Allow user to disable SCTP support with --without-sctp. 95# Otherwise we try to find whatever support is required. 96try_sctp=true 97AC_ARG_WITH([sctp], 98 [AS_HELP_STRING([--without-sctp], 99 [disable SCTP])], 100 [ 101 case "$withval" in 102 y | ye | yes) 103 ;; 104 n | no) 105 try_sctp=false 106 ;; 107 *) 108 AC_MSG_ERROR([Invalid --with-sctp value]) 109 ;; 110 esac 111 ], [ 112 try_sctp=true 113 ] 114) 115 116# Check for SCTP support 117if $try_sctp; then 118AC_CHECK_HEADERS([sys/socket.h]) 119AC_CHECK_HEADERS([netinet/sctp.h], 120 AC_DEFINE([HAVE_SCTP_H], [1], [Have SCTP support.]) 121 AC_SEARCH_LIBS(sctp_bindx, [sctp]) 122 AC_CHECK_TYPES([struct sctp_assoc_value], [], [], 123 [[#include <netinet/sctp.h>]]), 124 [], 125 [#ifdef HAVE_SYS_SOCKET_H 126#include <sys/socket.h> 127#endif 128]) 129fi 130 131AC_CHECK_HEADER([endian.h], 132 AC_DEFINE([HAVE_ENDIAN_H], [1], [Define to 1 if you have the <endian.h> header file.]), 133 AC_CHECK_HEADER([sys/endian.h], 134 AC_DEFINE([HAVE_SYS_ENDIAN_H], [1], [Define to 1 if you have the <sys/endian.h> header file.]), 135 AC_MSG_WARN([Couldn't find endian.h or sys/endian.h files: doing compile-time tests.]) 136 ) 137 ) 138 139if test "x$with_openssl" = "xno"; then 140 AC_MSG_WARN( [Building without OpenSSL; disabling iperf_auth functionality.] ) 141else 142 # Check for OPENSSL support 143 havs_ssl=false 144 AX_CHECK_OPENSSL( 145 [ AC_DEFINE([HAVE_SSL], [1], [OpenSSL Is Available]) 146 have_ssl=true ], 147 [ if test "x$with_openssl" != "x"; then 148 AC_MSG_FAILURE([--with-openssl was given, but test for OpenSSL failed]) 149 fi ] 150 ) 151 if $have_ssl; then 152 case $host in 153 *-*-cygwin) 154 CFLAGS="$CFLAGS -DNOCRYPT" 155 ;; 156 esac 157 LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" 158 LIBS="$OPENSSL_LIBS $LIBS" 159 CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" 160 fi 161fi 162 163# Check for TCP_CONGESTION sockopt (believed to be Linux and FreeBSD only) 164AC_CACHE_CHECK([TCP_CONGESTION socket option], 165[iperf3_cv_header_tcp_congestion], 166AC_EGREP_CPP(yes, 167[#include <netinet/tcp.h> 168#ifdef TCP_CONGESTION 169 yes 170#endif 171],iperf3_cv_header_tcp_congestion=yes,iperf3_cv_header_tcp_congestion=no)) 172if test "x$iperf3_cv_header_tcp_congestion" = "xyes"; then 173 AC_DEFINE([HAVE_TCP_CONGESTION], [1], [Have TCP_CONGESTION sockopt.]) 174fi 175 176# Check for IPv6 flowlabel support (believed to be Linux only) 177# We check for IPV6_FLOWLABEL_MGR in <linux/in6.h> even though we 178# don't use that file directly (we have our own stripped-down 179# copy, see src/flowlabel.h for more details). 180AC_CACHE_CHECK([IPv6 flowlabel support], 181[iperf3_cv_header_flowlabel], 182AC_EGREP_CPP(yes, 183[#include <sys/types.h> 184#include <linux/in6.h> 185#ifdef IPV6_FLOWLABEL_MGR 186 yes 187#endif 188],iperf3_cv_header_flowlabel=yes,iperf3_cv_header_flowlabel=no)) 189if test "x$iperf3_cv_header_flowlabel" = "xyes"; then 190 AC_DEFINE([HAVE_FLOWLABEL], [1], [Have IPv6 flowlabel support.]) 191fi 192 193# Check for CPU affinity support. FreeBSD and Linux do this differently 194# unfortunately so we have to check separately for each of them. 195# FreeBSD uses cpuset_setaffinity while Linux uses sched_setaffinity. 196# Define HAVE_CPU_AFFINITY to indicate the CPU affinity setting as a 197# generic concept is available. 198AC_CHECK_FUNCS([cpuset_setaffinity sched_setaffinity SetProcessAffinityMask], 199 AC_DEFINE([HAVE_CPU_AFFINITY], [1], 200 [Have CPU affinity support.])) 201 202# Check for daemon(). Most systems have this but a few (IRIX) don't. 203AC_CHECK_FUNCS([daemon]) 204 205# Check for sendfile support. FreeBSD, Linux, and MacOS all support 206# this system call, but they're all different in terms of what headers 207# it needs and what arguments it expects. 208AC_CHECK_FUNCS([sendfile]) 209 210# Check for getline support, used as a part of authenticated 211# connections. 212AC_CHECK_FUNCS([getline]) 213 214# Check for packet pacing socket option (Linux only for now). 215AC_CACHE_CHECK([SO_MAX_PACING_RATE socket option], 216[iperf3_cv_header_so_max_pacing_rate], 217AC_EGREP_CPP(yes, 218[#include <sys/socket.h> 219#ifdef SO_MAX_PACING_RATE 220 yes 221#endif 222],iperf3_cv_header_so_max_pacing_rate=yes,iperf3_cv_header_so_max_pacing_rate=no)) 223if test "x$iperf3_cv_header_so_max_pacing_rate" = "xyes"; then 224 AC_DEFINE([HAVE_SO_MAX_PACING_RATE], [1], [Have SO_MAX_PACING_RATE sockopt.]) 225fi 226 227# Check if we need -lrt for clock_gettime 228AC_SEARCH_LIBS(clock_gettime, [rt posix4]) 229# Check for clock_gettime support 230AC_CHECK_FUNCS([clock_gettime]) 231 232AC_OUTPUT([Makefile src/Makefile src/version.h examples/Makefile iperf3.spec]) 233