blob: 0ff65493583860aa732f87d0d2ddd6d5827b3d46 [file] [log] [blame]
Bruce A. Mah82f25ed2018-02-14 13:37:58 -08001# iperf, Copyright (c) 2014-2018, 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. Mahdfcea9f2019-06-20 18:12:47 -070027AC_INIT(iperf, 3.7, 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])
Bruce A. Mah3b60f092015-01-06 10:22:00 -080029AC_LANG(C)
AaronMatthewBrownf4a3dda2009-12-08 21:36:24 +000030
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
Hkf64da9b2018-07-02 13:06:42 -040037AM_INIT_AUTOMAKE([foreign])
Bruce A. Mah6edfd8d2014-05-02 11:32:12 -070038AM_MAINTAINER_MODE
Bruce A. Mah40050b72014-04-14 13:33:33 -070039AM_CONFIG_HEADER(src/iperf_config.h)
AaronMatthewBrownf4a3dda2009-12-08 21:36:24 +000040
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
Bruce A. Mah94c0bff2014-05-19 15:22:08 -070050# Add -Wall if we are using GCC.
Bruce A. Mah8de51b52014-05-19 15:02:02 -070051if test "x$GCC" = "xyes"; then
Bruce A. Mah94c0bff2014-05-19 15:22:08 -070052 CFLAGS="$CFLAGS -Wall"
Bruce A. Mah8de51b52014-05-19 15:02:02 -070053fi
54
Hke6689a82018-06-29 19:23:41 -040055# 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
AaronMatthewBrownf4a3dda2009-12-08 21:36:24 +000062# Checks for header files.
63AC_HEADER_STDC
64
Jon Dugan92864152010-09-20 21:50:12 +000065# Check for systems which need -lsocket and -lnsl
jef56a97f92012-08-20 14:35:58 -070066#AX_LIB_SOCKET_NSL
Jon Dugan92864152010-09-20 21:50:12 +000067
Bruce A. Mahed940822016-06-03 09:23:59 -070068# Check for the math library (needed by cjson on some platforms)
69AC_SEARCH_LIBS(floor, [m], [], [
70echo "floor()"
71exit 1
72])
73
Ante Vojvodic165d10d2014-10-06 18:38:17 +020074# 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
AaronMatthewBrownf4a3dda2009-12-08 21:36:24 +000086# Checks for typedefs, structures, and compiler characteristics.
87AC_C_CONST
88
Bruce A. Mah9d7d60a2017-05-17 12:50:50 -070089# Check for poll.h (it's in POSIX so everyone should have it?)
90AC_CHECK_HEADERS([poll.h])
91
Bruce A. Mahcd81de32014-04-09 10:29:16 -070092# Check for SCTP support
Bruce A. Mahddf55792014-10-16 11:29:41 -070093AC_CHECK_HEADERS([sys/socket.h])
Bruce A. Mahcd81de32014-04-09 10:29:16 -070094AC_CHECK_HEADERS([netinet/sctp.h],
Bruce A. Mahe1420622015-01-05 15:19:57 -080095 AC_DEFINE([HAVE_SCTP], [1], [Have SCTP support.])
Bruce A. Mah8fb86882015-01-06 10:34:41 -080096 AC_SEARCH_LIBS(sctp_bindx, [sctp])
97 AC_CHECK_TYPES([struct sctp_assoc_value], [], [],
98 [[#include <netinet/sctp.h>]]),
Bruce A. Mahddf55792014-10-16 11:29:41 -070099 [],
100 [#ifdef HAVE_SYS_SOCKET_H
101#include <sys/socket.h>
102#endif
103])
Bruce A. Mahcd81de32014-04-09 10:29:16 -0700104
Philip Prindevilled88f4ce2017-11-08 17:29:26 +0000105AC_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
ralcini3fd1a2a2017-08-14 22:43:38 +0200113if test "x$with_openssl" = "xno"; then
114 AC_MSG_WARN( [Building without OpenSSL; disabling iperf_auth functionality.] )
115else
116 # Check for OPENSSL support
hhbf7817142019-05-17 12:46:28 -0700117 havs_ssl=false
ralcini3fd1a2a2017-08-14 22:43:38 +0200118 AX_CHECK_OPENSSL(
hhbf7817142019-05-17 12:46:28 -0700119 [ AC_DEFINE([HAVE_SSL], [1], [OpenSSL Is Available])
120 have_ssl=true ],
Bruce A. Mah4a45b322017-08-15 11:13:08 -0700121 [ if test "x$with_openssl" != "x"; then
122 AC_MSG_FAILURE([--with-openssl was given, but test for OpenSSL failed])
123 fi ]
ralcini3fd1a2a2017-08-14 22:43:38 +0200124 )
hhbf7817142019-05-17 12:46:28 -0700125 if $have_ssl; then
126 LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
127 LIBS="$OPENSSL_LIBS $LIBS"
128 CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
129 fi
ralcini3fd1a2a2017-08-14 22:43:38 +0200130fi
ralcinia51045d2017-04-20 19:01:08 +0200131
Bruce A. Mah0932b662014-10-16 12:29:11 -0700132# Check for TCP_CONGESTION sockopt (believed to be Linux and FreeBSD only)
Bruce A. Mahc550ef42014-04-10 10:53:18 -0700133AC_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
Bruce A. Mah4155c452014-04-10 11:20:36 -0700145# 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
Bruce A. Mah40a1faf2014-04-14 10:45:46 -0700162# 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.
Boris Okunev5b27ea32017-11-13 23:54:34 +0300167AC_CHECK_FUNCS([cpuset_setaffinity sched_setaffinity SetProcessAffinityMask],
Bruce A. Mah40a1faf2014-04-14 10:45:46 -0700168 AC_DEFINE([HAVE_CPU_AFFINITY], [1],
169 [Have CPU affinity support.]))
170
Bruce A. Mah73b02f92017-11-11 10:12:55 -0800171# Check for daemon(). Most systems have this but a few (IRIX) don't.
172AC_CHECK_FUNCS([daemon])
173
Bruce A. Mah3f8c33c2014-04-14 14:16:07 -0700174# 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
Bruce A. Mahcb2dcd32017-11-08 10:18:30 -0800179# Check for getline support, used as a part of authenticated
180# connections.
181AC_CHECK_FUNCS([getline])
182
Bruce A. Mah99157462016-05-26 09:47:48 -0700183# 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
Ben Fox-Moorecde81d72018-05-16 23:49:45 +0200196# 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])
Bruce A. Mah99157462016-05-26 09:47:48 -0700200
Bruce A. Mahd1aab092014-10-14 13:41:48 -0700201AC_OUTPUT([Makefile src/Makefile src/version.h examples/Makefile iperf3.spec])