ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: [Ethereal-dev] [PATCH] Detect WinPcap from Unix-style build on Cygwin

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Noah Misch <noah@xxxxxxxxxxxxxx>
Date: Mon, 7 Jun 2004 05:16:29 -0700
This patch allows the Unix build process to find libpcap as -lwpcap, the name it
takes when in the form of WinPcap.  This lets one build on Cygwin with a simple
--with-pcap=/cygdrive/c/ethereal-win32-libs/wpdpack, assuming one has set up the
libraries directory for a VC++ build.

I tested on Windows 2000 with a very recent Cygwin and the WinPcap developer
pack that win32-setup.sh downloads.  I also tested on Fedora Core 1.  I lack
access to an AIX(?) machine on which to test the -lcfg -lodm logic, however.

Index: acinclude.m4
===================================================================
RCS file: /cvsroot/ethereal/acinclude.m4,v
retrieving revision 1.76
diff -u -r1.76 acinclude.m4
--- acinclude.m4	18 May 2004 11:11:37 -0000	1.76
+++ acinclude.m4	5 Jun 2004 04:04:06 -0000
@@ -322,15 +322,16 @@
 and did you also install that package?]]))
 
 	#
-	# Check to see if we find "pcap_open_live" in "-lpcap".
+	# Look for a libpcap implementation.
 	#
-	AC_CHECK_LIB(pcap, pcap_open_live,
+	ac_save_LIBS="$LIBS"
+	LIBS=""
+	AC_SEARCH_LIBS(pcap_open_live, [pcap wpcap],
 	  [
-	    PCAP_LIBS=-lpcap
+	    PCAP_LIBS="$LIBS"
 	    AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
 	  ], [
 	    AC_MSG_CHECKING([for pcap_open_live in -lpcap -lcfg -lodm])
-	    ac_save_LIBS="$LIBS"
 	    LIBS="-lpcap -lcfg -lodm"
 	    AC_TRY_LINK(
 		[
@@ -348,8 +349,8 @@
 		AC_MSG_RESULT([no])
 		AC_MSG_ERROR([Library libpcap not found.])
 		])
-	    LIBS=$ac_save_LIBS
 	  ], $SOCKET_LIBS $NSL_LIBS)
+	LIBS="$ac_save_LIBS"
 	AC_SUBST(PCAP_LIBS)
 
 	#