Annotation of embedaddon/iperf/configure.ac, revision 1.1.1.3

1.1.1.3 ! misho       1: # iperf, Copyright (c) 2014-2022, The Regents of the University of
1.1       misho       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
1.1.1.3 ! misho      27: AC_PREREQ([2.71])
        !            28: AC_INIT([iperf],[3.15],[https://github.com/esnet/iperf],[iperf],[https://software.es.net/iperf/])
1.1.1.2   misho      29: m4_include([config/ax_check_openssl.m4])
                     30: m4_include([config/iperf_config_static_bin.m4])
1.1       misho      31: AC_LANG(C)
                     32: 
                     33: # Specify where the auxiliary files created by configure should go. The config
                     34: # directory is picked so that they don't clutter up more useful directories.
                     35: AC_CONFIG_AUX_DIR(config)
                     36: 
                     37: 
                     38: # Initialize the automake system
1.1.1.2   misho      39: AM_INIT_AUTOMAKE([foreign])
                     40: m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
                     41: LT_INIT
                     42: 
1.1       misho      43: AM_MAINTAINER_MODE
1.1.1.3 ! misho      44: AC_CONFIG_HEADERS(src/iperf_config.h)
1.1       misho      45: 
                     46: AC_CANONICAL_HOST
                     47: 
                     48: # Checks for tools: c compiler, ranlib (used for creating static libraries),
                     49: # symlinks and libtool
                     50: AC_PROG_CC
                     51: AC_PROG_RANLIB
                     52: AC_PROG_LN_S
1.1.1.3 ! misho      53: LT_INIT
1.1       misho      54: 
                     55: # Add -Wall if we are using GCC.
                     56: if test "x$GCC" = "xyes"; then
                     57:   CFLAGS="$CFLAGS -Wall"
                     58: fi
                     59: 
1.1.1.2   misho      60: # Check if enable profiling
                     61: AC_ARG_ENABLE([profiling],
                     62:     AS_HELP_STRING([--enable-profiling], [Enable iperf3 profiling binary]))
                     63: AM_CONDITIONAL([ENABLE_PROFILING], [test x$enable_profiling = xyes])
                     64: 
1.1       misho      65: # Check for the math library (needed by cjson on some platforms)
                     66: AC_SEARCH_LIBS(floor, [m], [], [
                     67: echo "floor()"
                     68: exit 1
                     69: ])
                     70: 
                     71: # On illumos we need -lsocket
                     72: AC_SEARCH_LIBS(socket, [socket], [], [
                     73: echo "socket()"
                     74: exit 1
                     75: ])
                     76: 
                     77: # On illumos inet_ntop in in -lnsl
                     78: AC_SEARCH_LIBS(inet_ntop, [nsl], [], [
                     79: echo "inet_ntop()"
                     80: exit 1
                     81: ])
                     82: 
                     83: # Checks for typedefs, structures, and compiler characteristics.
                     84: AC_C_CONST
                     85: 
1.1.1.2   misho      86: # Check for poll.h (it's in POSIX so everyone should have it?)
                     87: AC_CHECK_HEADERS([poll.h])
                     88: 
                     89: # SCTP.  Allow user to disable SCTP support with --without-sctp.
                     90: # Otherwise we try to find whatever support is required.
                     91: try_sctp=true
                     92: AC_ARG_WITH([sctp],
                     93:     [AS_HELP_STRING([--without-sctp],
                     94:         [disable SCTP])],
                     95:     [
                     96:         case "$withval" in
                     97:        y | ye | yes)
                     98:          ;;
                     99:        n | no)
                    100:        try_sctp=false
                    101:          ;;
                    102:        *)
                    103:        AC_MSG_ERROR([Invalid --with-sctp value])
                    104:          ;;
                    105:        esac
                    106:     ], [
                    107:         try_sctp=true
                    108:     ]
                    109: )
                    110: 
1.1.1.3 ! misho     111: AC_CHECK_HEADERS([linux/tcp.h])
        !           112: 
