1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4FULL-PACKAGE-NAME=netperf
5VERSION=2.7.0
6BUG-REPORT-ADDRESS=netperf-feedback@netperf.org
7
8AC_PREREQ(2.59)
9AC_INIT(netperf, 2.7.0)
10
11# Inherit compiler flags from the environment...
12CFLAGS="${CFLAGS:=}"
13CXXFLAGS="${CXXFLAGS:=}"
14
15# use the target version rather than host - one day we may want cross-compile
16AC_CANONICAL_TARGET
17AC_CONFIG_SRCDIR([src/hist.h])
18AM_INIT_AUTOMAKE([dist-zip])
19AM_CONFIG_HEADER(config.h)
20# AC_CONFIG_HEADER(config.h)
21
22AC_CONFIG_LIBOBJ_DIR(src/missing)
23
24# make sure we build netperf_version.h
25touch  ${ac_top_srcdir}src/netperf_version.h.in
26
27# Checks for programs.
28AC_PROG_CC
29AC_PROG_RANLIB
30
31AC_C_CONST
32
33# Checks for libraries.
34AC_HAVE_LIBRARY(m)
35
36# Checks for header files.
37AC_HEADER_STDC
38AC_HEADER_SYS_WAIT
39
40# lets keep this in some semblence of alphabetical order
41AC_CHECK_HEADERS([arpa/inet.h endian.h errno.h fcntl.h ifaddrs.h limits.h linux/tcp.h linux/socket.h malloc.h netdb.h netinet/in.h netinet/sctp.h sched.h signal.h stdlib.h string.h strings.h syscall.h sys/ioctl.h sys/mman.h sys/param.h sys/socket.h sys/stat.h sys/time.h sys/wait.h sys/ipc.h sys/sockio.h sys/sysinfo.h sys/wait.h stdlib.h unistd.h netinet/in_systm.h netinet/ip.h])
42
43# Some platforms require these.  There may be a better way.
44AC_HAVE_LIBRARY(socket)
45if test "$ac_cv_lib_socket_main" = yes ; then
46    AC_HAVE_LIBRARY(nsl)
47    AC_HAVE_LIBRARY(sendfile)
48    AC_SYS_LARGEFILE
49fi
50
51# this one is for Tru64 and bind_to_cpu_id
52AC_HAVE_LIBRARY(mach)
53
54# Checks for typedefs, structures, and compiler characteristics.
55AC_C_CONST
56AC_TYPE_OFF_T
57AC_TYPE_SIZE_T
58# AC_TYPE_SOCKLEN_T
59
60OLD_TYPE_SOCKLEN_T
61
62# AC_TYPE_IN_PORT_T
63AC_DECL_H_ERRNO
64AC_STRUCT_SOCKADDR_STORAGE
65AC_HEADER_TIME
66AC_HEADER_STDBOOL
67AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
68
69# Checks for library functions.
70# AC_FUNC_ERROR_AT_LINE
71AC_FUNC_FORK
72# AC_FUNC_MALLOC
73AC_FUNC_MMAP
74AC_FUNC_SELECT_ARGTYPES
75AC_FUNC_SETPGRP
76AC_TYPE_SIGNAL
77# AC_FUNC_STAT
78# remove pstat_getdynamic (at least for now) since we don't do
79# anything conditional with the check anyway...
80AC_CHECK_FUNCS([alarm bzero daemon gethostbyname gethrtime gettimeofday inet_ntoa memset memcpy munmap select setsid socket sqrt strcasecmp strchr strstr strtoul uname toupper])
81
82#AC_CONFIG_SUBDIRS(src/missing)
83
84# does this platform need the replacement getaddrinfo
85AC_CHECK_FUNCS([getnameinfo getaddrinfo inet_ntop getifaddrs])
86# AC_REPLACE_FUNCS([getaddrinfo])
87
88
89if test "$ac_cv_func_getaddrinfo$ac_cv_func_getnameinfo" != yesyes ; then
90   AC_MSG_NOTICE([Requesting replacement getaddrinfo/getnameinfo])
91   AC_LIBOBJ(getaddrinfo)
92   HAVE_MISSING=yes
93fi
94if test "$ac_cv_func_inet_ntop" != yes ; then
95   AC_MSG_NOTICE([Requesting replacement inet_ntop])
96   AC_LIBOBJ(inet_ntop)
97   HAVE_MISSING=yes
98fi
99AM_CONDITIONAL(NEED_LIBCOMPAT, test "$HAVE_MISSING" = "yes")
100
101AC_CHECK_FUNCS(sendfile)
102
103AC_CHECK_FUNCS(uname)
104
105# check for the various CPU binding calls
106AC_CHECK_FUNCS(mpctl processor_bind sched_setaffinity bind_to_cpu_id bindprocessor)
107
108# see if we should be enabling histogram support
109
110AC_MSG_CHECKING(whether to include histogram support)
111
112AC_ARG_ENABLE(histogram,
113	[AS_HELP_STRING([--enable-histogram],[include individual op timing, may affect result]) ])
114
115case "$enable_histogram" in
116	yes)
117		use_histogram=true
118		;;
119	no)
120		use_histogram=false
121		;;
122	'')
123		# whatever
124		use_histogram=false
125		;;
126	*)
127		AC_MSG_ERROR([--enable-histogram takes yes or no])
128		;;
129esac
130
131if $use_histogram
132then
133	AC_MSG_RESULT(yes)
134else
135	AC_MSG_RESULT(no)
136fi
137
138if $use_histogram
139then
140	AC_DEFINE([WANT_HISTOGRAM],,[Define to one to enable histogram support. May affect results.])
141fi
142# see if we should be enabling histogram support
143
144AC_MSG_CHECKING(whether to include dirty support)
145
146AC_ARG_ENABLE(dirty,
147	[AS_HELP_STRING([--enable-dirty],[write to buffers each time, may affect result]) ])
148
149case "$enable_dirty" in
150	yes)
151		use_dirty=true
152		;;
153	no)
154		use_dirty=false
155		;;
156	'')
157		# whatever
158		use_dirty=false
159		;;
160	*)
161		AC_MSG_ERROR([--enable-dirty takes yes or no])
162		;;
163esac
164
165if $use_dirty
166then
167	AC_MSG_RESULT(yes)
168else
169	AC_MSG_RESULT(no)
170fi
171
172if $use_dirty
173then
174	AC_DEFINE([DIRTY],,[Define to one to enable dirty buffer support. May affect results.])
175fi
176
177# see if we should be enabling demo support
178
179AC_MSG_CHECKING(whether to include demo support)
180
181AC_ARG_ENABLE(demo,
182	[AS_HELP_STRING([--enable-demo],[emit interim results during the run. May affect results.])])
183
184case "$enable_demo" in
185	yes)
186		use_demo=true
187		;;
188	no)
189		use_demo=false
190		;;
191	'')
192		# whatever
193		use_demo=false
194		;;
195	*)
196		AC_MSG_ERROR([--enable-demo takes yes or no])
197		;;
198esac
199
200if $use_demo
201then
202	AC_MSG_RESULT(yes)
203else
204	AC_MSG_RESULT(no)
205fi
206
207if $use_demo
208then
209	AC_DEFINE([WANT_DEMO],,[Define to one to enable demo support. May affect results.])
210fi
211
212# see if we should be including the AF_UNIX tests
213
214AC_MSG_CHECKING(whether to include Unix-domain socket tests)
215
216AC_ARG_ENABLE(unixdomain,
217	[AS_HELP_STRING([--enable-unixdomain],[include Unix Domain socket tests])])
218
219case "$enable_unixdomain" in
220     yes)
221		use_unixdomain=true
222		;;
223     no)
224		use_unixdomain=false
225		;;
226     '')
227		use_unixdomain=false
228		;;
229     *)
230		AC_MSG_ERROR([--enable-unixdomain takes yes or no])
231		;;
232esac
233
234if $use_unixdomain
235then
236	AC_MSG_RESULT(yes)
237else
238	AC_MSG_RESULT(no)
239fi
240
241if $use_unixdomain
242then
243	AC_DEFINE([WANT_UNIX],,[Define to one to include Unix Domain socket tests.])
244fi
245
246# see if we should be including the DLPI tests
247
248AC_MSG_CHECKING(whether to include DLPI tests)
249
250AC_ARG_ENABLE(dlpi,
251	[AS_HELP_STRING([--enable-dlpi],[include DLPI (link-layer) tests])])
252
253case "$enable_dlpi" in
254     yes)
255		use_dlpi=true
256		;;
257     no)
258		use_dlpi=false
259		;;
260     '')
261		use_dlpi=false
262		;;
263     *)
264		AC_MSG_ERROR([--enable-dlpi takes yes or no])
265		;;
266esac
267
268if $use_dlpi
269then
270	AC_MSG_RESULT(yes)
271else
272	AC_MSG_RESULT(no)
273fi
274
275if $use_dlpi
276then
277	AC_DEFINE([WANT_DLPI],,[Define to one to include DLPI tests.])
278fi
279
280# see if we should be including the DCCP tests
281
282AC_MSG_CHECKING(whether to include DCCP tests)
283
284AC_ARG_ENABLE(dccp,
285	[AS_HELP_STRING([--enable-dccp],[include DCCP tests])])
286
287case "$enable_dccp" in
288     yes)
289		use_dccp=true
290		;;
291     no)
292		use_dccp=false
293		;;
294     '')
295		use_dccp=false
296		;;
297     *)
298		AC_MSG_ERROR([--enable-dccp takes yes or no])
299		;;
300esac
301
302if $use_dccp
303then
304	AC_MSG_RESULT(yes)
305else
306	AC_MSG_RESULT(no)
307fi
308
309if $use_dccp
310then
311	AC_DEFINE([WANT_DCCP],,[Define to one to include DCCP tests.])
312fi
313
314# see if we should be including the OMNI tests
315
316AC_MSG_CHECKING(whether to include OMNI tests)
317
318AC_ARG_ENABLE(omni,
319	[AS_HELP_STRING([--enable-omni],[include OMNI tests])])
320
321case "$enable_omni" in
322     yes)
323		use_omni=true
324		;;
325     no)
326		use_omni=false
327		;;
328     '')
329		use_omni=true
330		;;
331     *)
332		AC_MSG_ERROR([--enable-omni takes yes or no])
333		;;
334esac
335
336if $use_omni
337then
338	AC_MSG_RESULT(yes)
339else
340	AC_MSG_RESULT(no)
341fi
342
343if $use_omni
344then
345	AC_DEFINE([WANT_OMNI],,[Define to one to include OMNI tests.])
346	AC_DEFINE([WANT_MIGRATION],,[Define to one to migrate classic to OMNI tests.])
347fi
348
349
350# see if we should be including the XTI tests
351
352AC_MSG_CHECKING(whether to include XTI tests)
353
354AC_ARG_ENABLE(xti,
355	[AS_HELP_STRING([--enable-xti],[include XTI socket tests])])
356
357case "$enable_xti" in
358     yes)
359		use_xti=true
360		;;
361     no)
362		use_xti=false
363		;;
364     '')
365		use_xti=false
366		;;
367     *)
368		AC_MSG_ERROR([--enable-xti takes yes or no])
369		;;
370esac
371
372if $use_xti
373then
374	AC_MSG_RESULT(yes)
375else
376	AC_MSG_RESULT(no)
377fi
378
379if $use_xti
380then
381	AC_DEFINE([WANT_XTI],,[Define to one to include XTI tests.])
382fi
383
384# see if we should be including the SDP tests
385
386AC_MSG_CHECKING(whether to include SDP tests)
387
388AC_ARG_ENABLE(sdp,
389	[AS_HELP_STRING([--enable-sdp],[include SDP socket tests])])
390
391case "$enable_sdp" in
392     yes)
393		# probably need to be a bit more sophisticated here
394		AC_CHECK_LIB(sdp,t_open)
395		use_sdp=true
396		;;
397     no)
398		use_sdp=false
399		;;
400     '')
401		use_sdp=false
402		;;
403     *)
404		AC_MSG_ERROR([--enable-sdp takes yes or no])
405		;;
406esac
407
408if $use_sdp
409then
410	AC_MSG_RESULT(yes)
411else
412	AC_MSG_RESULT(no)
413fi
414
415if $use_sdp
416then
417	AC_DEFINE([WANT_SDP],,[Define to one to include SDP tests.])
418fi
419
420# see if we should be including the ICSC-EXS tests
421
422AC_MSG_CHECKING(whether to include ICSC-EXS tests)
423
424AC_ARG_ENABLE(exs,
425	[AS_HELP_STRING([--enable-exs],[include ICSC async sockets tests])])
426
427case "$enable_exs" in
428     yes)
429		use_exs=true
430		AC_CHECK_HEADER(sys/exs.h,,[use_exs=false])
431		AC_CHECK_LIB(exs,exs_init,,[use_exs=false])
432		;;
433     no)
434		use_exs=false
435		;;
436     '')
437		use_exs=false
438		;;
439     *)
440		AC_MSG_ERROR([--enable-exs takes yes or no])
441		;;
442esac
443
444if $use_exs
445then
446	AC_MSG_RESULT(yes)
447else
448	AC_MSG_RESULT(no)
449fi
450
451if $use_exs
452then
453	AC_DEFINE([HAVE_ICSC_EXS],,[Define to one to include ICSC-EXS tests.])
454fi
455
456# see if we should be enabling SCTP support
457
458
459AC_ARG_ENABLE(sctp,
460	[AS_HELP_STRING([--enable-sctp],[include tests to measure SCTP performance ])])
461
462case "$enable_sctp" in
463	yes)
464		use_sctp=true
465		AC_CHECK_HEADERS(netinet/sctp.h,,use_sctp=false,
466[[
467#include <sys/socket.h>
468]])
469		case "$host" in
470		*-*-freebsd[78].*)
471			# FreeBSD 7.x and later SCTP support doesn't need -lsctp.
472			;;
473		*)
474			AC_HAVE_LIBRARY(sctp,,use_sctp=false)
475			;;
476		esac
477		AC_CHECK_MEMBER(struct sctp_event_subscribe.sctp_adaptation_layer_event,
478				, , [#include <netinet/sctp.h>])
479		if test "$ac_cv_member_struct_sctp_event_subscribe_sctp_adaptation_layer_event" = "yes"; then
480			AC_DEFINE([HAVE_SCTP_ADAPTATION_LAYER_EVENT], 1,
481				  [Define to 1 if `struct sctp_event_subscribe' has a `sctp_adaptation_layer_event' member])
482		fi
483		;;
484	no)
485		use_sctp=false
486		;;
487	'')
488		# whatever
489		use_sctp=false
490		;;
491	*)
492		AC_MSG_ERROR([--enable-sctp takes yes or no])
493		;;
494esac
495
496AC_MSG_CHECKING(whether to include SCTP tests)
497
498if $use_sctp
499then
500	AC_MSG_RESULT(yes)
501else
502	AC_MSG_RESULT(no)
503fi
504
505if $use_sctp
506then
507	AC_DEFINE([WANT_SCTP],,[Define to one to include SCTP tests.])
508fi
509
510# see if we should be enabling paced sends
511
512AC_MSG_CHECKING([whether to include paced send (intervals) support])
513
514AC_ARG_ENABLE(intervals,
515	[AS_HELP_STRING([--enable-intervals],[include ability to pace operations, may affect result])])
516
517case "$enable_intervals" in
518	yes)
519		use_intervals=true
520		;;
521	no)
522		use_intervals=false
523		;;
524	'')
525		use_intervals=false
526		;;
527	*)
528		AC_MSG_ERROR([--enable-intervals takes yes or no])
529		;;
530esac
531
532if $use_intervals
533then
534	AC_MSG_RESULT(yes)
535else
536	AC_MSG_RESULT(no)
537fi
538
539if $use_intervals
540then
541	AC_DEFINE([WANT_INTERVALS],,[Define to one to enable paced operation support. May affect results.])
542fi
543
544# see if paced sends should wait and spin
545
546AC_MSG_CHECKING([whether paced sends should spin])
547
548AC_ARG_ENABLE(spin,
549	[AS_HELP_STRING([--enable-spin],[paced operations (--enable-intervals) should sit and spin - WILL affect result])])
550
551case "$enable_spin" in
552	yes)
553		use_spin=true
554		;;
555	no)
556		use_spin=false
557		;;
558	'')
559		use_spin=false
560		;;
561	*)
562		AC_MSG_ERROR([--enable-spin takes yes or no])
563		;;
564esac
565
566if $use_spin
567then
568	AC_MSG_RESULT(yes)
569else
570	AC_MSG_RESULT(no)
571fi
572
573if $use_spin
574then
575	AC_DEFINE([WANT_INTERVALS],,[Define to one to enable paced operation support. May affect results.])
576	AC_DEFINE([WANT_SPIN],,[Define to one to spin waiting on paced operation. WILL AFFEFCT CPU UTILIZATION])
577fi
578
579# see if we should be enabling initial request bursts
580
581AC_MSG_CHECKING([whether to include initial burst support in _RR tests])
582
583AC_ARG_ENABLE(burst,
584	[AS_HELP_STRING([--enable-burst],[include intial request burst ability in _RR tests, may affect result])])
585
586case "$enable_burst" in
587	yes)
588		use_burst=true
589		;;
590	no)
591		use_burst=false
592		;;
593	'')
594		use_burst=true
595		;;
596	*)
597		AC_MSG_ERROR([--enable-burst takes yes or no])
598		;;
599esac
600
601if $use_burst
602then
603	AC_MSG_RESULT(yes)
604else
605	AC_MSG_RESULT(no)
606fi
607
608if $use_burst
609then
610	AC_DEFINE([WANT_FIRST_BURST],,[Define to one to enable initial _RR burst support. May affect results.])
611fi
612
613# time to see about CPU utilization measurements
614
615AC_MSG_CHECKING([which CPU utilization measurement type to use])
616
617AC_ARG_ENABLE(cpuutil,
618	[AS_HELP_STRING([--enable-cpuutil],[include code to measure CPU utilization using specified mechanism])])
619
620NETCPU_SOURCE="$enable_cpuutil"
621case "$enable_cpuutil" in
622	pstat)
623		use_cpuutil=true
624		AC_DEFINE([USE_PSTAT],,[Use HP-UX's pstat interface to measure CPU util.])
625		;;
626	pstatnew)
627		use_cpuutil=true
628		AC_DEFINE([USE_PSTAT],,[Use HP-UX's pstat interface to measure CPU util.])
629		;;
630        perfstat)
631                use_cpuutil=true
632                AC_DEFINE([USE_PERFSTAT],,[Use AIX's perfstat interface to measure CPU util.])
633		AC_HAVE_LIBRARY(perfstat)
634                ;;
635
636	looper)
637		use_cpuutil=true
638		AC_DEFINE([USE_LOOPER],,[Use looper/soaker processes to measure CPU util.])
639		;;
640	procstat)
641		use_cpuutil=true
642		AC_DEFINE([USE_PROC_STAT],,[Use Linux's procstat interface to measure CPU util.])
643		;;
644	kstat)
645		use_cpuutil=true
646		AC_DEFINE([USE_KSTAT],,[Use Solaris's kstat interface to measure CPU util.])
647		AC_HAVE_LIBRARY(kstat)
648		;;
649	kstat10)
650		use_cpuutil=true
651		AC_DEFINE([USE_KSTAT],,[Use Solaris's kstat interface to measure CPU util.])
652		AC_HAVE_LIBRARY(kstat)
653		;;
654	osx)
655		use_cpuutil=true
656		AC_DEFINE([USE_OSX],,[Use MacOS X's host_info interface to measure CPU util.])
657		;;
658	'')
659# ia64-hp-hpux11.23
660# i386-pc-solaris2.10
661# guess it automagically in a nice big case statement
662		case $target in
663		     *-*-linux*)
664			use_cpuutil=true
665			AC_DEFINE([USE_PROC_STAT],,[Use Linux's procstat interface to measure CPU util.])
666			enable_cpuutil="procstat - auto"
667			NETCPU_SOURCE="procstat"
668			;;
669		     *-*-hpux11.23 | *-*-hpux11.31)
670			use_cpuutil=true
671			AC_DEFINE([USE_PSTAT],,[Use HP-UX's pstat interface to measure CPU util.])
672			enable_cpuutil="pstatnew - auto"
673			NETCPU_SOURCE="pstatnew"
674			;;
675		     *-*-hpux11* | *-*-hpux10*)
676			use_cpuutil=true
677			AC_DEFINE([USE_PSTAT],,[Use HP-UX's pstat interface to measure CPU util.])
678			enable_cpuutil="pstat - auto"
679			NETCPU_SOURCE="pstat"
680			;;
681		     *-*-aix5.* | *-*-aix6.*)
682			use_puutil=true
683			AC_DEFINE([USE_PERFSTAT],,[Use AIX's perfstat interface to measure CPU util.])
684			AC_HAVE_LIBRARY(perfstat)
685			enable_cpuutil="perfstat - auto"
686			NETCPU_SOURCE="perfstat"
687			;;
688		     *-*-solaris2.1*)
689			use_cpuutil=true
690			AC_DEFINE([USE_KSTAT],,[Use Solaris's kstat interface to measure CPU util.])
691			AC_HAVE_LIBRARY(kstat)
692			enable_cpuutil="kstat10 - auto"
693			NETCPU_SOURCE="kstat10"
694			;;
695		     *-*-solaris2.*)
696			use_cpuutil=true
697			AC_DEFINE([USE_KSTAT],,[Use Solaris's kstat interface to measure CPU util.])
698			AC_HAVE_LIBRARY(kstat)
699			enable_cpuutil="kstat - auto"
700			NETCPU_SOURCE="kstat"
701			;;
702                     *-*-freebsd[[4-8]].* | *-*-netbsd[[1-9]].* )
703			use_cpuutil=true
704			AC_DEFINE([USE_SYSCTL],,[Use MumbleBSD's sysctl interface to measure CPU util.])
705			enable_cpuutil="sysctl - auto"
706			NETCPU_SOURCE="sysctl"
707			;;
708		    *-*-darwin*)
709			use_cpuutil=true
710			AC_DEFINE([USE_OSX],,[Use MacOS X's host_info interface to measure CPU util.])
711			enable_cpuutil="osx - auto"
712			NETCPU_SOURCE="osx"
713			;;
714		     *)
715			use_cpuutil=false
716			NETCPU_SOURCE="none"
717			enable_cpuutil="none. Consider teaching configure about your platform."
718			;;
719		esac
720		;;
721	none)
722		use_cpuutil=false
723		;;
724	*)
725		AC_MSG_ERROR([--enable-cpuutil takes kstat, kstat10, looper, osx, perfstat, procstat, pstat, pstatnew, sysctl or none])
726		;;
727esac
728
729	AC_MSG_RESULT("$enable_cpuutil")
730
731AC_SUBST(NETCPU_SOURCE)
732
733
734# now spit it all out
735AC_CONFIG_FILES([Makefile
736                 src/netperf_version.h
737                 src/Makefile
738		 src/missing/Makefile
739		 src/missing/m4/Makefile
740		 doc/Makefile
741		 doc/examples/Makefile
742                 netperf.spec])
743
744AC_OUTPUT
745