1# iperf, Copyright (c) 2014-2018, 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.7, https://github.com/esnet/iperf, iperf, https://software.es.net/iperf/) 28m4_include([config/ax_check_openssl.m4]) 29AC_LANG(C) 30 31# Specify where the auxiliary files created by configure should go. The config 32# directory is picked so that they don't clutter up more useful directories. 33AC_CONFIG_AUX_DIR(config) 34 35 36# Initialize the automake system 37AM_INIT_AUTOMAKE([foreign]) 38AM_MAINTAINER_MODE 39AM_CONFIG_HEADER(src/iperf_config.h) 40 41AC_CANONICAL_HOST 42 43# Checks for tools: c compiler, ranlib (used for creating static libraries), 44# symlinks and libtool 45AC_PROG_CC 46AC_PROG_RANLIB 47AC_PROG_LN_S 48AC_PROG_LIBTOOL 49 50# Add -Wall if we are using GCC. 51if test "x$GCC" = "xyes"; then 52 CFLAGS="$CFLAGS -Wall" 53fi 54 55# Check if profiling must be disabled 56AC_ARG_ENABLE([profiling], 57 AS_HELP_STRING([--disable-profiling], [Disable iperf profiling binary]), 58 [:], 59 [enable_profiling=yes]) 60AM_CONDITIONAL([ENABLE_PROFILING], [test x$enable_profiling = xyes]) 61 62# Checks for header files. 63AC_HEADER_STDC 64 65# Check for systems which need -lsocket and -lnsl 66#AX_LIB_SOCKET_NSL 67 68# Check for the math library (needed by cjson on some platforms) 69AC_SEARCH_LIBS(floor, [m], [], [ 70echo "floor()" 71exit 1 72]) 73 74# On illumos we need -lsocket 75AC_SEARCH_LIBS(socket, [socket], [], [ 76echo "socket()" 77exit 1 78]) 79 80# On illumos inet_ntop in in -lnsl 81AC_SEARCH_LIBS(inet_ntop, [nsl], [], [ 82echo "inet_ntop()" 83exit 1 84]) 85 86# Checks for typedefs, structures, and compiler characteristics. 87AC_C_CONST 88 89# Check for poll.h (it's in POSIX so everyone should have it?) 90AC_CHECK_HEADERS([poll.h]) 91 92# Check for SCTP support 93AC_CHECK_HEADERS([sys/socket.h]) 94AC_CHECK_HEADERS([netinet/sctp.h], 95 AC_DEFINE([HAVE_SCTP], [1], [Have SCTP support.]) 96 AC_SEARCH_LIBS(sctp_bindx, [sctp]) 97 AC_CHECK_TYPES([struct sctp_assoc_value], [], [], 98 [[#include <netinet/sctp.h>]]), 99 [], 100 [#ifdef HAVE_SYS_SOCKET_H 101#include <sys/socket.h> 102#endif 103]) 104 105AC_CHECK_HEADER([endian.h], 106 AC_DEFINE([HAVE_ENDIAN_H], [1], [Define to 1 if you have the <endian.h> header file.]), 107 AC_CHECK_HEADER([sys/endian.h], 108 AC_DEFINE([HAVE_SYS_ENDIAN_H], [1], [Define to 1 if you have the <sys/endian.h> header file.]), 109 AC_MSG_WARN([Couldn't find endian.h or sys/endian.h files: doing compile-time tests.]) 110 ) 111 ) 112 113if test "x$with_openssl" = "xno"; then 114 AC_MSG_WARN( [Building without OpenSSL; disabling iperf_auth functionality.] ) 115else 116 # Check for OPENSSL support 117 havs_ssl=false 118 AX_CHECK_OPENSSL( 119 [ AC_DEFINE([HAVE_SSL], [1], [OpenSSL Is Available]) 120 have_ssl=true ], 121 [ if test "x$with_openssl" != "x"; then 122 AC_MSG_FAILURE([--with-openssl was given, but test for OpenSSL failed]) 123 fi ] 124 ) 125 if $have_ssl; then 126 LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" 127 LIBS="$OPENSSL_LIBS $LIBS" 128 CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" 129 fi 130fi 131 132# Check for TCP_CONGESTION sockopt (believed to be Linux and FreeBSD only) 133AC_CACHE_CHECK([TCP_CONGESTION socket option], 134[iperf3_cv_header_tcp_congestion], 135AC_EGREP_CPP(yes, 136[#include <netinet/tcp.h> 137#ifdef TCP_CONGESTION 138 yes 139#endif 140],iperf3_cv_header_tcp_congestion=yes,iperf3_cv_header_tcp_congestion=no)) 141if test "x$iperf3_cv_header_tcp_congestion" = "xyes"; then 142 AC_DEFINE([HAVE_TCP_CONGESTION], [1], [Have TCP_CONGESTION sockopt.]) 143fi 144 145# Check for IPv6 flowlabel support (believed to be Linux only) 146# We check for IPV6_FLOWLABEL_MGR in <linux/in6.h> even though we 147# don't use that file directly (we have our own stripped-down 148# copy, see src/flowlabel.h for more details). 149AC_CACHE_CHECK([IPv6 flowlabel support], 150[iperf3_cv_header_flowlabel], 151AC_EGREP_CPP(yes, 152[#include <sys/types.h> 153#include <linux/in6.h> 154#ifdef IPV6_FLOWLABEL_MGR 155 yes 156#endif 157],iperf3_cv_header_flowlabel=yes,iperf3_cv_header_flowlabel=no)) 158if test "x$iperf3_cv_header_flowlabel" = "xyes"; then 159 AC_DEFINE([HAVE_FLOWLABEL], [1], [Have IPv6 flowlabel support.]) 160fi 161 162# Check for CPU affinity support. FreeBSD and Linux do this differently 163# unfortunately so we have to check separately for each of them. 164# FreeBSD uses cpuset_setaffinity while Linux uses sched_setaffinity. 165# Define HAVE_CPU_AFFINITY to indicate the CPU affinity setting as a 166# generic concept is available. 167AC_CHECK_FUNCS([cpuset_setaffinity sched_setaffinity SetProcessAffinityMask], 168 AC_DEFINE([HAVE_CPU_AFFINITY], [1], 169 [Have CPU affinity support.])) 170 171# Check for daemon(). Most systems have this but a few (IRIX) don't. 172AC_CHECK_FUNCS([daemon]) 173 174# Check for sendfile support. FreeBSD, Linux, and MacOS all support 175# this system call, but they're all different in terms of what headers 176# it needs and what arguments it expects. 177AC_CHECK_FUNCS([sendfile]) 178 179# Check for getline support, used as a part of authenticated 180# connections. 181AC_CHECK_FUNCS([getline]) 182 183# Check for packet pacing socket option (Linux only for now). 184AC_CACHE_CHECK([SO_MAX_PACING_RATE socket option], 185[iperf3_cv_header_so_max_pacing_rate], 186AC_EGREP_CPP(yes, 187[#include <sys/socket.h> 188#ifdef SO_MAX_PACING_RATE 189 yes 190#endif 191],iperf3_cv_header_so_max_pacing_rate=yes,iperf3_cv_header_so_max_pacing_rate=no)) 192if test "x$iperf3_cv_header_so_max_pacing_rate" = "xyes"; then 193 AC_DEFINE([HAVE_SO_MAX_PACING_RATE], [1], [Have SO_MAX_PACING_RATE sockopt.]) 194fi 195 196# Check if we need -lrt for clock_gettime 197AC_SEARCH_LIBS(clock_gettime, [rt posix4]) 198# Check for clock_gettime support 199AC_CHECK_FUNCS([clock_gettime]) 200 201AC_OUTPUT([Makefile src/Makefile src/version.h examples/Makefile iperf3.spec]) 202