123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930 |
- dnl $Id: configure.in 1578 2006-08-08 04:02:14Z aturner $
- 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=beta11
- 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=gnu99" # -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 snprintf vsnprintf])
- 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
- # check for gcc 4.0 flags -Wfatal-errors & -Wno-variadic-macros support
- CFLAGS="-ggdb -std=gnu99 -Wall -Wextra -Wfatal-errors -Wno-variadic-macros"
- AC_COMPILE_IFELSE([#include <stdlib.h>
- int main(int argc, char *argv[]) { return(0); }],
- [CFLAGS="-ggdb -std=gnu99 -Wall -Wextra -Wfatal-errors -Wno-variadic-macros"],
- [CFLAGS="-ggdb -std=gnu99 -Wall -Wextra"])
- # We may also want to add:
- # -Wformat-security -Wswitch-default -Wunused-paramter -Wpadded"
- AC_SUBST(debug_flag)
- AC_DEFINE([DEBUG], [1], [Enable debuging code and support for the -d option])
- fi])
- AC_ARG_ENABLE(pedantic,
- AC_HELP_STRING([--enable-pedantic], [Enable gcc's -pedantic option]),
- [ if test x$enableval = xyes; then
- CFLAGS="$CFLAGS -pedantic"
- 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], [1], [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], [1], [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], [1], [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
- ])
- disable_bpf=no
- dnl Turn off *BSD's BPF
- AC_ARG_ENABLE(bpf,
- AC_HELP_STRING([--disable-bpf], [Disable BPF for sending packets]),
- [ disable_bpf=yes ])
-
- disable_pf=no
- dnl Turn off Linux's PF_PACKET
- AC_ARG_ENABLE(pf,
- AC_HELP_STRING([--disable-pf], [Disable Linux PF_PACKET for sending packets]),
- [ if test x$enableval = xno ; then
- disable_pf=yes
- fi
- ])
-
- disable_libnet=no
- dnl Turn of Libnet
- AC_ARG_ENABLE(libnet,
- AC_HELP_STRING([--disable-libnet], [Disable Libnet for sending packets]),
- [ if test x$enableval = xno ; then
- disable_libnet=yes
- fi
- ])
-
- disable_pcap=no
- dnl Turn off pcap for sending
- AC_ARG_ENABLE(pcap,
- AC_HELP_STRING([--disable-pcap], [Disable Libpcap for sending packets]),
- [ if test x$enableval = xno ; then
- disable_pcap=yes
- 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], [1], [Enable dynamically linking libs])
- dynamic_link=yes
- fi
- ])
- dnl Check for inet_aton and inet_pton
- AC_CHECK_FUNC(inet_aton,
- AC_DEFINE([HAVE_INET_ATON], [1], [Do we have inet_aton?])
- inet_aton=yes,
- inet_aton=no)
- AC_CHECK_FUNC(inet_pton,
- AC_DEFINE([HAVE_INET_PTON], [1], [Do we have inet_pton?])
- inet_pton=yes,
- inet_pton=no)
- AC_CHECK_FUNC(inet_ntop,
- AC_DEFINE([HAVE_INET_NTOP], [1], [Do we have inet_ntop?])
- inet_ntop=yes,
- inet_ntop=no)
- if test "$inet_ntop" = "no" -a "$inet_pton" = "no" ; then
- AC_MSG_ERROR([We need either inet_ntop or inet_pton])
- fi
- if test "$inet_aton" = "no" ; then
- AC_MSG_ERROR([We need inet_aton])
- fi
- AC_CHECK_FUNC(inet_addr,
- AC_DEFINE([HAVE_INET_ADDR], [1], [Do we have inet_addr?])
- inet_addr=yes,
- inet_addr=no)
- if test x$inet_addr = no ; then
- AC_MSG_ERROR([We need inet_addr. See bug 26])
- fi
- dnl Enable flowreplay
- flowreplay=no
- AC_ARG_ENABLE(flowreplay,
- AC_HELP_STRING([--enable-flowreplay], [Enable building flowreplay (alpha)]),
- [ if test x$enableval = xyes; then
- flowreplay=yes
- AC_DEFINE([ENABLE_FLOWREPLAY], [1], [Enable building flowreplay (alpha)])
- fi])
- AM_CONDITIONAL(ENABLE_FLOWREPLAY, [test x$flowreplay = xyes])
- dnl ##################################################
- dnl Checks for libnet (shamelessly horked from dsniff)
- dnl ##################################################
- foundnet=no
- if test $disable_libnet = no ; then
- 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)
- else
- AC_MSG_RESULT($foundnet)
- AC_DEFINE([HAVE_LIBNET], [1], [Enable libnet support])
- fi
- AC_SUBST(LNETINC)
- AC_SUBST(LNETLIB)
- fi
- dnl END OF if $disable_libnet = no ; then
- if test $foundnet = yes ; then
- 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
- dnl restore LIBS & CFLAGS
- LIBS="$OLDLIBS"
- CFLAGS="$OLDCFLAGS"
- fi
- dnl END OF if test $foundnet = yes
- 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"
- have_libnet=no
- 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
- AC_MSG_RESULT(< 0.5)
- )
- 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
- AC_MSG_RESULT(no)
- )
- if test $have_dlt_to_desc = yes ; then
- AC_DEFINE([HAVE_DLT_VAL_TO_DESC], [1],
- [Does libpcap have dlt_val_to_desc?])
- fi
- dnl This message is placed here for continuity purposes
- dnl but things are really set above in the libnet section
- AC_MSG_CHECKING(for libnet packet sending support)
- if test $disable_libnet = no -a $foundnet != no ; then
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_LIBNET], [1], [Do we support libnet for sending packets?])
- have_libnet=yes
- else
- AC_MSG_RESULT(no)
- fi
- have_pcap_inject=no
- dnl Check to see if we've got pcap_inject()
- AC_MSG_CHECKING(for pcap_inject sending support)
- AC_TRY_COMPILE([
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "$LPCAPINC"
- ],[
- pcap_t *pcap;
- char *buf;
- pcap_inject(pcap, (void *)buf, 0);
- ],[
- if test $disable_pcap = no ; then
- AC_DEFINE([HAVE_PCAP_INJECT], [1],
- [Does libpcap have pcap_inject?])
- AC_MSG_RESULT(yes)
- have_pcap_inject=yes
- else
- AC_MSG_RESULT(no)
- fi
- ],[
- AC_MSG_RESULT(no)
- ])
- have_pcap_sendpacket=no
- dnl Check to see if we've got pcap_sendpacket()
- AC_MSG_CHECKING(for pcap_sendpacket sending support)
- AC_TRY_COMPILE([
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "$LPCAPINC"
- ],[
- pcap_t *pcap;
- u_char *buf;
- pcap_sendpacket(pcap, buf, 0);
- ],[
- if test $disable_pcap = no ; then
- AC_DEFINE([HAVE_PCAP_SENDPACKET], [1],
- [Does libpcap have pcap_sendpacket?])
- AC_MSG_RESULT(yes)
- have_pcap_sendpacket=yes
- else
- AC_MSG_RESULT(no)
- fi
- ],[
- AC_MSG_RESULT(no)
- ])
- have_pf=no
- dnl Check for linux PF_PACKET support
- AC_MSG_CHECKING(for PF_PACKET socket sending support)
- AC_TRY_COMPILE([
- #include <sys/socket.h>
- #include <netpacket/packet.h>
- #include <net/ethernet.h> /* the L2 protocols */
- #include <netinet/in.h> /* htons */
- ],[
- int pf_socket;
- pf_socket = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
- ],[
- if test $disable_pf = no ; then
- AC_DEFINE([HAVE_PF_PACKET], [1],
- [Do we have Linux PF_PACKET socket support?])
- AC_MSG_RESULT(yes)
- have_pf=yes
- else
- AC_MSG_RESULT(no)
- fi
- ],[
- AC_MSG_RESULT(no)
- ])
- have_bpf=no
- dnl Check for BSD's BPF
- AC_MSG_CHECKING(for BPF device sending support)
- AC_TRY_RUN([
- #include <stdio.h>
- #include <stdlib.h>
- #include <net/bpf.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <fcntl.h>
- #include <sys/time.h>
- #include <sys/ioctl.h>
- #include <net/bpf.h>
- #include <errno.h>
- int
- main(int argc, char *argv[]) {
- int fd;
-
- fd = open("/dev/bpf0", O_RDONLY, 0);
-
- /* if we opened it, we're good */
- if (fd > 1)
- exit(0);
-
- /* if we got EBUSY or permission denied it exists, so we're good */
- if (fd < 0 && (errno == EBUSY || errno == 13))
- exit(0);
-
- /* else suck, no good */
- exit(-1);
- }],
- [
- if test $disable_bpf = no ; then
- AC_DEFINE([HAVE_BPF], [1],
- [Do we have BPF device support?])
- AC_MSG_RESULT(yes)
- have_bpf=yes
- else
- AC_MSG_RESULT(no)
- fi
- ])
- dnl Make sure we have a valid packet injection mechanisim
- if test $have_bpf = no -a $have_pcap_inject = no -a $have_pcap_sendpacket = no \
- -a $have_libnet = no -a $have_pf = no ; then
- AC_MSG_ERROR([Unable to find a supported method to send packets])
- fi
- dnl Libpcap support doesn't give us a method to get the hardware address of the
- dnl interfaces which prevents us from doing proper filtering to prevent bridging loops
- enable_tcpbridge=yes
- if test $have_bpf = no -a $have_libnet = no -a $have_pf = no ; then
- AC_MSG_NOTICE([tcpbridge support disabled without BPF, Libnet or Linux PF_PACKET])
- enable_tcpbridge=no
- fi
- AM_CONDITIONAL(ENABLE_TCPBRIDGE, [test $enable_tcpbridge = yes])
- 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], [1],
- [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], [1],
- [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], [1],
- [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)
- elif test x$withval = xno ; then
- AC_MSG_RESULT(no)
- 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], [1], [Do we have libpcapnav?])
- fi
- fi # checking pcapnav version
- 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], [1], [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/tcpedit/Makefile
- src/flow/Makefile
- src/defines.h
- test/Makefile
- test/config
- scripts/Makefile
- tcpreplay.spec])
- if test $doctools = no; then
- AC_MSG_NOTICE([One or more tool for creating documentation is unavailable.])
- AC_MSG_NOTICE([This is only an issue for developers, so don't worry.])
- fi
|