1 dnl ===================================================================
3 dnl Process this file with autogen.sh to produce configure files
4 dnl ===================================================================
9 AC_CONFIG_HEADER([config.h])
13 AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6],
14 [disable ipv6 support (default is autodetect)]),
15 ac_cv_have_ipv6=$enable_ipv6,)
17 AC_ARG_ENABLE(multicast, AC_HELP_STRING([--disable-multicast],
18 [disable multicast support (default is autodetect)]),
19 ac_cv_multicast=$enable_multicast,)
21 AC_ARG_ENABLE(threads, AC_HELP_STRING([--disable-threads],
22 [disable thread support (default is autodetect)]))
24 AC_ARG_ENABLE(debuginfo, AC_HELP_STRING([--enable-debuginfo],
25 [enable debugging info for sockets (default is no)]),
26 enable_debuginfo=$enableval,
29 AC_ARG_ENABLE(web100, AC_HELP_STRING([--disable-web100],
30 [disable web100 support (default is autodetect)]))
33 dnl ===================================================================
34 dnl Checks for programs
35 dnl ===================================================================
38 CXXFLAGS=`echo " $CXXFLAGS " | sed -e "s/ -g / /"` # do not want it implicitly
40 CFLAGS=`echo " $CFLAGS " | sed -e "s/ -g / /"` # do not want it implicitly
48 dnl ===================================================================
49 dnl Checks for libraries.
50 dnl ===================================================================
52 dnl check for -lpthread
54 if test "$enable_threads" != no; then
56 if test "$acx_pthread_ok" = yes; then
57 AC_DEFINE([HAVE_POSIX_THREAD], 1,)
58 AC_DEFINE([_REENTRANT], 1,)
62 dnl check for -lnsl, -lsocket
63 AC_CHECK_FUNC(gethostbyname,,AC_CHECK_LIB(nsl, gethostbyname))
64 AC_CHECK_FUNC(socket,,AC_CHECK_LIB(socket, socket))
66 dnl Checks for header files.
68 AC_CHECK_HEADERS([arpa/inet.h libintl.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h syslog.h unistd.h])
70 dnl ===================================================================
71 dnl Checks for typedefs, structures
72 dnl ===================================================================
76 AC_CHECK_TYPES(ssize_t,,AC_DEFINE_UNQUOTED(ssize_t, int))
80 dnl these intXX_t and u_intXX_t need to be defined to be the right size.
81 AX_CREATE_STDINT_H(include/iperf-int.h)
83 AC_CACHE_CHECK(3rd argument of accept, ac_cv_accept_arg, [
84 dnl Try socklen_t (POSIX)
85 DAST_ACCEPT_ARG(socklen_t)
87 dnl Try int (original BSD)
90 dnl Try size_t (older standard; AIX)
91 DAST_ACCEPT_ARG(size_t)
93 dnl Try short (shouldn't be)
94 DAST_ACCEPT_ARG(short)
96 dnl Try long (shouldn't be)
100 if test -z "$ac_cv_accept_arg" ; then
104 AC_DEFINE_UNQUOTED([Socklen_t], $ac_cv_accept_arg, [Define 3rd arg of accept])
106 dnl Checks for library functions.
110 AC_FUNC_SELECT_ARGTYPES
114 AC_CHECK_FUNCS([atexit gettimeofday memset pthread_cancel select strchr strerror strtol usleep])
115 AC_REPLACE_FUNCS(snprintf inet_pton inet_ntop gettimeofday)
117 dnl Gotten from some NetBSD configure.in
118 dnl We assume that if sprintf() supports %lld or %qd,
119 dnl then all of *printf() does. If not, disable long long
120 dnl support because we don't know how to display it.
122 AH_TEMPLATE(HAVE_QUAD_SUPPORT)
123 AH_TEMPLATE(HAVE_PRINTF_QD)
125 AC_MSG_CHECKING(*printf() support for %lld)
126 can_printf_longlong=no
131 sprintf(buf, "%lld", 21726587590LL);
132 return (strcmp(buf, "21726587590"));
136 can_printf_longlong=yes
141 if test $can_printf_longlong != yes; then
142 AC_MSG_CHECKING(*printf() support for %qd)
147 sprintf(buf, "%qd", 21726587590LL);
148 return (strcmp(buf, "21726587590"));
152 can_printf_longlong=yes
153 AC_DEFINE(HAVE_PRINTF_QD, 1)
159 if test $can_printf_longlong = yes; then
160 AC_DEFINE(HAVE_QUAD_SUPPORT, 1)
163 dnl ===================================================================
164 dnl Check for compiler characteristics
170 dnl ===================================================================
171 dnl Check for system services
173 dnl check for multicast
174 if test "$ac_cv_multicast" != no; then
175 AC_CHECK_TYPES(struct ip_mreq,,,[#include "compat/headers_slim.h"])
176 AC_CHECK_DECLS(IP_ADD_MEMBERSHIP,,,[#include "compat/headers_slim.h"])
177 AC_MSG_CHECKING(for multicast support)
179 if test "$ac_cv_have_decl_IP_ADD_MEMBERSHIP" = yes; then
180 if test "$ac_cv_type_struct_ip_mreq" = yes; then
184 AC_MSG_RESULT($ac_cv_multicast)
185 if test "$ac_cv_multicast" = yes; then
186 AC_DEFINE([HAVE_MULTICAST], 1, [Define to enable multicast support])
191 if test "$ac_cv_have_ipv6" != no; then
192 AC_CHECK_TYPES(struct sockaddr_storage,,,[#include "compat/headers_slim.h"])
193 AC_CHECK_TYPES(struct sockaddr_in6,,,[#include "compat/headers_slim.h"])
194 AC_CHECK_DECLS(AF_INET6,,,[#include "compat/headers_slim.h"])
195 AC_MSG_CHECKING(for IPv6 headers and structures)
197 if test "$ac_cv_type_struct_sockaddr_storage" = yes; then
198 if test "$ac_cv_type_struct_sockaddr_in6" = yes; then
199 if test "$ac_cv_have_decl_AF_INET6" = yes; then
200 AC_DEFINE([HAVE_IPV6], 1, [Define to enable IPv6 support])
205 AC_MSG_RESULT($ac_cv_have_ipv6)
208 if test "$ac_cv_have_ipv6" = yes; then
209 if test "$ac_cv_multicast" = yes; then
210 AC_CHECK_TYPES(struct ipv6_mreq,,,[#include "compat/headers_slim.h"])
211 AC_CHECK_DECLS(IPV6_ADD_MEMBERSHIP,,,[#include "compat/headers_slim.h"])
212 AC_CHECK_DECLS(IPV6_MULTICAST_HOPS,,,[#include "compat/headers_slim.h"])
213 AC_MSG_CHECKING(for IPv6 multicast support)
214 ac_cv_have_ipv6_multicast=no
215 if test "$ac_cv_type_struct_ipv6_mreq" = yes; then
216 if test "$ac_cv_have_decl_IPV6_ADD_MEMBERSHIP" = yes; then
217 if test "$ac_cv_have_decl_IPV6_MULTICAST_HOPS" = yes; then
218 AC_DEFINE([HAVE_IPV6_MULTICAST], 1, [Define to enable IPv6 multicast support])
219 ac_cv_have_ipv6_multicast=yes
223 AC_MSG_RESULT($ac_cv_have_ipv6_multicast)
227 if test "$enable_debuginfo" = yes; then
228 AC_DEFINE([DBG_MJZ], 1, [Define if debugging info is desired])
231 if test "$enable_web100" != no; then
232 if test -e "/proc/web100"; then
233 if test -d "/proc/web100"; then
234 if test -e "/proc/web100/header"; then
235 if test -f "/proc/web100/header"; then
236 if test -r "/proc/web100/header"; then
238 if test "$web100_success" = yes; then
239 AC_DEFINE([HAVE_WEB100], 1, [Define if Web100 is desired and available])
243 dnl GNU make allows us to use the $(strip ...) builtin which eliminates a
244 dnl large amount of extra whitespace in compile lines.
245 AC_MSG_CHECKING(whether make is GNU make)
248 if $ac_make --version 2> /dev/null | grep '^GNU Make ' > /dev/null ; then
249 STRIP_BEGIN='$(strip $(STRIP_DUMMY)'
256 dnl some Make 3.79 $(strip ) versions are broken and require an empty arg
258 AC_SUBST(STRIP_DUMMY)
259 AC_SUBST(STRIP_BEGIN)
262 AC_CONFIG_FILES([Makefile