blob: 939cf0ac917ccd11a734a9a75d6b5355925c0b28 [file] [log] [blame]
Bruce A. Mahf72054e2020-05-28 10:10:21 -07001# iperf, Copyright (c) 2014-2020, The Regents of the University of
Bruce A. Mahda9f0462014-09-29 14:00:46 -07002# 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
AaronMatthewBrownf4a3dda2009-12-08 21:36:24 +000026# Initialize the autoconf system for the specified tool, version and mailing list
Bruce A. Mah1f8fb132020-08-14 15:08:27 -070027AC_INIT(iperf, 3.9, https://github.com/esnet/iperf, iperf, https://software.es.net/iperf/)
Bruce A. Maha026b292017-04-20 12:37:09 -070028m4_include([config/ax_check_openssl.m4])
Ezra9427ecd2020-05-04 18:09:05 -040029m4_include([config/iperf_config_static_bin.m4])
Bruce A. Mah3b60f092015-01-06 10:22:00 -080030AC_LANG(C)
AaronMatthewBrownf4a3dda2009-12-08 21:36:24 +000031
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
Hkf64da9b2018-07-02 13:06:42 -040038AM_INIT_AUTOMAKE([foreign])
Ezra9427ecd2020-05-04 18:09:05 -040039m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
40LT_INIT
41
Bruce A. Mah6edfd8d2014-05-02 11:32:12 -070042AM_MAINTAINER_MODE
Bruce A. Mah40050b72014-04-14 13:33:33 -070043AM_CONFIG_HEADER(src/iperf_config.h)
AaronMatthewBrownf4a3dda2009-12-08 21:36:24 +000044
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
Bruce A. Mah94c0bff2014-05-19 15:22:08 -070054# Add -Wall if we are using GCC.
Bruce A. Mah8de51b52014-05-19 15:02:02 -070055if test "x$GCC" = "xyes"; then
Bruce A. Mah94c0bff2014-05-19 15:22:08 -070056 CFLAGS="$CFLAGS -Wall"
Bruce A. Mah8de51b52014-05-19 15:02:02 -070057fi
58
Bruce A. Mah4a3efb32020-01-06 13:43:29 -080059# Check if enable profiling
Hke6689a82018-06-29 19:23:41 -040060AC_ARG_ENABLE([profiling],
Alexandru-Sever Horin215acfe2020-06-22 17:59:46 +030061 AS_HELP_STRING([--enable-profiling], [Enable iperf3 profiling binary]))
Hke6689a82018-06-29 19:23:41 -040062AM_CONDITIONAL([ENABLE_PROFILING], [test x$enable_profiling = xyes])
63
AaronMatthewBrownf4a3dda2009-12-08 21:36:24 +000064# Checks for header files.
65AC_HEADER_STDC
66
Jon Dugan92864152010-09-20 21:50:12 +000067# Check for systems which need -lsocket and -lnsl
jef56a97f92012-08-20 14:35:58 -070068#AX_LIB_SOCKET_NSL
Jon Dugan92864152010-09-20 21:50:12 +000069
Bruce A. Mahed940822016-06-03 09:23:59 -070070# Check for the math library (needed by cjson on some platforms)
71AC_SEARCH_LIBS(floor, [m], [], [
72echo "floor()"
73exit 1
74])
75
Ante Vojvodic165d10d2014-10-06 18:38:17 +020076# 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
AaronMatthewBrownf4a3dda2009-12-08 21:36:24 +000088# Checks for typedefs, structures, and compiler characteristics.
89AC_C_CONST
90
Bruce A. Mah9d7d60a2017-05-17 12:50:50 -070091# Check for poll.h (it's in POSIX so everyone should have it?)
92AC_CHECK_HEADERS([poll.h])
93
Bruce A. Mahf72054e2020-05-28 10:10:21 -070094# 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
Bruce A. Mahcd81de32014-04-09 10:29:16 -0700116# Check for SCTP support
Bruce A. Mahf72054e2020-05-28 10:10:21 -0700117if $try_sctp; then
Bruce A. Mahddf55792014-10-16 11:29:41 -0700118AC_CHECK_HEADERS([sys/socket.h])
Bruce A. Mahcd81de32014-04-09 10:29:16 -0700119AC_CHECK_HEADERS([netinet/sctp.h],
Stefano Garzarella0b0aa342020-06-12 18:28:15 +0200120 AC_DEFINE([HAVE_SCTP_H], [1], [Have SCTP support.])
Bruce A. Mah8fb86882015-01-06 10:34:41 -0800121 AC_SEARCH_LIBS(sctp_bindx, [sctp])
122 AC_CHECK_TYPES([struct sctp_assoc_value], [], [],
123 [[#include <netinet/sctp.h>]]),
Bruce A. Mahddf55792014-10-16 11:29:41 -0700124 [],
125 [#ifdef HAVE_SYS_SOCKET_H
126#include <sys/socket.h>
127#endif
128])
Bruce A. Mahf72054e2020-05-28 10:10:21 -0700129fi
Bruce A. Mahcd81de32014-04-09 10:29:16 -0700130
Philip Prindevilled88f4ce2017-11-08 17:29:26 +0000131AC_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
ralcini3fd1a2a2017-08-14 22:43:38 +0200139if test "x$with_openssl" = "xno"; then
140 AC_MSG_WARN( [Building without OpenSSL; disabling iperf_auth functionality.] )
141else
142 # Check for OPENSSL support
hhbf7817142019-05-17 12:46:28 -0700143 havs_ssl=false
ralcini3fd1a2a2017-08-14 22:43:38 +0200144 AX_CHECK_OPENSSL(
hhbf7817142019-05-17 12:46:28 -0700145 [ AC_DEFINE([HAVE_SSL], [1], [OpenSSL Is Available])
146 have_ssl=true ],
Bruce A. Mah4a45b322017-08-15 11:13:08 -0700147 [ if test "x$with_openssl" != "x"; then
148 AC_MSG_FAILURE([--with-openssl was given, but test for OpenSSL failed])
149 fi ]
ralcini3fd1a2a2017-08-14 22:43:38 +0200150 )
hhbf7817142019-05-17 12:46:28 -0700151 if $have_ssl; then
ralcinicf1cad42020-04-21 02:19:29 +0200152 case $host in
153 *-*-cygwin)
154 CFLAGS="$CFLAGS -DNOCRYPT"
155 ;;
156 esac
hhbf7817142019-05-17 12:46:28 -0700157 LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
158 LIBS="$OPENSSL_LIBS $LIBS"
159 CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
160 fi
ralcini3fd1a2a2017-08-14 22:43:38 +0200161fi
ralcinia51045d2017-04-20 19:01:08 +0200162
Bruce A. Mah0932b662014-10-16 12:29:11 -0700163# Check for TCP_CONGESTION sockopt (believed to be Linux and FreeBSD only)
Bruce A. Mahc550ef42014-04-10 10:53:18 -0700164AC_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
Bruce A. Mah4155c452014-04-10 11:20:36 -0700176# 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
Bruce A. Mah40a1faf2014-04-14 10:45:46 -0700193# 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.
Boris Okunev5b27ea32017-11-13 23:54:34 +0300198AC_CHECK_FUNCS([cpuset_setaffinity sched_setaffinity SetProcessAffinityMask],
Bruce A. Mah40a1faf2014-04-14 10:45:46 -0700199 AC_DEFINE([HAVE_CPU_AFFINITY], [1],
200 [Have CPU affinity support.]))
201
Bruce A. Mah73b02f92017-11-11 10:12:55 -0800202# Check for daemon(). Most systems have this but a few (IRIX) don't.
203AC_CHECK_FUNCS([daemon])
204
Bruce A. Mah3f8c33c2014-04-14 14:16:07 -0700205# 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
Bruce A. Mahcb2dcd32017-11-08 10:18:30 -0800210# Check for getline support, used as a part of authenticated
211# connections.
212AC_CHECK_FUNCS([getline])
213
Bruce A. Mah99157462016-05-26 09:47:48 -0700214# 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
Ben Fox-Moorecde81d72018-05-16 23:49:45 +0200227# 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])
Bruce A. Mah99157462016-05-26 09:47:48 -0700231
Bruce A. Mahd1aab092014-10-14 13:41:48 -0700232AC_OUTPUT([Makefile src/Makefile src/version.h examples/Makefile iperf3.spec])