1.1       misho     113: # Check for SCTP support
1.1.1.2   misho     114: if $try_sctp; then
1.1       misho     115: AC_CHECK_HEADERS([sys/socket.h])
                    116: AC_CHECK_HEADERS([netinet/sctp.h],
1.1.1.2   misho     117:                 AC_DEFINE([HAVE_SCTP_H], [1], [Have SCTP support.])
1.1       misho     118:                 AC_SEARCH_LIBS(sctp_bindx, [sctp])
                    119:                 AC_CHECK_TYPES([struct sctp_assoc_value], [], [],
                    120:                                [[#include <netinet/sctp.h>]]),
                    121:                 [],
                    122:                 [#ifdef HAVE_SYS_SOCKET_H
                    123: #include <sys/socket.h>
                    124: #endif
                    125: ])
1.1.1.2   misho     126: fi
                    127: 
                    128: AC_CHECK_HEADER([endian.h],
                    129:                AC_DEFINE([HAVE_ENDIAN_H], [1], [Define to 1 if you have the <endian.h> header file.]),
                    130:                AC_CHECK_HEADER([sys/endian.h],
                    131:                                AC_DEFINE([HAVE_SYS_ENDIAN_H], [1], [Define to 1 if you have the <sys/endian.h> header file.]),
                    132:                                AC_MSG_WARN([Couldn't find endian.h or sys/endian.h files: doing compile-time tests.])
                    133:                                )
                    134:                )
                    135: 
                    136: if test "x$with_openssl" = "xno"; then
                    137:     AC_MSG_WARN( [Building without OpenSSL; disabling iperf_auth functionality.] )
                    138: else
                    139:     # Check for OPENSSL support
                    140:     havs_ssl=false
                    141:     AX_CHECK_OPENSSL(
                    142:         [ AC_DEFINE([HAVE_SSL], [1], [OpenSSL Is Available])
                    143:           have_ssl=true ],
                    144:        [ if test "x$with_openssl" != "x"; then
                    145:          AC_MSG_FAILURE([--with-openssl was given, but test for OpenSSL failed])
                    146:          fi ]
                    147:     )
                    148:     if $have_ssl; then
                    149:         case $host in
                    150:            *-*-cygwin)
                    151:              CFLAGS="$CFLAGS -DNOCRYPT"
                    152:              ;;
                    153:         esac
                    154:         LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
                    155:         LIBS="$OPENSSL_LIBS $LIBS"
                    156:         CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
                    157:     fi
                    158: fi
1.1       misho     159: 
                    160: # Check for TCP_CONGESTION sockopt (believed to be Linux and FreeBSD only)
                    161: AC_CACHE_CHECK([TCP_CONGESTION socket option],
                    162: [iperf3_cv_header_tcp_congestion],
1.1.1.3 ! misho     163: AC_COMPILE_IFELSE(
        !           164:   [AC_LANG_PROGRAM([[#include <netinet/tcp.h>]],
        !           165:                    [[int foo = TCP_CONGESTION;]])],
        !           166:   iperf3_cv_header_tcp_congestion=yes,
        !           167:   iperf3_cv_header_tcp_congestion=no))
1.1       misho     168: if test "x$iperf3_cv_header_tcp_congestion" = "xyes"; then
                    169:     AC_DEFINE([HAVE_TCP_CONGESTION], [1], [Have TCP_CONGESTION sockopt.])
                    170: fi
                    171: 
1.1.1.3 ! misho     172: # Check for TCP_USER_TIMEOUT sockopt (believed to be Linux 2.6.37+ only)
        !           173: AC_CACHE_CHECK([TCP_USER_TIMEOUT socket option],
        !           174: [iperf3_cv_header_tcp_user_timeout],
        !           175: AC_COMPILE_IFELSE(
        !           176:   [AC_LANG_PROGRAM([[#include <netinet/tcp.h>]],
        !           177:                    [[int foo = TCP_USER_TIMEOUT;]])],
        !           178:   iperf3_cv_header_tcp_user_timeout=yes,
        !           179:   iperf3_cv_header_tcp_user_timeout=no))
        !           180: if test "x$iperf3_cv_header_tcp_user_timeout" = "xyes"; then
        !           181:     AC_DEFINE([HAVE_TCP_USER_TIMEOUT], [1], [Have TCP_USER_TIMEOUT sockopt.])
        !           182: fi
        !           183: 
1.1       misho     184: # Check for IPv6 flowlabel support (believed to be Linux only)
                    185: # We check for IPV6_FLOWLABEL_MGR in <linux/in6.h> even though we
                    186: # don't use that file directly (we have our own stripped-down
                    187: # copy, see src/flowlabel.h for more details).
                    188: AC_CACHE_CHECK([IPv6 flowlabel support],
                    189: [iperf3_cv_header_flowlabel],
1.1.1.3 ! misho     190: AC_COMPILE_IFELSE(
        !           191:   [AC_LANG_PROGRAM([[#include <sys/types.h>
        !           192:                      #include <linux/in6.h>]],
        !           193:                    [[int foo = IPV6_FLOWLABEL_MGR;]])],
        !           194:   iperf3_cv_header_flowlabel=yes,
        !           195:   iperf3_cv_header_flowlabel=no))
1.1       misho     196: if test "x$iperf3_cv_header_flowlabel" = "xyes"; then
                    197:     AC_DEFINE([HAVE_FLOWLABEL], [1], [Have IPv6 flowlabel support.])
                    198: fi
                    199: 
                    200: # Check for CPU affinity support.  FreeBSD and Linux do this differently
                    201: # unfortunately so we have to check separately for each of them.
                    202: # FreeBSD uses cpuset_setaffinity while Linux uses sched_setaffinity.
                    203: # Define HAVE_CPU_AFFINITY to indicate the CPU affinity setting as a
                    204: # generic concept is available.
1.1.1.2   misho     205: AC_CHECK_FUNCS([cpuset_setaffinity sched_setaffinity SetProcessAffinityMask],
1.1       misho     206:               AC_DEFINE([HAVE_CPU_AFFINITY], [1], 
                    207:                         [Have CPU affinity support.]))
                    208: 
1.1.1.2   misho     209: # Check for daemon().  Most systems have this but a few (IRIX) don't.
                    210: AC_CHECK_FUNCS([daemon])
                    211: 
1.1       misho     212: # Check for sendfile support.  FreeBSD, Linux, and MacOS all support
                    213: # this system call, but they're all different in terms of what headers
                    214: # it needs and what arguments it expects.
                    215: AC_CHECK_FUNCS([sendfile])
                    216: 
1.1.1.2   misho     217: # Check for getline support, used as a part of authenticated
                    218: # connections.
                    219: AC_CHECK_FUNCS([getline])
                    220: 
1.1       misho     221: # Check for packet pacing socket option (Linux only for now).
                    222: AC_CACHE_CHECK([SO_MAX_PACING_RATE socket option],
                    223: [iperf3_cv_header_so_max_pacing_rate],
1.1.1.3 ! misho     224: AC_COMPILE_IFELSE(
        !           225:   [AC_LANG_PROGRAM([[#include <sys/socket.h>]],
        !           226:                    [[int foo = SO_MAX_PACING_RATE;]])],
        !           227:   iperf3_cv_header_so_max_pacing_rate=yes,
        !           228:   iperf3_cv_header_so_max_pacing_rate=no))
1.1       misho     229: if test "x$iperf3_cv_header_so_max_pacing_rate" = "xyes"; then
                    230:     AC_DEFINE([HAVE_SO_MAX_PACING_RATE], [1], [Have SO_MAX_PACING_RATE sockopt.])
                    231: fi
                    232: 
1.1.1.3 ! misho     233: # Check for SO_BINDTODEVICE sockopt (believed to be Linux only)
        !           234: AC_CACHE_CHECK([SO_BINDTODEVICE socket option],
        !           235: [iperf3_cv_header_so_bindtodevice],
        !           236: AC_COMPILE_IFELSE(
        !           237:   [AC_LANG_PROGRAM([[#include <sys/socket.h>]],
        !           238:                    [[int foo = SO_BINDTODEVICE;]])],
        !           239:   iperf3_cv_header_so_bindtodevice=yes,
        !           240:   iperf3_cv_header_so_bindtodevice=no))
        !           241: if test "x$iperf3_cv_header_so_bindtodevice" = "xyes"; then
        !           242:     AC_DEFINE([HAVE_SO_BINDTODEVICE], [1], [Have SO_BINDTODEVICE sockopt.])
        !           243: fi
        !           244: 
        !           245: # Check for IP_MTU_DISCOVER (mostly on Linux)
        !           246: AC_CACHE_CHECK([IP_MTU_DISCOVER socket option],
        !           247: [iperf3_cv_header_ip_mtu_discover],
        !           248: AC_COMPILE_IFELSE(
        !           249:   [AC_LANG_PROGRAM([[#include <sys/types.h>
        !           250:                      #include <sys/socket.h>
        !           251:                      #include <netinet/in.h>]],
        !           252:                    [[int foo = IP_MTU_DISCOVER;]])],
        !           253:   iperf3_cv_header_ip_mtu_discover=yes,
        !           254:   iperf3_cv_header_ip_mtu_discover=no))
        !           255: if test "x$iperf3_cv_header_ip_mtu_discover" = "xyes"; then
        !           256:     AC_DEFINE([HAVE_IP_MTU_DISCOVER], [1], [Have IP_MTU_DISCOVER sockopt.])
        !           257: fi
        !           258: 
        !           259: # Check for IP_DONTFRAG (BSD?)
        !           260: AC_CACHE_CHECK([IP_DONTFRAG socket option],
        !           261: [iperf3_cv_header_ip_dontfrag],
        !           262: AC_COMPILE_IFELSE(
        !           263:   [AC_LANG_PROGRAM([[#include <sys/types.h>
        !           264:                      #include <sys/socket.h>
        !           265:                      #include <netinet/in.h>]],
        !           266:                    [[int foo = IP_DONTFRAG;]])],
        !           267:   iperf3_cv_header_ip_dontfrag=yes,
        !           268:   iperf3_cv_header_ip_dontfrag=no))
        !           269: if test "x$iperf3_cv_header_ip_dontfrag" = "xyes"; then
        !           270:     AC_DEFINE([HAVE_IP_DONTFRAG], [1], [Have IP_DONTFRAG sockopt.])
        !           271: fi
        !           272: 
        !           273: # Check for IP_DONTFRAGMENT (Windows?)
        !           274: AC_CACHE_CHECK([IP_DONTFRAGMENT socket option],
        !           275: [iperf3_cv_header_ip_dontfragment],
        !           276: AC_COMPILE_IFELSE(
        !           277:   [AC_LANG_PROGRAM([[#include <sys/types.h>
        !           278:                      #include <sys/socket.h>
        !           279:                      #include <netinet/in.h>]],
        !           280:                    [[int foo = IP_DONTFRAGMENT;]])],
        !           281:   iperf3_cv_header_ip_dontfragment=yes,
        !           282:   iperf3_cv_header_ip_dontfragment=no))
        !           283: if test "x$iperf3_cv_header_ip_dontfragment" = "xyes"; then
        !           284:     AC_DEFINE([HAVE_IP_DONTFRAGMENT], [1], [Have IP_DONTFRAGMENT sockopt.])
        !           285: fi
        !           286: 
        !           287: # Check for IP DF support
        !           288: AC_CACHE_CHECK([any kind of DF socket option],
        !           289: [iperf3_cv_header_dontfragment],
        !           290: [if test "x$iperf3_cv_header_ip_mtu_discover" = "xyes" -o "x$iperf3_cv_header_ip_dontfrag" = "xyes" -o "x$iperf3_cv_header_ip_dontfragment" = "xyes"; then
        !           291:   iperf3_cv_header_dontfragment=yes
        !           292: else
        !           293:   iperf3_cv_header_dontfragment=no
        !           294: fi])
        !           295: 
        !           296: if test "x$iperf3_cv_header_dontfragment" = "xyes"; then
        !           297:     AC_DEFINE([HAVE_DONT_FRAGMENT], [1], [Have IP_MTU_DISCOVER/IP_DONTFRAG/IP_DONTFRAGMENT sockopt.])
        !           298: fi
        !           299: 
        !           300: #
        !           301: # Check for tcpi_snd_wnd in struct tcp_info
        !           302: #
        !           303: AC_CHECK_MEMBER([struct tcp_info.tcpi_snd_wnd],
        !           304: [iperf3_cv_header_tcp_info_snd_wnd=yes], [iperf3_cv_header_tcp_info_snd_wnd=no],
        !           305: [#ifdef HAVE_LINUX_TCP_H
        !           306: #include <linux/tcp.h>
        !           307: #else
        !           308: #include <sys/types.h>
        !           309: #include <netinet/tcp.h>
        !           310: #endif
        !           311: ])
        !           312: 
        !           313: if test "x$iperf3_cv_header_tcp_info_snd_wnd" = "xyes"; then
        !           314:   AC_DEFINE([HAVE_TCP_INFO_SND_WND], [1], [Have tcpi_snd_wnd field in tcp_info.])
        !           315: fi
        !           316: 
1.1.1.2   misho     317: # Check if we need -lrt for clock_gettime
                    318: AC_SEARCH_LIBS(clock_gettime, [rt posix4])
                    319: # Check for clock_gettime support
                    320: AC_CHECK_FUNCS([clock_gettime])
1.1       misho     321: 
1.1.1.3 ! misho     322: AC_CONFIG_FILES([Makefile src/Makefile src/version.h examples/Makefile iperf3.spec])
        !           323: AC_OUTPUT

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>