File: configure.ac

package info (click to toggle)
iperf 2.0.9%2Bdfsg1-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 2,096 kB
  • ctags: 1,023
  • sloc: ansic: 4,585; sh: 3,354; cpp: 2,768; makefile: 70
file content (306 lines) | stat: -rw-r--r-- 9,386 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
dnl ===================================================================
dnl configure.ac
dnl Process this file with autogen.sh to produce configure files
dnl ===================================================================


AC_PREREQ(2.59)
AC_INIT(Iperf,2.0.9)
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE()

dnl The end user may not have autotools
AM_MAINTAINER_MODE([disable])

m4_include([m4/ax_create_stdint_h.m4])
m4_include([m4/dast.m4])
m4_include([m4/acx_pthread.m4])

AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6],
	    [disable ipv6 support (default is autodetect)]), 
	ac_cv_have_ipv6=$enable_ipv6,)

AC_ARG_ENABLE(multicast, AC_HELP_STRING([--disable-multicast],
	    [disable multicast support (default is autodetect)]),
	ac_cv_multicast=$enable_multicast,)

AC_ARG_ENABLE(threads, AC_HELP_STRING([--disable-threads],
	    [disable thread support (default is autodetect)]))

AC_ARG_ENABLE(debuginfo, AC_HELP_STRING([--enable-debuginfo],
	    [enable debugging info for sockets (default is no)]),
	enable_debuginfo=$enableval,
	enable_debuginfo=no)

AC_ARG_ENABLE(web100, AC_HELP_STRING([--disable-web100],
	    [disable web100 support (default is autodetect)]))

AC_ARG_ENABLE(kalman, AC_HELP_STRING([--disable-kalman],
	    [disable kalman delay tuning (default is enable)]))


dnl ===================================================================
dnl Checks for programs
dnl ===================================================================

AC_PROG_CXX
CXXFLAGS=`echo " $CXXFLAGS " | sed -e "s/ -g / /"` # do not want it implicitly
AC_PROG_CC
CFLAGS=`echo " $CFLAGS " | sed -e "s/ -g / /"` # do not want it implicitly
AC_ISC_POSIX
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_LANG(C)
AC_CANONICAL_HOST

dnl ===================================================================
dnl Checks for libraries.
dnl ===================================================================
AC_CHECK_LIB([rt], [clock_gettime])

dnl check for -lpthread
 
if test "$enable_threads" != no; then
  ACX_PTHREAD()
    if test "$acx_pthread_ok" = yes; then
      AC_DEFINE([HAVE_POSIX_THREAD], 1,)
      AC_DEFINE([_REENTRANT], 1,)
    fi
fi

