forked from appneta/tcpreplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
753 lines (655 loc) · 19.7 KB
/
configure.in
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
dnl $Id$
AC_INIT(tcpreplay)
AC_CONFIG_SRCDIR(src/tcpreplay.c)
AM_CONFIG_HEADER(src/config.h)
AC_CONFIG_AUX_DIR(config)
AM_MAINTAINER_MODE
AM_WITH_DMALLOC
AC_PROG_LIBTOOL
dnl Set version info here!
MAJOR_VERSION=3
MINOR_VERSION=0
MICRO_VERSION=beta8
TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
dnl Release is only used for the RPM spec file
TCPREPLAY_RELEASE=1
AC_DEFINE(PACKAGE, [tcpreplay], [This is our package name])
AC_DEFINE_UNQUOTED(VERSION, "$TCPREPLAY_VERSION", [What is our version?])
AC_SUBST(TCPREPLAY_VERSION)
AC_SUBST(TCPREPLAY_RELEASE)
CFLAGS="$CFLAGS -Wall -O2 -funroll-loops" # -std=c99 -Wno-variadic-macros"
dnl Determine OS
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_SUBST(host)
AC_SUBST(build)
AC_SUBST(target)
AM_INIT_AUTOMAKE(tcpreplay, $TCPREPLAY_VERSION, nodefine)
dnl Checks for programs.
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_AWK
AC_PROG_MAKE_SET
AC_EXEEXT
AC_PATH_PROG(PRINTF, printf)
AC_PATH_PROG(FIG2DEV, fig2dev)
dnl Look for lyx in the normal locations
dnl The OS X installer puts Lyx at /Applications/Lyx.app/Contents/MacOS/LyX
AC_ARG_WITH(lyx,
AC_HELP_STRING([--with-lyx=FILE], [Path to Lyx binary]),
[ AC_MSG_CHECKING(for lyx)
if test -x $withval ; then
td=$withval
AC_MSG_RESULT($td)
else
AC_MSG_RESULT([Error: $withval does not exist or is not executable])
fi ],
[
case $host in
powerpc-apple-darwin*)
lyx=/Applications/Lyx.app/Contents/MacOS/LyX
if test -x $lyx ; then
AC_MSG_CHECKING(for lyx)
AC_SUBST(LYX, $lyx)
AC_MSG_RESULT($lyx)
else
AC_PATH_PROG(LYX, lyx)
fi
;;
*)
AC_PATH_PROG(LYX, lyx)
;;
esac
])
AC_PATH_PROG(DVIPS, dvips)
AC_PATH_PROG(TEXI2DVI, texi2dvi)
AC_PATH_PROG(LATEX2HTML, latex2html)
AC_PATH_PROG(DVIPDFM, dvipdfm)
AC_PATH_PROG(AUTOGEN, autogen)
AC_HEADER_STDC
AC_HEADER_MAJOR
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_C_CONST
AC_C_INLINE
AC_SYS_LARGEFILE
dnl Check for functions
AC_FUNC_FSEEKO
dnl Check for types.
AC_CHECK_TYPE(u_int8_t, uint8_t)
AC_CHECK_TYPE(u_int16_t, uint16_t)
AC_CHECK_TYPE(u_int32_t, uint32_t)
AC_CHECK_TYPE(u_int64_t, uint64_t)
dnl Check for other header files
AC_CHECK_HEADERS([fcntl.h stddef.h sys/socket.h arpa/inet.h sys/time.h signal.h string.h strings.h sys/types.h sys/select.h netinet/in.h poll.h sys/poll.h unistd.h])
dnl Checks for libraries.
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(rt, nanosleep)
dnl Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([gettimeofday ctime memset regcomp strdup strerror strtol strncpy strtoull poll ntohll mmap])
dnl Look for strlcpy since some BSD's have it
AC_CHECK_FUNCS([strlcpy],have_strlcpy=true,have_strlcpy=false)
AM_CONDITIONAL(SYSTEM_STRLCPY, [test x$have_strlcpy = xtrue])
AC_CHECK_MEMBERS([struct timeval.tv_sec])
AC_C_BIGENDIAN
doctools=no
if test -n "$FIG2DEV" -a -n "$LYX" -a -n "$DVIPS" -a -n "$TEXI2DVI" \
-a -n "$LATEX2HTML" -a -n "$DVIPDFM" ; then
doctools=yes
fi
AM_CONDITIONAL(HAVE_DOCTOOLS, test $doctools = yes)
dnl Enable debugging in code/compiler options
debug=no
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug], [Enable debugging code and support for the -d option]),
[ if test x$enableval = xyes; then
debug=yes
CFLAGS="-ggdb -Wall -pedantic"
AC_SUBST(debug_flag)
AC_DEFINE([DEBUG], [], [Enable debuggin code and support for the -d option])
fi])
dnl Enable Efense
AC_ARG_ENABLE(efence,
AC_HELP_STRING([--enable-efence], [Enable Electric Fence memory debugger]),
[ if test x$enableval = xyes; then
CFLAGS="$CFLAGS -lefence"
AC_DEFINE([EFENCE], [], [Enable Electric Fence memory debugger])
fi])
dnl Enable Gprof
AC_ARG_ENABLE(gprof,
AC_HELP_STRING([--enable-gprof], [Enable GNU Profiler]),
[ if test x$enableval = xyes; then
if test $debug = yes; then
CFLAGS="$CFLAGS -pg"
else
# GPROF requires gdb
CFLAGS="$CFLAGS -ggdb -pg -fprofile-arcs"
fi
AC_DEFINE([GPROF], [], [Enable GNU Profiler])
fi])
dnl Use 64bits for packet counters
AC_ARG_ENABLE(64bits,
AC_HELP_STRING([--enable-64bits], [Use 64bit packet counters]),
[ if test x$enableval = xyes; then
AC_DEFINE([ENABLE_64BITS], [], [Use 64bit packet counters])
AC_MSG_NOTICE([Using u_int64_t for packet counters])
else
AC_MSG_NOTICE([Using u_int32_t for packet counters])
fi
])
dnl Dynamic link libraries
dynamic_link=no
AC_ARG_ENABLE(dynamic-link,
AC_HELP_STRING([--enable-dynamic-link], [Dynamically link libraries]),
[ if test x$enableval = xyes; then
AC_DEFINE([ENABLE_DYNAMIC_LINK], [], [Enable dynamically linking libs])
dynamic_link=yes
fi
])
dnl Check for inet_aton and inet_addr
AC_CHECK_FUNC(inet_aton,
AC_DEFINE([INET_ATON], [], [Do we have inet_aton?])
inet_aton=yes,
inet_aton=no)
AC_CHECK_FUNC(inet_addr,
AC_DEFINE([INET_ADDR], [], [Do we have inet_addr?])
inet_addr=yes,
inet_addr=no)
if test $inet_aton = no -a $inet_addr = no ; then
AC_MSG_ERROR("We need either inet_aton or inet_addr")
fi
dnl ##################################################
dnl Checks for libnet (shamelessly horked from dsniff)
dnl ##################################################
foundnet=no
trynetdir=/usr/local
AC_MSG_CHECKING(for libnet)
AC_ARG_WITH(libnet,
AC_HELP_STRING([--with-libnet=DIR], [Use libnet in DIR]),
[trynetdir=$withval])
for testdir in $trynetdir /usr/local /usr ; do
if test -f "${testdir}/include/libnet.h" -a $foundnet = no ; then
LNETINC="${testdir}/include/libnet.h"
LNETINCDIR="$testdir/include"
if test $dynamic_link = yes; then
LNETLIB="-L${testdir}/lib -lnet"
elif test -f "${testdir}/lib64/libnet.a" ; then
LNETLIB="${testdir}/lib64/libnet.a"
else
LNETLIB="${testdir}/lib/libnet.a"
fi
foundnet=$testdir
fi
done
if test $foundnet = no ; then
AC_MSG_RESULT(no)
AC_ERROR(libnet not found)
else
AC_MSG_RESULT($foundnet)
fi
AC_SUBST(LNETINC)
AC_SUBST(LNETLIB)
OLDLIBS="$LIBS"
OLDCFLAGS="$CFLAGS"
LIBS="$LNETLIB"
CFLAGS="$CFLAGS -I$LNETINCDIR"
dnl Check to see what version of libnet
dnl this code has been reduced a lot, but probably still could be
dnl reduced quite a bit more if we chose too
AC_MSG_CHECKING(for libnet version)
AC_TRY_RUN([
#include <string.h>
#define LIBNET_LIL_ENDIAN 1
#include "$LNETINC"
#define LIB_TEST "1.0"
/*
* simple proggy to test the version of libnet
* returns zero if it's 1.0.x
* or one otherwise
*/
int
main (int argc, char *argv[])
{
if (strncmp(LIB_TEST, LIBNET_VERSION, 3) == 0)
exit(0);
exit(1);
}],
libnet_ver_10=yes
AC_MSG_RESULT(1.0.x),
libnet_ver_10=no,
libnet_ver_10=no
)
AC_TRY_RUN([
#include <string.h>
#include "$LNETINC"
#define LIB_TEST "1.1"
/*
* simple proggy to test the version of libnet
* returns zero if it's 1.0.x
* or one otherwise
*/
int
main (int argc, char *argv[])
{
if (strncmp(LIB_TEST, LIBNET_VERSION, 3) == 0)
exit(0);
exit(1);
}],
libnet_ver_11=yes
AC_MSG_RESULT(1.1.x),
libnet_ver_11=no,
libnet_ver_11=no
)
if test $libnet_ver_10 = no -a $libnet_ver_11 = no ; then
AC_MSG_RESULT(unknown)
AC_MSG_ERROR(Unable to determine version of libnet)
fi
if test $libnet_ver_10 = yes ; then
AC_MSG_ERROR(Libnet version 1.0.x is no longer supported.
Please upgrade to 1.1.0 or better)
fi
AC_MSG_CHECKING([for working libnet_checksum()])
AC_TRY_RUN([
#include <string.h>
#include "$LNETINC"
#define LIB_TEST "1.1.3"
/*
* simple proggy to test the version of libnet
* returns zero if it's < 1.1.3 which has the checksum fix
* or one otherwise
*/
int
main (int argc, char *argv[])
{
if (strncmp(LIB_TEST, LIBNET_VERSION, 5) <= 0)
exit(0);
exit(1);
}],
libnet_ver_113=yes,
libnet_ver_113=no,
libnet_ver_113=no
)
if test $libnet_ver_113 = no ; then
AC_MSG_RESULT(no)
AC_MSG_WARN([You should upgrade to libnet 1.1.3 or better if you
want to modify packets])
else
AC_MSG_RESULT(yes)
fi
dnl restore LIBS & CFLAGS
LIBS="$OLDLIBS"
CFLAGS="$OLDCFLAGS"
dnl #####################################################
dnl Checks for libpcap
dnl #####################################################
foundpcap=no
trypcapdir=/usr/local
AC_MSG_CHECKING(for libpcap)
AC_ARG_WITH(libpcap,
AC_HELP_STRING([--with-libpcap=DIR], [Use libpcap in DIR]),
[trypcapdir=$withval])
for testdir in $trypcapdir /usr/local /usr ; do
if test -f "${testdir}/include/pcap.h" -a $foundpcap = no ; then
LPCAPINC="${testdir}/include/pcap.h"
LPCAPINCDIR="${testdir}/include"
if test $dynamic_link = yes; then
LPCAPLIB="-L${testdir}/lib -lpcap"
elif test -f "${testdir}/lib64/libpcap.a" ; then
LPCAPLIB="${testdir}/lib64/libpcap.a"
else
LPCAPLIB="${testdir}/lib/libpcap.a"
fi
foundpcap=$testdir
fi
done
if test $foundpcap = no ; then
AC_MSG_RESULT(no)
AC_ERROR(libpcap not found)
else
AC_MSG_RESULT($foundpcap)
fi
AC_SUBST(LPCAPINC)
AC_SUBST(LPCAPLIB)
dnl Checks to see what version of libpcap we've got
OLDLIBS="$LIBS"
OLDCFLAGS="$CFLAGS"
LIBS="$LPCAPLIB"
CFLAGS="$CFLAGS -I$LPCAPINCDIR"
dnl Check to see what version of libpcap
dnl this code has been reduced a lot, but probably still could be
dnl reduced quite a bit more if we chose too
AC_MSG_CHECKING(for libpcap version)
AC_TRY_RUN([
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "$LPCAPINC"
#define PCAP_TEST "0.5"
/*
* simple proggy to test the version of libpcap
* returns zero if version >= 0.5
* or one otherwise
*/
extern char pcap_version[];
int
main (int argc, char *argv[])
{
if (strncmp(pcap_version, PCAP_TEST, 3) >= 0)
exit(0);
exit(1);
}],
libpcap_ver=yes
AC_MSG_RESULT(>= 0.5),
libpcap_ver=no
AC_MSG_RESULT(< 0.5),
libpcap_ver=no
)
if test $libpcap_ver = no ; then
AC_MSG_ERROR(Libpcap versions < 0.5 are not supported.
Please upgrade to version 0.5 or better)
fi
dnl Check to see if we've got pcap_datalink_val_to_name()
AC_MSG_CHECKING(for pcap_datalink_val_to_description)
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "$LPCAPINC"
int
main(int argc, char *argv[]) {
pcap_datalink_val_to_description(1);
exit(0);
}
],
have_dlt_to_desc=yes
AC_MSG_RESULT(yes),
have_dlt_to_desc=no
AC_MSG_RESULT(no),
have_dlt_to_desc=no
)
if test $have_dlt_to_desc = yes ; then
AC_DEFINE([HAVE_DLT_VAL_TO_DESC], [],
[Does libpcap have dlt_val_to_desc?])
fi
dnl Older versions of libpcap are missing some DLT types
dnl If doesn't exist, we'll define them in src/common/fakepcap.h
AC_MSG_CHECKING(for DLT_LINUX_SLL in libpcap)
AC_TRY_COMPILE([#include "$LPCAPINC"],
[ int foo;
foo = DLT_LINUX_SLL ],
[ AC_DEFINE([HAVE_DLT_LINUX_SLL],
[], [Does pcap.h include a header with DLT_LINUX_SLL?])
AC_MSG_RESULT(yes)
],
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for DLT_C_HDLC in libpcap)
AC_TRY_COMPILE([#include "$LPCAPINC"],
[ int foo;
foo = DLT_C_HDLC ],
[ AC_DEFINE([HAVE_DLT_C_HDLC],
[], [Does pcap.h include a header with DLT_C_HDLC?])
AC_MSG_RESULT(yes)
],
AC_MSG_RESULT(no)
)
PCAP_BPF_H_FILE="$LPCAPINCDIR/pcap-bpf.h"
AC_MSG_CHECKING(for $PCAP_BPF_H_FILE)
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/time.h>
#include "$PCAP_BPF_H_FILE"],
[ int foo;
foo = BPF_MAJOR_VERSION; ],
[ AC_DEFINE([INCLUDE_PCAP_BPF_HEADER], [],
[What is the path (if any) to the pcap-bpf.h
header?])
AC_MSG_RESULT(yes)
AC_SUBST(PCAP_BPF_H_FILE)
],
AC_MSG_RESULT(no)
)
dnl restore LIBS & CFLAGS
LIBS="$OLDLIBS"
CFLAGS="$OLDCFLAGS"
dnl ##################################################
dnl # Check for pcapnav
dnl ##################################################
pcapnav_ver=no
pcncfg=no
AC_ARG_WITH(pcapnav-config,
AC_HELP_STRING([--with-pcapnav-config=FILE], [Use given pcapnav-config]),
[ AC_MSG_CHECKING(for pcapnav-config)
if test -x $withval ; then
pcncfg=$withval
AC_MSG_RESULT($pcncfg)
else
AC_MSG_RESULT([Can't find pcapnav-config: disabling offset jump feature])
fi ],
[ AC_PATH_PROG(pcncfg,[pcapnav-config], [no] ) ]
)
if test $pcncfg != no ; then
LNAVLIB=`$pcncfg --libs`
LNAV_CFLAGS=`$pcncfg --cflags`
PCAPNAV_VERSION=`$pcncfg --version`
AC_SUBST(LNAVLIB)
AC_SUBST(LNAV_CFLAGS)
AC_DEFINE_UNQUOTED(PCAPNAV_VERSION, "$PCAPNAV_VERSION",
[libpcapnav's version?])
dnl Check to see what version of libpcapnav
dnl this code has been reduced a lot, but probably still could be
dnl reduced quite a bit more if we chose too
AC_MSG_CHECKING(for libpcapnav version)
AC_TRY_RUN([
#include <string.h>
#define PCAPNAV_TEST "0.4"
/*
* simple proggy to test the version of libpcapnav
* returns zero if version >= 0.4
* or one otherwise
*/
int
main (int argc, char *argv[])
{
if (strncmp(PCAPNAV_VERSION, PCAPNAV_TEST, 3) >= 0)
exit(0);
exit(1);
}],
libpcapnav_ver=yes
AC_MSG_RESULT(>= 0.4),
libpcapnav_ver=no
AC_MSG_RESULT(< 0.4),
libpcapnav_ver=no
)
if test x$libpcapnav_ver = xno ; then
AC_MSG_WARN([Libpcapnav versions < 0.4 are not supported.
Please upgrade to version 0.4 or better.
Disabling offset jump feature.])
else
AC_DEFINE([HAVE_PCAPNAV], [], [Do we have libpcapnav?])
fi
fi # checking pcapnav version
dnl #####################################################
dnl Checks for libnids
dnl #####################################################
foundnids=no
trynidsdir=/usr/local
AC_MSG_CHECKING(for libnids)
AC_ARG_WITH(libnids,
AC_HELP_STRING([--with-libnids=DIR], [Use libnids in DIR]),
[trynidsdir=$withval])
for testdir in $trynidsdir /usr/local /usr ; do
if test -f "${testdir}/include/nids.h" -a $foundnids = no ; then
LNIDSINC="${testdir}/include/nids.h"
LNIDSINCDIR="${testdir}/include"
dnl Libnids by default doesn't build a dynamic library and due to a
dnl bug, won't build one for OS X, so we link to the static
dnl LNIDSLIB="${testdir}/lib -lnids"
LNIDSLIB="${testdir}/lib/libnids.a"
foundnids=$testdir
fi
done
if test $foundnids = no ; then
AC_MSG_RESULT(no)
AC_MSG_WARN(libnids not found. We won't build flowreplay.)
else
AC_MSG_RESULT($foundnids)
AC_DEFINE([HAVE_LIBNIDS], [], [Do we have libnids?])
fi
AC_SUBST(LNIDSINC)
AC_SUBST(LNIDSLIB)
AM_CONDITIONAL([HAVE_LIBNIDS], [ test ${foundnids} != no ])
dnl (shamelessly ripped off from libpcap)
dnl Checks to see if unaligned memory accesses fail
dnl
dnl FORCE_ALIGN (DEFINED)
dnl
AC_MSG_CHECKING(for requires strict byte alignment)
AC_CACHE_VAL(unaligned_fail,
[case "$host_cpu" in
# XXX: should also check that they don't do weird things (like on arm)
alpha*|arm*|hp*|mips*|sparc*|ia64)
unaligned_fail=yes
;;
*)
cat >conftest.c <<EOF
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
main() {
unsigned int i;
pid_t pid;
int status;
/* avoid "core dumped" message */
pid = fork();
if (pid < 0)
exit(2);
if (pid > 0) {
/* parent */
pid = waitpid(pid, &status, 0);
if (pid < 0)
exit(3);
exit(!WIFEXITED(status));
}
/* child */
i = *(unsigned int *)&a[[1]];
printf("%d\n", i);
exit(0);
}
EOF
${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
conftest.c $LIBS >/dev/null 2>&1
if test ! -x conftest ; then
dnl failed to compile for some reason
unaligned_fail=yes
else
./conftest >conftest.out
if test ! -s conftest.out ; then
unaligned_fail=yes
else
unaligned_fail=no
fi
fi
rm -f conftest* core core.conftest
;;
esac])
AC_MSG_RESULT($unaligned_fail)
if test $unaligned_fail = yes ; then
AC_DEFINE([FORCE_ALIGN],1,[Are we strictly aligned?])
fi
dnl ##################################################
dnl # Check for tcpdump.
dnl ##################################################
td=no
AC_ARG_WITH(tcpdump,
AC_HELP_STRING([--with-tcpdump=FILE], [Path to tcpdump binary]),
[ if test -x $withval ; then
td=$withval
AC_MSG_RESULT([Using tcpdump in $td])
else
AC_MSG_RESULT([Error: $withval does not exist or is not executable])
fi ],
[ AC_PATH_PROG(td, tcpdump, "no", [$PATH:/usr/sbin:/sbin:/usr/local/sbin]) ])
if test "$td" = "no"; then
AC_MSG_WARN([Unable to find tcpdump. Please specify --with-tcpdump.
Disabling verbose reporting.])
else
AC_DEFINE([HAVE_TCPDUMP], [], [Do we have tcpdump?])
AC_DEFINE_UNQUOTED(TCPDUMP_BINARY, "$td", [The tcpdump binary initially used])
fi
dnl No 'make test' when cross compile
AC_MSG_CHECKING( for 'make test' profile)
if test "$host" != "$build" ; then
AC_MSG_WARN(Unable to do tests when cross-compiling)
fi
dnl Allows user to choose which nic to use for testing purposes
AC_ARG_WITH(testnic,
AC_HELP_STRING([--with-testnic=NIC], [Select which network card to use for testing]),
[ nic1=$withval
nic2=$withval
AC_MSG_RESULT([Using --with-testnic=$withval])],
[
dnl these need to be dynamic based on OS
case $host in
*-*-linux*)
nic1=eth0
nic2=eth0
AC_MSG_RESULT(Linux)
;;
*-*-solaris*)
nic1=hme0
nic2=hme0
AC_MSG_RESULT(Solaris)
;;
*-*-sunos*)
nic1=hme0
nic2=hme0
AC_MSG_RESULT(SunOS)
;;
powerpc-apple-darwin*)
nic1=en0
nic2=en0
AC_MSG_RESULT(Apple OS X)
;;
*-*-openbsd*)
nic1=xl0
nic2=xl0
AC_MSG_RESULT(OpenBSD)
;;
*)
AC_MSG_RESULT([$host is unknown!
Please use --with-nictest to select an interface for 'make test'])
;;
esac])
AC_ARG_WITH(testnic2,
AC_HELP_STRING([--with-testnic2=NIC2], [Select an optional 2nd network card to use for testing]),
[ nic2=$withval ])
AC_MSG_NOTICE([Using $nic1 for 1st test network interface card])
AC_MSG_NOTICE([Using $nic2 for 2nd test network interface card])
AC_SUBST(nic1)
AC_SUBST(nic2)
LIBOPTS_CHECK
AC_OUTPUT([Makefile
doxygen.cfg
lib/Makefile
docs/Makefile
src/Makefile
src/common/Makefile
src/defines.h
test/Makefile
test/config
scripts/Makefile
tcpreplay.spec])