|  | @@ -1,5 +1,5 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -dnl $Id: configure.in 1808 2007-04-15 01:46:13Z aturner $
 | 
	
		
			
				|  |  | +dnl $Id: configure.in 1857 2007-05-02 05:07:52Z aturner $
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  AC_INIT(tcpreplay)
 | 
	
		
			
				|  |  |  AC_CONFIG_SRCDIR(src/tcpreplay.c)
 | 
	
	
		
			
				|  | @@ -7,12 +7,11 @@ 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=RC1
 | 
	
		
			
				|  |  | +MICRO_VERSION=1
 | 
	
		
			
				|  |  |  TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  dnl Release is only used for the RPM spec file
 | 
	
	
		
			
				|  | @@ -23,7 +22,8 @@ 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"
 | 
	
		
			
				|  |  | +USER_CFLAGS=$CFLAGS
 | 
	
		
			
				|  |  | +CFLAGS="${CFLAGS} -Wall -O3 -std=gnu99"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  dnl Determine OS
 | 
	
		
			
				|  |  |  AC_CANONICAL_BUILD
 | 
	
	
		
			
				|  | @@ -54,11 +54,28 @@ AC_PROG_CPP
 | 
	
		
			
				|  |  |  AC_PROG_LN_S
 | 
	
		
			
				|  |  |  AC_PROG_RANLIB
 | 
	
		
			
				|  |  |  AC_PROG_AWK
 | 
	
		
			
				|  |  | +AC_PROG_SED
 | 
	
		
			
				|  |  |  AC_PROG_MAKE_SET
 | 
	
		
			
				|  |  |  AC_EXEEXT
 | 
	
		
			
				|  |  |  AC_PATH_PROG(PRINTF, printf)
 | 
	
		
			
				|  |  |  AC_PATH_PROG(AUTOGEN, autogen)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +dnl check autogen version
 | 
	
		
			
				|  |  | +if test -n "${AUTOGEN}" ; then
 | 
	
		
			
				|  |  | +	AC_MSG_CHECKING(for autogen version >= 5.9)
 | 
	
		
			
				|  |  | +	AUTOGEN_VERSION=`${AUTOGEN} -v | ${SED} 's|.*\([[0-9\.]]\{3,\}\)$|\1|'`
 | 
	
		
			
				|  |  | +	AUTOGEN_MAJOR=`echo ${AUTOGEN_VERSION} | ${SED} 's|^\([[0-9]]\)\.[[0-9]]|\1|'`
 | 
	
		
			
				|  |  | +	AUTOGEN_MINOR=`echo ${AUTOGEN_VERSION} | ${SED} 's|^\([[0-9]]\)\.\([[0-9]]\)|\2|'`
 | 
	
		
			
				|  |  | +	if test ${AUTOGEN_MAJOR} -le 5 && test ${AUTOGEN_MINOR} -lt 9 || test ${AUTOGEN_MAJOR} -lt 5 ; then
 | 
	
		
			
				|  |  | +		AC_MSG_RESULT(no)
 | 
	
		
			
				|  |  | +		AC_MSG_WARN([${AUTOGEN} is too old (${AUTOGEN_VERSION}) for building from SVN.  Please upgrade to 5.9)])
 | 
	
		
			
				|  |  | +	else
 | 
	
		
			
				|  |  | +		AC_MSG_RESULT(yes)
 | 
	
		
			
				|  |  | +	fi
 | 
	
		
			
				|  |  | +else
 | 
	
		
			
				|  |  | +	AC_MSG_WARN([Please install autogen >= 5.9 if you are building from SVN])
 | 
	
		
			
				|  |  | +fi
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  AC_HEADER_STDC
 | 
	
		
			
				|  |  |  AC_HEADER_MAJOR
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -158,7 +175,7 @@ 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 -std=gnu99 -Wall $wextra $wfatal_errors $wno_variadic_macros"
 | 
	
		
			
				|  |  | +	CFLAGS="${USER_CFLAGS} -ggdb -std=gnu99 -Wall $wextra $wfatal_errors $wno_variadic_macros"
 | 
	
		
			
				|  |  |  # We may also want to add:
 | 
	
		
			
				|  |  |  #         -Wformat-security -Wswitch-default -Wunused-paramter -Wpadded"
 | 
	
		
			
				|  |  |           AC_SUBST(debug_flag)
 | 
	
	
		
			
				|  | @@ -288,41 +305,68 @@ AC_ARG_ENABLE(flowreplay,
 | 
	
		
			
				|  |  |  AM_CONDITIONAL([ENABLE_FLOWREPLAY], [test x$flowreplay = xyes])
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  dnl ##################################################
 | 
	
		
			
				|  |  | -dnl Checks for libnet (shamelessly horked from dsniff)
 | 
	
		
			
				|  |  | +dnl Checks for libnet IFF you specify --enable-libnet.
 | 
	
		
			
				|  |  | +dnl We no longer by default use libnet unless you tell me to.
 | 
	
		
			
				|  |  |  dnl ##################################################
 | 
	
		
			
				|  |  |  foundnet=no
 | 
	
		
			
				|  |  | -trynetdir=/usr/local
 | 
	
		
			
				|  |  | -AC_MSG_CHECKING(for libnet)
 | 
	
		
			
				|  |  | +trynetdir=no
 | 
	
		
			
				|  |  | +have_libnet=no
 | 
	
		
			
				|  |  | +use_libnet=no
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +AC_ARG_ENABLE(libnet,
 | 
	
		
			
				|  |  | +	AC_HELP_STRING([--enable-libnet], [Enable using the libnet 1.1.x library (deprecated)]),
 | 
	
		
			
				|  |  | +	[ if test x$enableval = xyes; then
 | 
	
		
			
				|  |  | +		use_libnet=yes
 | 
	
		
			
				|  |  | +		AC_MSG_WARN([Due to bugs in libnet, it is no longer officially supported])
 | 
	
		
			
				|  |  | +	  fi]
 | 
	
		
			
				|  |  | +)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  AC_ARG_WITH(libnet,
 | 
	
		
			
				|  |  |      AC_HELP_STRING([--with-libnet=DIR], [Use libnet in DIR]),
 | 
	
		
			
				|  |  |      [trynetdir=$withval])
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -for testdir in $trynetdir /usr/local /opt/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 x$use_libnet = xyes ; then
 | 
	
		
			
				|  |  | +	AC_MSG_CHECKING(for libnet)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	for testdir in $trynetdir /usr/local /opt/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
 | 
	
		
			
				|  |  | +				if test -f "${testdir}/lib64/libnet.a" ; then
 | 
	
		
			
				|  |  | +		            LNETLIB="-L${testdir}/lib64 -lnet"
 | 
	
		
			
				|  |  | +				elif test -f "${testdir}/lib/libnet.a" ; then
 | 
	
		
			
				|  |  | +					LNETLIB="-L${testdir}/lib -lnet"
 | 
	
		
			
				|  |  | +				else
 | 
	
		
			
				|  |  | +					AC_ERROR([Unable to find libnet in ${testdir}])
 | 
	
		
			
				|  |  | +				fi
 | 
	
		
			
				|  |  | +	        elif test -f "${testdir}/lib64/libnet.a" ; then
 | 
	
		
			
				|  |  | +	            LNETLIB="${testdir}/lib64/libnet.a"
 | 
	
		
			
				|  |  | +	        elif test -f "${testdir}/lib/libnet.a" ; then
 | 
	
		
			
				|  |  | +	            LNETLIB="${testdir}/lib/libnet.a"
 | 
	
		
			
				|  |  | +		 	else
 | 
	
		
			
				|  |  | +				AC_ERROR([Unable to find matching library for header file in ${testdir}])
 | 
	
		
			
				|  |  | +			fi
 | 
	
		
			
				|  |  | +        	foundnet=$testdir
 | 
	
		
			
				|  |  | +     	fi
 | 
	
		
			
				|  |  | +	done
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	if test x$foundnet = xno ; then
 | 
	
		
			
				|  |  | +	    AC_MSG_RESULT(no)
 | 
	
		
			
				|  |  | +	else
 | 
	
		
			
				|  |  | +	    AC_MSG_RESULT($foundnet)
 | 
	
		
			
				|  |  | +		have_libnet=yes
 | 
	
		
			
				|  |  | +		AC_DEFINE([HAVE_LIBNET], [1], [Enable libnet support])
 | 
	
		
			
				|  |  | +	fi
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -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)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -if test $foundnet = yes ; then
 | 
	
		
			
				|  |  | +if test $foundnet != no ; then
 | 
	
		
			
				|  |  |  	OLDLIBS="$LIBS"
 | 
	
		
			
				|  |  |  	OLDCFLAGS="$CFLAGS"
 | 
	
		
			
				|  |  |  	LIBS="$LNETLIB"
 | 
	
	
		
			
				|  | @@ -414,10 +458,10 @@ AC_ARG_WITH(libpcap,
 | 
	
		
			
				|  |  |          	LPCAPINC="${testdir}/include/pcap.h"
 | 
	
		
			
				|  |  |  	        LPCAPINCDIR="${testdir}/include"
 | 
	
		
			
				|  |  |  	        if test $dynamic_link = yes; then
 | 
	
		
			
				|  |  | -				if test -f "${testdir}/lib/libpcap.a" ; then
 | 
	
		
			
				|  |  | -		            LPCAPLIB="-L${testdir}/lib -lpcap"
 | 
	
		
			
				|  |  | -				elif test -f "${testdir}/lib64/libpcap.a" ; then
 | 
	
		
			
				|  |  | -					LPCAPLIB="-L${testdir}/lib64 -lpcap"
 | 
	
		
			
				|  |  | +				if test -f "${testdir}/lib64/libpcap.a" ; then
 | 
	
		
			
				|  |  | +		            LPCAPLIB="-L${testdir}/lib64 -lpcap"
 | 
	
		
			
				|  |  | +				elif test -f "${testdir}/lib/libpcap.a" ; then
 | 
	
		
			
				|  |  | +					LPCAPLIB="-L${testdir}/lib -lpcap"
 | 
	
		
			
				|  |  |  				else
 | 
	
		
			
				|  |  |  					AC_ERROR([Unable to find libpcap in ${testdir}])
 | 
	
		
			
				|  |  |  				fi
 | 
	
	
		
			
				|  | @@ -452,7 +496,6 @@ 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
 | 
	
	
		
			
				|  | @@ -568,31 +611,6 @@ else
 | 
	
		
			
				|  |  |  	AC_MSG_NOTICE([--verbose mode requires libpcap >= 0.9.0])
 | 
	
		
			
				|  |  |  fi
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -dnl Check to see if we've got pcap_snapshot_override()
 | 
	
		
			
				|  |  | -AC_MSG_CHECKING(for pcap_snapshot_override)
 | 
	
		
			
				|  |  | -AC_LINK_IFELSE(AC_LANG_PROGRAM([[
 | 
	
		
			
				|  |  | -#include <stdio.h>
 | 
	
		
			
				|  |  | -#include <stdlib.h>
 | 
	
		
			
				|  |  | -#include <string.h>
 | 
	
		
			
				|  |  | -#include "$LPCAPINC"
 | 
	
		
			
				|  |  | -]],[[
 | 
	
		
			
				|  |  | -	pcap_t *pcap;
 | 
	
		
			
				|  |  | -	pcap_snapshot_override(pcap, 1);
 | 
	
		
			
				|  |  | -	exit(0);
 | 
	
		
			
				|  |  | -]]),[
 | 
	
		
			
				|  |  | -    have_pcap_snapshot_override=yes
 | 
	
		
			
				|  |  | -    AC_MSG_RESULT(yes)
 | 
	
		
			
				|  |  | -], [
 | 
	
		
			
				|  |  | -    have_pcap_snapshot_override=no
 | 
	
		
			
				|  |  | -    AC_MSG_RESULT(no)
 | 
	
		
			
				|  |  | -])
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -if test $have_pcap_snapshot_override = yes ; then
 | 
	
		
			
				|  |  | -    AC_DEFINE([HAVE_PCAP_SNAPSHOT_OVERRIDE], [1], 
 | 
	
		
			
				|  |  | -              [Does libpcap have pcap_snapshot_override()?])
 | 
	
		
			
				|  |  | -fi
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  have_pcap_inject=no
 | 
	
		
			
				|  |  |  dnl Check to see if we've got pcap_inject()
 | 
	
		
			
				|  |  |  AC_MSG_CHECKING(for pcap_inject sending support)
 | 
	
	
		
			
				|  | @@ -710,13 +728,15 @@ main(int argc, char *argv[]) {
 | 
	
		
			
				|  |  |                [Do we have BPF device support?])
 | 
	
		
			
				|  |  |  	AC_MSG_RESULT(yes)
 | 
	
		
			
				|  |  |  	have_bpf=yes
 | 
	
		
			
				|  |  | +	],[
 | 
	
		
			
				|  |  | +	AC_MSG_RESULT(no)
 | 
	
		
			
				|  |  |  	])
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  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])
 | 
	
		
			
				|  |  | +	AC_MSG_ERROR([Unable to find a supported method to send packets.  Please upgrade your libpcap or enable libnet])
 | 
	
		
			
				|  |  |  fi
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  dnl Libpcap support doesn't give us a method to get the hardware address of the
 | 
	
	
		
			
				|  | @@ -962,7 +982,7 @@ fi
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  dnl No 'make test' when cross compile
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -AC_MSG_CHECKING( for 'make test' profile)
 | 
	
		
			
				|  |  | +AC_MSG_CHECKING(for 'make test' profile)
 | 
	
		
			
				|  |  |  if test "$host" != "$build" ; then
 | 
	
		
			
				|  |  |  	AC_MSG_WARN(Unable to do tests when cross-compiling)
 | 
	
		
			
				|  |  |  fi
 | 
	
	
		
			
				|  | @@ -974,6 +994,12 @@ AC_ARG_WITH(testnic,
 | 
	
		
			
				|  |  |        nic2=$withval
 | 
	
		
			
				|  |  |        AC_MSG_RESULT([Using --with-testnic=$withval])],
 | 
	
		
			
				|  |  |      [
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +dnl There's a bug in OS X which causes pcap_findalldevs() to make the wifi NIC to disassociate
 | 
	
		
			
				|  |  | +dnl so under OSX we disable the interface list feature
 | 
	
		
			
				|  |  | +disable_pcap_findalldevs=no
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  dnl these need to be dynamic based on OS
 | 
	
		
			
				|  |  |  case $host in
 | 
	
		
			
				|  |  |  	*-*-linux*)
 | 
	
	
		
			
				|  | @@ -997,6 +1023,7 @@ case $host in
 | 
	
		
			
				|  |  |  	*-apple-darwin*)
 | 
	
		
			
				|  |  |  	nic1=en0
 | 
	
		
			
				|  |  |  	nic2=en0
 | 
	
		
			
				|  |  | +	disable_pcap_findalldevs=yes
 | 
	
		
			
				|  |  |  	AC_MSG_RESULT(Apple OS X)
 | 
	
		
			
				|  |  |  	;;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1029,6 +1056,15 @@ AC_MSG_NOTICE([Using $nic2 for 2nd test network interface card])
 | 
	
		
			
				|  |  |  AC_SUBST(nic1)
 | 
	
		
			
				|  |  |  AC_SUBST(nic2)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +AC_MSG_CHECKING([if it's ok to use pcap_findalldevs()])
 | 
	
		
			
				|  |  | +if test x$disable_pcap_findalldevs = xno ; then
 | 
	
		
			
				|  |  | +	AC_DEFINE([ENABLE_PCAP_FINDALLDEVS], [1], [Enable use of pcap_findalldevs()])
 | 
	
		
			
				|  |  | +	AC_MSG_RESULT(yes)
 | 
	
		
			
				|  |  | +else
 | 
	
		
			
				|  |  | +	AC_MSG_RESULT(no)
 | 
	
		
			
				|  |  | +fi
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  LIBOPTS_CHECK
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  AC_OUTPUT([Makefile
 | 
	
	
		
			
				|  | @@ -1044,3 +1080,13 @@ AC_OUTPUT([Makefile
 | 
	
		
			
				|  |  |             test/config
 | 
	
		
			
				|  |  |             scripts/Makefile
 | 
	
		
			
				|  |  |             tcpreplay.spec])
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +case $host in
 | 
	
		
			
				|  |  | +	*-apple-darwin*)
 | 
	
		
			
				|  |  | +	AC_MSG_WARN([OS X <= 10.4.9 has a serious problem.  Please see: http://tcpreplay.synfin.net/trac/ticket/142])
 | 
	
		
			
				|  |  | +	;;
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	*-*-cygwin)
 | 
	
		
			
				|  |  | +	AC_MSG_WARN([Windows/Cygwin support is still somewhat experimental.  Please report any bugs!])
 | 
	
		
			
				|  |  | +	;;
 | 
	
		
			
				|  |  | +esac
 |