dnl check for -lnsl, -lsocket
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([socket], [socket], [],
  [AC_CHECK_HEADER([winsock2.h],
  [AC_DEFINE([HAVE_LIBWS2_32], [1], [Define if libws2_32 exists.])
  if test "$acx_pthread_ok" != yes; then
  AC_DEFINE([HAVE_WIN32_THREAD], [1], [Define if using WIN32 threads])
  fi
  LIBS="-lws2_32 $LIBS"],
  [],
  [#include <windows.h>])])
 
dnl Checks for header files.
AC_HEADER_STDC
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 signal.h])

dnl ===================================================================
dnl Checks for typedefs, structures
dnl ===================================================================

AC_C_CONST
AC_TYPE_SIZE_T
AC_CHECK_TYPES(ssize_t,,AC_DEFINE_UNQUOTED(ssize_t, int))
AC_HEADER_TIME
AC_STRUCT_TM

dnl these intXX_t and u_intXX_t need to be defined to be the right size.
AX_CREATE_STDINT_H(include/iperf-int.h)

AC_CACHE_CHECK(3rd argument of accept, ac_cv_accept_arg, [
  dnl Try socklen_t (POSIX)
  DAST_ACCEPT_ARG(socklen_t)

  dnl Try int (original BSD)
  DAST_ACCEPT_ARG(int)

  dnl Try size_t (older standard; AIX)
  DAST_ACCEPT_ARG(size_t)

  dnl Try short (shouldn't be)
  DAST_ACCEPT_ARG(short)

  dnl Try long (shouldn't be)
  DAST_ACCEPT_ARG(long)
])

if test -z "$ac_cv_accept_arg" ; then
  ac_cv_accept_arg=int
fi

AC_DEFINE_UNQUOTED([Socklen_t], $ac_cv_accept_arg, [Define 3rd arg of accept])

dnl Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MEMCMP
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([atexit memset pthread_cancel select strchr strerror strtol usleep clock_gettime sched_setscheduler mlockall setitimer nanosleep])
AC_REPLACE_FUNCS(snprintf inet_pton inet_ntop gettimeofday)
AC_CHECK_DECLS([ENOBUFS, EWOULDBLOCK],[],[],[#include <errno.h>])
AC_CHECK_DECLS([SO_TIMESTAMP, SO_SNDTIMEO],[],[],[#include <sys/socket.h>])
AC_CHECK_DECLS([CPU_SET],[],[],[
	#define _GNU_SOURCE
	#include <sched.h>
	])
AC_CHECK_DECLS([SIGALRM],[],[],[#include <signal.h>])
AC_CHECK_MEMBERS([struct tcp_info.tcpi_total_retrans],[],[],
			 [#include <netinet/tcp.h>])


dnl             Gotten from some NetBSD configure.in
dnl		We assume that if sprintf() supports %lld or %qd,
dnl		then all of *printf() does. If not, disable long long
dnl		support because we don't know how to display it.

AH_TEMPLATE(HAVE_QUAD_SUPPORT)
AH_TEMPLATE(HAVE_PRINTF_QD)

AC_MSG_CHECKING(*printf() support for %lld)
can_printf_longlong=no
AC_TRY_RUN([
        #include <stdio.h>
        int main() {
                char buf[100];
                sprintf(buf, "%lld", 21726587590LL);
                return (strcmp(buf, "21726587590"));
        }
        ], [
        AC_MSG_RESULT(yes)
        can_printf_longlong=yes
        ], [
        AC_MSG_RESULT(no)
        ], [ : ])

if test $can_printf_longlong != yes; then
        AC_MSG_CHECKING(*printf() support for %qd)
        AC_TRY_RUN([
                #include <stdio.h>
                int main() {
                        char buf[100];
                        sprintf(buf, "%qd", 21726587590LL);
                        return (strcmp(buf, "21726587590"));
                }
                ], [
                AC_MSG_RESULT(yes)
                can_printf_longlong=yes
                AC_DEFINE(HAVE_PRINTF_QD, 1)
                ], [
                AC_MSG_RESULT(no)
                ], [ : ])
fi

if test $can_printf_longlong = yes; then
        AC_DEFINE(HAVE_QUAD_SUPPORT, 1)
fi

dnl ===================================================================
dnl Check for compiler characteristics

DAST_CHECK_BOOL

AC_C_BIGENDIAN

dnl ===================================================================
dnl Check for system services

dnl check for multicast
if test "$ac_cv_multicast" != no; then
  AC_CHECK_TYPES(struct ip_mreq,,,[#include "compat/headers_slim.h"])
  AC_CHECK_DECLS(IP_ADD_MEMBERSHIP,,,[#include "compat/headers_slim.h"])
  AC_MSG_CHECKING(for multicast support)
  ac_cv_multicast=no
  if test "$ac_cv_have_decl_IP_ADD_MEMBERSHIP" = yes; then
    if test "$ac_cv_type_struct_ip_mreq" = yes; then
      ac_cv_multicast=yes
    fi
  fi
  AC_MSG_RESULT($ac_cv_multicast)
  if test "$ac_cv_multicast" = yes; then
    AC_DEFINE([HAVE_MULTICAST], 1, [Define to enable multicast support])
  fi
fi

dnl check for IPv6
if test "$ac_cv_have_ipv6" != no; then
  AC_CHECK_TYPES(struct sockaddr_storage,,,[#include "compat/headers_slim.h"])
  AC_CHECK_TYPES(struct sockaddr_in6,,,[#include "compat/headers_slim.h"])
  AC_CHECK_DECLS(AF_INET6,,,[#include "compat/headers_slim.h"])
  AC_MSG_CHECKING(for IPv6 headers and structures)
  ac_cv_have_ipv6=no
  if test "$ac_cv_type_struct_sockaddr_storage" = yes; then
    if test "$ac_cv_type_struct_sockaddr_in6" = yes; then
      if test "$ac_cv_have_decl_AF_INET6" = yes; then
        AC_DEFINE([HAVE_IPV6], 1, [Define to enable IPv6 support])
        ac_cv_have_ipv6=yes
      fi
    fi
  fi
  AC_MSG_RESULT($ac_cv_have_ipv6)
fi

if test "$ac_cv_have_ipv6" = yes; then
  if test "$ac_cv_multicast" = yes; then
    AC_CHECK_TYPES(struct ipv6_mreq,,,[#include "compat/headers_slim.h"])
    AC_CHECK_DECLS(IPV6_ADD_MEMBERSHIP,,,[#include "compat/headers_slim.h"])
    AC_CHECK_DECLS(IPV6_MULTICAST_HOPS,,,[#include "compat/headers_slim.h"])
    AC_MSG_CHECKING(for IPv6 multicast support)
    ac_cv_have_ipv6_multicast=no
    if test "$ac_cv_type_struct_ipv6_mreq" = yes; then
      if test "$ac_cv_have_decl_IPV6_ADD_MEMBERSHIP" = yes; then
        if test "$ac_cv_have_decl_IPV6_MULTICAST_HOPS" = yes; then
          AC_DEFINE([HAVE_IPV6_MULTICAST], 1, [Define to enable IPv6 multicast support])
          ac_cv_have_ipv6_multicast=yes
        fi
      fi
    fi
    AC_MSG_RESULT($ac_cv_have_ipv6_multicast)
  fi
fi

if test "$enable_debuginfo" = yes; then
AC_DEFINE([DBG_MJZ], 1, [Define if debugging info is desired])
fi

if test "$enable_web100" != no; then
if test -e "/proc/web100"; then
if test -d "/proc/web100"; then
if test -e "/proc/web100/header"; then
if test -f "/proc/web100/header"; then
if test -r "/proc/web100/header"; then
AM_PATH_WEB100()
if test "$web100_success" = yes; then 
AC_DEFINE([HAVE_WEB100], 1, [Define if Web100 is desired and available])
fi fi fi fi fi fi
fi

if test "$enable_kalman" != no; then
AC_DEFINE([HAVE_KALMAN], 1, [Define if Kalman tuning is desired and available])
fi

dnl Static link on MINGW for standalone DOS executable
case "$ac_cv_host" in
*-mingw32) 
    LIBS="$LIBS -static-libstdc++ -static";;
esac


dnl GNU make allows us to use the $(strip ...) builtin which eliminates a
dnl large amount of extra whitespace in compile lines.
AC_MSG_CHECKING(whether make is GNU make)
STRIP_BEGIN=
STRIP_END=
if $ac_make --version 2> /dev/null | grep '^GNU Make ' > /dev/null ; then
    STRIP_BEGIN='$(strip $(STRIP_DUMMY)'
    STRIP_END=')'
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi

dnl some Make 3.79 $(strip ) versions are broken and require an empty arg
STRIP_DUMMY=
AC_SUBST(STRIP_DUMMY)
AC_SUBST(STRIP_BEGIN)
AC_SUBST(STRIP_END)

AC_CONFIG_FILES([Makefile
		compat/Makefile
		doc/Makefile
		include/Makefile
		src/Makefile
                man/Makefile])
AC_OUTPUT