From 134c7734b3754ca9611aaf4cfd752be9ab5deade Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 25 Apr 2006 18:01:43 +0000 Subject: [PATCH] Check several sets of additional libraries that libpcap might need (-lcfg -lodm on AIX with the current tcpdump.org libpcap, -lpfring with the ring buffer stuff on Linux). svn path=/trunk/; revision=17996 --- acinclude.m4 | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index c3632eb65b..e831c7372b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -367,31 +367,48 @@ and did you also install that package?]])) # # Check to see if we find "pcap_open_live" in "-lpcap". + # Also check for various additional libraries that libpcap might + # require. # AC_CHECK_LIB(pcap, pcap_open_live, [ PCAP_LIBS=-lpcap AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library]) ], [ - AC_MSG_CHECKING([for pcap_open_live in -lpcap -lcfg -lodm]) + ac_ethereal_extras_found=no ac_save_LIBS="$LIBS" - LIBS="-lpcap -lcfg -lodm" - AC_TRY_LINK( - [ + for extras in "-lcfg -lodm" "-lpfring" + do + AC_MSG_CHECKING([for pcap_open_live in -lpcap with $extras]) + LIBS="-lpcap $extras" + # + # XXX - can't we use AC_CHECK_LIB here? + # + AC_TRY_LINK( + [ # include - ], - [ + ], + [ pcap_open_live(NULL, 0, 0, 0, NULL); - ], - [ - AC_MSG_RESULT([yes]) - PCAP_LIBS="-lpcap -lcfg -lodm" - AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library]) - ], - [ - AC_MSG_RESULT([no]) - AC_MSG_ERROR([Library libpcap not found.]) - ]) + ], + [ + ac_ethereal_extras_found=yes + AC_MSG_RESULT([yes]) + PCAP_LIBS="-lpcap $extras" + AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library]) + ], + [ + AC_MSG_RESULT([no]) + ]) + if test x$ac_ethereal_extras_found = xyes + then + break + fi + done + if test x$ac_ethereal_extras_found = xno + then + AC_MSG_ERROR([Can't link with library libpcap.]) + fi LIBS=$ac_save_LIBS ], $SOCKET_LIBS $NSL_LIBS) AC_SUBST(PCAP_LIBS)