On Wed, 2007-04-04 at 09:38 -0700, Aaron Turner wrote:
> If you feel
> sufficiently motivated to provide such a patch using libtool I'll be
> more then happy to include it though.
Both libnet and libpcap are not shipping the required .la files (at
least of FC6), so that's going to be a no-go after all. :-(
However, here are patches for the header/library detection and dynamic
linking against libnet/libpcap. Hopefully, they will be useful. I tested
this on FC6 i386 and x86_64 and HP-UX 11.11i PA-RISC, 32-bit (on HP-UX
for configuration only, as the code doesn't compile yet).
I'm having some compilation problems with the trunk on FC6, I'll report
that separately (actually, I have to see if similar bug reports have
already been opened).
--
Bojan
Index: configure.in
===================================================================
--- configure.in (revision 1794)
+++ configure.in (working copy)
@@ -188,17 +188,6 @@
AM_CONDITIONAL([ENABLE_TCPREPLAY_EDIT], [test x$tcpreplay_edit = xyes])
-
-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?])
@@ -251,20 +240,42 @@
AC_HELP_STRING([--with-libnet=DIR], [Use libnet in DIR]),
[trynetdir=$withval])
+old_cppflags="$CPPFLAGS"
+old_ldflags="$LDFLAGS"
+old_libs="$LIBS"
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
+ if test -f "$testdir/include/libnet.h"; then :; else
+ continue
fi
+
+ CPPFLAGS="-I$testdir/include"
+ LDFLAGS="-L$testdir/lib64"
+
+ unset ac_cv_header_libnet_h
+ unset ac_cv_lib_net_libnet_write
+ if test -f "$testdir/lib64/libnet$shrext_cmds" -o -f "$testdir/lib64/libnet.$libext"; then
+ AC_CHECK_HEADERS(libnet.h,AC_CHECK_LIB(net,libnet_write,
+ [foundnet=yes
+ LNETINC="$testdir/include/libnet.h"
+ LNETINCDIR="$testdir/include"
+ LNETLIB="-L$testdir/lib64 -lnet"]))
+ fi
+ if test "$foundnet" = 'no'; then
+ unset ac_cv_lib_net_libnet_write
+ LDFLAGS="-L$testdir/lib"
+ AC_CHECK_HEADERS(libnet.h,AC_CHECK_LIB(net,libnet_write,
+ [foundnet=yes
+ LNETINC="$testdir/include/libnet.h"
+ LNETINCDIR="$testdir/include"
+ LNETLIB="-L$testdir/lib -lnet"]))
+ fi
+ if test "$foundnet" = 'yes'; then
+ break
+ fi
done
+CPPFLAGS="$old_cppflags"
+LDFLAGS="$old_ldflags"
+LIBS="$old_libs"
if test $foundnet = no ; then
AC_MSG_RESULT(no)
@@ -363,39 +374,71 @@
AC_HELP_STRING([--with-libpcap=DIR], [Use libpcap in DIR]),
[trypcapdir=$withval])
- for testdir in $trypcapdir /usr/local /opt/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
- 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"
- else
- AC_ERROR([Unable to find libpcap in ${testdir}])
- fi
- elif test -f "${testdir}/lib64/libpcap.a" ; then
- LPCAPLIB="${testdir}/lib64/libpcap.a"
- elif test -f "${testdir}/lib/libpcap.a" ; then
- LPCAPLIB="${testdir}/lib/libpcap.a"
- elif test -f "${testdir}/lib/libwpcap.a" ; then
- LPCAPLIB="${testdir}/lib/libwpcap.a"
- AC_DEFINE([HAVE_WINPCAP], [1], [Do we have WinPcap?])
- else
- AC_ERROR([Unable to find matching library for header file in ${testdir}])
- fi
- foundpcap=$testdir
- fi
- done
+old_cppflags="$CPPFLAGS"
+old_ldflags="$LDFLAGS"
+old_libs="$LIBS"
+for testdir in $trynetdir /usr/local /opt/local /usr ; do
+ if test -f "$testdir/include/pcap.h"; then :; else
+ continue
+ fi
- if test $foundpcap = no ; then
- AC_MSG_RESULT(no)
- AC_ERROR(libpcap not found)
- else
- AC_MSG_RESULT($foundpcap)
- fi
+ CPPFLAGS="-I$testdir/include"
+ LDFLAGS="-L$testdir/lib64"
+ unset ac_cv_header_pcap_h
+ unset ac_cv_lib_pcap_pcap_close
+ if test -f "$testdir/lib64/libpcap$shrext_cmds" -o -f "$testdir/lib64/libpcap.$libext"; then
+ AC_CHECK_HEADERS(pcap.h,AC_CHECK_LIB(pcap,pcap_close,
+ [foundpcap=yes
+ LPCAPINC="$testdir/include/pcap.h"
+ LPCAPINCDIR="$testdir/include"
+ LPCAPLIB="-L$testdir/lib64 -lpcap"]))
+ fi
+ if test "$foundpcap" = 'no'; then
+ unset ac_cv_lib_pcap_pcap_close
+ LDFLAGS="-L$testdir/lib"
+ AC_CHECK_HEADERS(pcap.h,AC_CHECK_LIB(pcap,pcap_close,
+ [foundpcap=yes
+ LPCAPINC="$testdir/include/pcap.h"
+ LPCAPINCDIR="$testdir/include"
+ LPCAPLIB="-L$testdir/lib -lpcap"]))
+ fi
+ if test "$foundpcap" = 'yes'; then
+ break
+ else
+ unset ac_cv_lib_pcap_spcap_close
+ if test -f "$testdir/lib64/libwpcap$shrext_cmds" -o -f "$testdir/lib64/libwpcap.$libext"; then
+ AC_CHECK_LIB(wpcap,pcap_close,
+ [foundpcap=yes
+ LPCAPINC="$testdir/include/pcap.h"
+ LPCAPINCDIR="$testdir/include"
+ LPCAPLIB="-L$testdir/lib64 -lwpcap"])
+ fi
+ if test "$foundpcap" = 'no'; then
+ unset ac_cv_lib_wpcap_pcap_close
+ LDFLAGS="-L$testdir/lib"
+ AC_CHECK_LIB(wpcap,pcap_close,
+ [foundpcap=yes
+ LPCAPINC="$testdir/include/pcap.h"
+ LPCAPINCDIR="$testdir/include"
+ LPCAPLIB="-L$testdir/lib -lwpcap"])
+ if test "$foundpcap" = 'yes'; then
+ break
+ fi
+ fi
+ fi
+done
+CPPFLAGS="$old_cppflags"
+LDFLAGS="$old_ldflags"
+LIBS="$old_libs"
+
+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)
--- configure.in.orig 2007-04-05 15:08:44.000000000 +1000
+++ configure.in 2007-04-05 15:08:05.000000000 +1000
@@ -190,16 +190,6 @@
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?])
@@ -254,20 +244,42 @@
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
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+ old_libs="$LIBS"
+ for testdir in $trynetdir /usr/local /opt/local /usr ; do
+ if test -f "$testdir/include/libnet.h"; then :; else
+ continue
+ fi
+
+ CPPFLAGS="-I$testdir/include"
+ LDFLAGS="-L$testdir/lib64"
+
+ unset ac_cv_header_libnet_h
+ unset ac_cv_lib_net_libnet_write
+ if test -f "$testdir/lib64/libnet$shrext_cmds" -o -f "$testdir/lib64/libnet.$libext"; then
+ AC_CHECK_HEADERS(libnet.h,AC_CHECK_LIB(net,libnet_write,
+ [foundnet=yes
+ LNETINC="$testdir/include/libnet.h"
+ LNETINCDIR="$testdir/include"
+ LNETLIB="-L$testdir/lib64 -lnet"]))
+ fi
+ if test "$foundnet" = 'no'; then
+ unset ac_cv_lib_net_libnet_write
+ LDFLAGS="-L$testdir/lib"
+ AC_CHECK_HEADERS(libnet.h,AC_CHECK_LIB(net,libnet_write,
+ [foundnet=yes
+ LNETINC="$testdir/include/libnet.h"
+ LNETINCDIR="$testdir/include"
+ LNETLIB="-L$testdir/lib -lnet"]))
+ fi
+ if test "$foundnet" = 'yes'; then
+ break
+ fi
+ done
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
+ LIBS="$old_libs"
if test $foundnet = no ; then
AC_MSG_RESULT(no)
@@ -369,25 +381,63 @@
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"
- elif test -f "${testdir}/lib/libpcap.a" ; then
- LPCAPLIB="${testdir}/lib/libpcap.a"
- elif test -f "${testdir}/lib/libwpcap.a" ; then
- LPCAPLIB="${testdir}/lib/libwpcap.a"
- AC_DEFINE([HAVE_WINPCAP], [1], [Do we have WinPcap?])
- else
- AC_ERROR([Unable to find matching library for header file in ${testdir}])
- fi
- foundpcap=$testdir
- fi
- done
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+ old_libs="$LIBS"
+ for testdir in $trynetdir /usr/local /opt/local /usr ; do
+ if test -f "$testdir/include/pcap.h"; then :; else
+ continue
+ fi
+
+ CPPFLAGS="-I$testdir/include"
+ LDFLAGS="-L$testdir/lib64"
+
+ unset ac_cv_header_pcap_h
+ unset ac_cv_lib_pcap_pcap_close
+ if test -f "$testdir/lib64/libpcap$shrext_cmds" -o -f "$testdir/lib64/libpcap.$libext"; then
+ AC_CHECK_HEADERS(pcap.h,AC_CHECK_LIB(pcap,pcap_close,
+ [foundpcap=yes
+ LPCAPINC="$testdir/include/pcap.h"
+ LPCAPINCDIR="$testdir/include"
+ LPCAPLIB="-L$testdir/lib64 -lpcap"]))
+ fi
+ if test "$foundpcap" = 'no'; then
+ unset ac_cv_lib_pcap_pcap_close
+ LDFLAGS="-L$testdir/lib"
+ AC_CHECK_HEADERS(pcap.h,AC_CHECK_LIB(pcap,pcap_close,
+ [foundpcap=yes
+ LPCAPINC="$testdir/include/pcap.h"
+ LPCAPINCDIR="$testdir/include"
+ LPCAPLIB="-L$testdir/lib -lpcap"]))
+ fi
+ if test "$foundpcap" = 'yes'; then
+ break
+ else
+ unset ac_cv_lib_pcap_spcap_close
+ if test -f "$testdir/lib64/libwpcap$shrext_cmds" -o -f "$testdir/lib64/libwpcap.$libext"; then
+ AC_CHECK_LIB(wpcap,pcap_close,
+ [foundpcap=yes
+ LPCAPINC="$testdir/include/pcap.h"
+ LPCAPINCDIR="$testdir/include"
+ LPCAPLIB="-L$testdir/lib64 -lwpcap"])
+ fi
+ if test "$foundpcap" = 'no'; then
+ unset ac_cv_lib_wpcap_pcap_close
+ LDFLAGS="-L$testdir/lib"
+ AC_CHECK_LIB(wpcap,pcap_close,
+ [foundpcap=yes
+ LPCAPINC="$testdir/include/pcap.h"
+ LPCAPINCDIR="$testdir/include"
+ LPCAPLIB="-L$testdir/lib -lwpcap"])
+ if test "$foundpcap" = 'yes'; then
+ break
+ fi
+ fi
+ fi
+ done
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
+ LIBS="$old_libs"
if test $foundpcap = no ; then
AC_MSG_RESULT(no)
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Tcpreplay-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tcpreplay-users