Bruce A. Mah | 82f25ed | 2018-02-14 13:37:58 -0800 | [diff] [blame] | 1 | # iperf, Copyright (c) 2014-2018, The Regents of the University of |
Bruce A. Mah | da9f046 | 2014-09-29 14:00:46 -0700 | [diff] [blame] | 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 | |
AaronMatthewBrown | f4a3dda | 2009-12-08 21:36:24 +0000 | [diff] [blame] | 26 | # Initialize the autoconf system for the specified tool, version and mailing list |
Bruce A. Mah | dfcea9f | 2019-06-20 18:12:47 -0700 | [diff] [blame] | 27 | AC_INIT(iperf, 3.7, https://github.com/esnet/iperf, iperf, https://software.es.net/iperf/) |
Bruce A. Mah | a026b29 | 2017-04-20 12:37:09 -0700 | [diff] [blame] | 28 | m4_include([config/ax_check_openssl.m4]) |
Bruce A. Mah | 3b60f09 | 2015-01-06 10:22:00 -0800 | [diff] [blame] | 29 | AC_LANG(C) |
AaronMatthewBrown | f4a3dda | 2009-12-08 21:36:24 +0000 | [diff] [blame] | 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. |
| 33 | AC_CONFIG_AUX_DIR(config) |
| 34 | |
| 35 | |
| 36 | # Initialize the automake system |
Hk | f64da9b | 2018-07-02 13:06:42 -0400 | [diff] [blame] | 37 | AM_INIT_AUTOMAKE([foreign]) |
Bruce A. Mah | 6edfd8d | 2014-05-02 11:32:12 -0700 | [diff] [blame] | 38 | AM_MAINTAINER_MODE |
Bruce A. Mah | 40050b7 | 2014-04-14 13:33:33 -0700 | [diff] [blame] | 39 | AM_CONFIG_HEADER(src/iperf_config.h) |
AaronMatthewBrown | f4a3dda | 2009-12-08 21:36:24 +0000 | [diff] [blame] | 40 | |
| 41 | AC_CANONICAL_HOST |
| 42 | |
| 43 | # Checks for tools: c compiler, ranlib (used for creating static libraries), |
| 44 | # symlinks and libtool |
| 45 | AC_PROG_CC |
| 46 | AC_PROG_RANLIB |
| 47 | AC_PROG_LN_S |
| 48 | AC_PROG_LIBTOOL |
| 49 | |
Bruce A. Mah | 94c0bff | 2014-05-19 15:22:08 -0700 | [diff] [blame] | 50 | # Add -Wall if we are using GCC. |
Bruce A. Mah | 8de51b5 | 2014-05-19 15:02:02 -0700 | [diff] [blame] | 51 | if test "x$GCC" = "xyes"; then |
Bruce A. Mah | 94c0bff | 2014-05-19 15:22:08 -0700 | [diff] [blame] | 52 | CFLAGS="$CFLAGS -Wall" |
Bruce A. Mah | 8de51b5 | 2014-05-19 15:02:02 -0700 | [diff] [blame] | 53 | fi |
| 54 | |
Hk | e6689a8 | 2018-06-29 19:23:41 -0400 | [diff] [blame] | 55 | # Check if profiling must be disabled |
| 56 | AC_ARG_ENABLE([profiling], |
| 57 | AS_HELP_STRING([--disable-profiling], [Disable iperf profiling binary]), |
| 58 | [:], |
| 59 | [enable_profiling=yes]) |
| 60 | AM_CONDITIONAL([ENABLE_PROFILING], [test x$enable_profiling = xyes]) |
| 61 | |
AaronMatthewBrown | f4a3dda | 2009-12-08 21:36:24 +0000 | [diff] [blame] | 62 | # Checks for header files. |
| 63 | AC_HEADER_STDC |
| 64 | |
Jon Dugan | 9286415 | 2010-09-20 21:50:12 +0000 | [diff] [blame] | 65 | # Check for systems which need -lsocket and -lnsl |
jef | 56a97f9 | 2012-08-20 14:35:58 -0700 | [diff] [blame] | 66 | #AX_LIB_SOCKET_NSL |
Jon Dugan | 9286415 | 2010-09-20 21:50:12 +0000 | [diff] [blame] | 67 | |
Bruce A. Mah | ed94082 | 2016-06-03 09:23:59 -0700 | [diff] [blame] | 68 | # Check for the math library (needed by cjson on some platforms) |
| 69 | AC_SEARCH_LIBS(floor, [m], [], [ |
| 70 | echo "floor()" |
| 71 | exit 1 |
| 72 | ]) |
| 73 | |
Ante Vojvodic | 165d10d | 2014-10-06 18:38:17 +0200 | [diff] [blame] | 74 | # On illumos we need -lsocket |
| 75 | AC_SEARCH_LIBS(socket, [socket], [], [ |
| 76 | echo "socket()" |
| 77 | exit 1 |
| 78 | ]) |
| 79 | |
| 80 | # On illumos inet_ntop in in -lnsl |
| 81 | AC_SEARCH_LIBS(inet_ntop, [nsl], [], [ |
| 82 | echo "inet_ntop()" |
| 83 | exit 1 |
| 84 | ]) |
| 85 | |
AaronMatthewBrown | f4a3dda | 2009-12-08 21:36:24 +0000 | [diff] [blame] | 86 | # Checks for typedefs, structures, and compiler characteristics. |
| 87 | AC_C_CONST |
| 88 | |
Bruce A. Mah | 9d7d60a | 2017-05-17 12:50:50 -0700 | [diff] [blame] | 89 | # Check for poll.h (it's in POSIX so everyone should have it?) |
| 90 | AC_CHECK_HEADERS([poll.h]) |
| 91 | |
Bruce A. Mah | cd81de3 | 2014-04-09 10:29:16 -0700 | [diff] [blame] | 92 | # Check for SCTP support |
Bruce A. Mah | ddf5579 | 2014-10-16 11:29:41 -0700 | [diff] [blame] | 93 | AC_CHECK_HEADERS([sys/socket.h]) |
Bruce A. Mah | cd81de3 | 2014-04-09 10:29:16 -0700 | [diff] [blame] | 94 | AC_CHECK_HEADERS([netinet/sctp.h], |
Bruce A. Mah | e142062 | 2015-01-05 15:19:57 -0800 | [diff] [blame] | 95 | AC_DEFINE([HAVE_SCTP], [1], [Have SCTP support.]) |
Bruce A. Mah | 8fb8688 | 2015-01-06 10:34:41 -0800 | [diff] [blame] | 96 | AC_SEARCH_LIBS(sctp_bindx, [sctp]) |
| 97 | AC_CHECK_TYPES([struct sctp_assoc_value], [], [], |
| 98 | [[#include <netinet/sctp.h>]]), |
Bruce A. Mah | ddf5579 | 2014-10-16 11:29:41 -0700 | [diff] [blame] | 99 | [], |
| 100 | [#ifdef HAVE_SYS_SOCKET_H |
| 101 | #include <sys/socket.h> |
| 102 | #endif |
| 103 | ]) |
Bruce A. Mah | cd81de3 | 2014-04-09 10:29:16 -0700 | [diff] [blame] | 104 | |
Philip Prindeville | d88f4ce | 2017-11-08 17:29:26 +0000 | [diff] [blame] | 105 | AC_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 | |
ralcini | 3fd1a2a | 2017-08-14 22:43:38 +0200 | [diff] [blame] | 113 | if test "x$with_openssl" = "xno"; then |
| 114 | AC_MSG_WARN( [Building without OpenSSL; disabling iperf_auth functionality.] ) |
| 115 | else |
| 116 | # Check for OPENSSL support |
hhb | f781714 | 2019-05-17 12:46:28 -0700 | [diff] [blame] | 117 | havs_ssl=false |
ralcini | 3fd1a2a | 2017-08-14 22:43:38 +0200 | [diff] [blame] | 118 | AX_CHECK_OPENSSL( |
hhb | f781714 | 2019-05-17 12:46:28 -0700 | [diff] [blame] | 119 | [ AC_DEFINE([HAVE_SSL], [1], [OpenSSL Is Available]) |
| 120 | have_ssl=true ], |
Bruce A. Mah | 4a45b32 | 2017-08-15 11:13:08 -0700 | [diff] [blame] | 121 | [ if test "x$with_openssl" != "x"; then |
| 122 | AC_MSG_FAILURE([--with-openssl was given, but test for OpenSSL failed]) |
| 123 | fi ] |
ralcini | 3fd1a2a | 2017-08-14 22:43:38 +0200 | [diff] [blame] | 124 | ) |
hhb | f781714 | 2019-05-17 12:46:28 -0700 | [diff] [blame] | 125 | if $have_ssl; then |
| 126 | LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS" |
| 127 | LIBS="$OPENSSL_LIBS $LIBS" |
| 128 | CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS" |
| 129 | fi |
ralcini | 3fd1a2a | 2017-08-14 22:43:38 +0200 | [diff] [blame] | 130 | fi |
ralcini | a51045d | 2017-04-20 19:01:08 +0200 | [diff] [blame] | 131 | |
Bruce A. Mah | 0932b66 | 2014-10-16 12:29:11 -0700 | [diff] [blame] | 132 | # Check for TCP_CONGESTION sockopt (believed to be Linux and FreeBSD only) |
Bruce A. Mah | c550ef4 | 2014-04-10 10:53:18 -0700 | [diff] [blame] | 133 | AC_CACHE_CHECK([TCP_CONGESTION socket option], |
| 134 | [iperf3_cv_header_tcp_congestion], |
| 135 | AC_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)) |
| 141 | if test "x$iperf3_cv_header_tcp_congestion" = "xyes"; then |
| 142 | AC_DEFINE([HAVE_TCP_CONGESTION], [1], [Have TCP_CONGESTION sockopt.]) |
| 143 | fi |
| 144 | |
Bruce A. Mah | 4155c45 | 2014-04-10 11:20:36 -0700 | [diff] [blame] | 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). |
| 149 | AC_CACHE_CHECK([IPv6 flowlabel support], |
| 150 | [iperf3_cv_header_flowlabel], |
| 151 | AC_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)) |
| 158 | if test "x$iperf3_cv_header_flowlabel" = "xyes"; then |
| 159 | AC_DEFINE([HAVE_FLOWLABEL], [1], [Have IPv6 flowlabel support.]) |
| 160 | fi |
| 161 | |
Bruce A. Mah | 40a1faf | 2014-04-14 10:45:46 -0700 | [diff] [blame] | 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. |
Boris Okunev | 5b27ea3 | 2017-11-13 23:54:34 +0300 | [diff] [blame] | 167 | AC_CHECK_FUNCS([cpuset_setaffinity sched_setaffinity SetProcessAffinityMask], |
Bruce A. Mah | 40a1faf | 2014-04-14 10:45:46 -0700 | [diff] [blame] | 168 | AC_DEFINE([HAVE_CPU_AFFINITY], [1], |
| 169 | [Have CPU affinity support.])) |
| 170 | |
Bruce A. Mah | 73b02f9 | 2017-11-11 10:12:55 -0800 | [diff] [blame] | 171 | # Check for daemon(). Most systems have this but a few (IRIX) don't. |
| 172 | AC_CHECK_FUNCS([daemon]) |
| 173 | |
Bruce A. Mah | 3f8c33c | 2014-04-14 14:16:07 -0700 | [diff] [blame] | 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. |
| 177 | AC_CHECK_FUNCS([sendfile]) |
| 178 | |
Bruce A. Mah | cb2dcd3 | 2017-11-08 10:18:30 -0800 | [diff] [blame] | 179 | # Check for getline support, used as a part of authenticated |
| 180 | # connections. |
| 181 | AC_CHECK_FUNCS([getline]) |
| 182 | |
Bruce A. Mah | 9915746 | 2016-05-26 09:47:48 -0700 | [diff] [blame] | 183 | # Check for packet pacing socket option (Linux only for now). |
| 184 | AC_CACHE_CHECK([SO_MAX_PACING_RATE socket option], |
| 185 | [iperf3_cv_header_so_max_pacing_rate], |
| 186 | AC_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)) |
| 192 | if 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.]) |
| 194 | fi |
| 195 | |
Ben Fox-Moore | cde81d7 | 2018-05-16 23:49:45 +0200 | [diff] [blame] | 196 | # Check if we need -lrt for clock_gettime |
| 197 | AC_SEARCH_LIBS(clock_gettime, [rt posix4]) |
| 198 | # Check for clock_gettime support |
| 199 | AC_CHECK_FUNCS([clock_gettime]) |
Bruce A. Mah | 9915746 | 2016-05-26 09:47:48 -0700 | [diff] [blame] | 200 | |
Bruce A. Mah | d1aab09 | 2014-10-14 13:41:48 -0700 | [diff] [blame] | 201 | AC_OUTPUT([Makefile src/Makefile src/version.h examples/Makefile iperf3.spec]) |