Ethereal-dev: [Ethereal-dev] [PATCH] Make Net-SNMP Optional for VC++ Build
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: Fri, 4 Jun 2004 23:22:30 -0700
This patch makes Net-SNMP optional under the VC++ build process in much the same way that zlib and ADNS are already optional. Why bother? The Net-SNMP binary distribution comes in the form of a static library with dynamic C runtime linkage (MSVCRT). To link it to ethereal, ethereal must also use MSVCRT. I cannot do this easily because I am building with the Visual C++ 2003 Toolkit, the no-cost distribution of the Microsoft compilers. That package does not include MSVCRT.lib, and my attempts at generating one did not result in complete success. Notably, the other ethereal dependencies all ship as DLLs, and as such do not create this problem. Index: Makefile.nmake =================================================================== RCS file: /cvsroot/ethereal/Makefile.nmake,v retrieving revision 1.420 diff -u -r1.420 Makefile.nmake --- Makefile.nmake 21 May 2004 17:25:32 -0000 1.420 +++ Makefile.nmake 5 Jun 2004 05:03:59 -0000 @@ -14,8 +14,7 @@ LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS) CFLAGS=-DHAVE_CONFIG_H $(LOCAL_CFLAGS) $(GLIB_CFLAGS) /I. /Iwiretap \ - $(ZLIB_CFLAGS) /I$(PCAP_DIR)\include \ - /I$(NET_SNMP_DIR)\include /I$(NET_SNMP_DIR)\win32 \ + $(ZLIB_CFLAGS) /I$(PCAP_DIR)\include $(NET_SNMP_CFLAGS) \ $(ADNS_CFLAGS) $(PCRE_CFLAGS) -D_U_="" CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL @@ -56,7 +55,7 @@ ethereal_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ wsock32.lib user32.lib \ - $(NET_SNMP_DIR)\win32\lib\netsnmp.lib \ + $(NET_SNMP_LIBS) \ !IFDEF ENABLE_LIBETHEREAL epan\libethereal.lib \ !ELSE @@ -72,7 +71,7 @@ tethereal_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ wsock32.lib user32.lib \ $(GLIB_LIBS) \ - $(NET_SNMP_DIR)\win32\lib\netsnmp.lib \ + $(NET_SNMP_LIBS) \ !IFDEF ENABLE_LIBETHEREAL epan\libethereal.lib \ !ELSE @@ -95,7 +94,7 @@ dftest_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ wsock32.lib user32.lib \ $(GLIB_LIBS) \ - $(NET_SNMP_DIR)\win32\lib\netsnmp.lib \ + $(NET_SNMP_LIBS) \ !IFDEF ENABLE_LIBETHEREAL epan\libethereal.lib \ !ELSE @@ -110,7 +109,7 @@ randpkt_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ user32.lib \ $(GLIB_LIBS) \ - $(NET_SNMP_DIR)\win32\lib\netsnmp.lib + $(NET_SNMP_LIBS) EXECUTABLES=ethereal.exe ethereal-gtk2.exe tethereal.exe editcap.exe mergecap.exe text2pcap.exe @@ -203,6 +202,8 @@ -e "s/@HAVE_GNU_ADNS@/$(ADNS_CONFIG)/" \ -e "s/@HAVE_PCRE@/$(PCRE_CONFIG)/" \ -e "s/@HAVE_LIBZ@/$(ZLIB_CONFIG)/" \ + -e "s/@HAVE_SOME_SNMP@/$(SOME_SNMP_CONFIG)/" \ + -e "s/@HAVE_NET_SNMP@/$(NET_SNMP_CONFIG)/" \ -e "s/@HAVE_LIBPCAP@/$(WINPCAP_CONFIG)/" \ -e "s/@HAVE_PCAP_FINDALLDEVS@/$(PCAP_FINDALLDEVS_CONFIG)/" \ -e "s/@HAVE_LIBETHEREALDLL@/$(LIBETHEREAL_CONFIG)/" \ Index: config.h.win32 =================================================================== RCS file: /cvsroot/ethereal/config.h.win32,v retrieving revision 1.45 diff -u -r1.45 config.h.win32 --- config.h.win32 9 May 2004 10:03:36 -0000 1.45 +++ config.h.win32 5 Jun 2004 05:04:00 -0000 @@ -55,9 +55,6 @@ # define ETH_VAR_IMPORT extern #endif -#define HAVE_NET_SNMP 1 -#define HAVE_SOME_SNMP 1 - /* Define if you have the gethostbyname2 function. */ /* #undef HAVE_GETHOSTBYNAME2 */ @@ -121,6 +118,12 @@ /* Define if you have the z library (-lz). */ @HAVE_LIBZ@ +/* Define to if some SNMP support is to be used */ +@HAVE_SOME_SNMP@ + +/* Define to enable support for NET-SNMP */ +@HAVE_NET_SNMP@ + /* Define to use GNU ADNS library */ @HAVE_GNU_ADNS@ #define ADNS_JGAA_WIN32 1 Index: config.nmake =================================================================== RCS file: /cvsroot/ethereal/config.nmake,v retrieving revision 1.92 diff -u -r1.92 config.nmake --- config.nmake 4 Jun 2004 17:31:11 -0000 1.92 +++ config.nmake 5 Jun 2004 05:04:00 -0000 @@ -88,8 +88,8 @@ PCAP_DIR=$(ETHEREAL_LIBS)\WPdpack # -# Set NET_SNMP_DIR to the pathname of the directory in which the -# Net-SNMP include files and library resides. +# If you have Net-SNMP, set NET_SNMP_DIR to the pathname of the +# directory in which the Net-SNMP include files and library reside. # NET_SNMP_DIR=$(ETHEREAL_LIBS)\net-snmp-5.1 @@ -257,6 +257,18 @@ ZLIB_CONFIG= !ENDIF +!IFDEF NET_SNMP_DIR +NET_SNMP_CFLAGS=/I$(NET_SNMP_DIR)\include +NET_SNMP_LIBS=$(NET_SNMP_DIR)\win32\lib\netsnmp.lib +SOME_SNMP_CONFIG=^#define HAVE_SOME_SNMP 1 +NET_SNMP_CONFIG=^#define HAVE_NET_SNMP 1 +!else +NET_SNMP_CFLAGS= +NET_SNMP_LIBS= +SOME_SNMP_CONFIG= +NET_SNMP_CONFIG= +!ENDIF + !IFDEF ADNS_DIR PATH=$(ADNS_DIR)\adns_win32\lib;$(PATH) ADNS_CFLAGS=/I$(ADNS_DIR)\src /I$(ADNS_DIR)\adns_win32 Index: packaging/nsis/Makefile.nmake =================================================================== RCS file: /cvsroot/ethereal/packaging/nsis/Makefile.nmake,v retrieving revision 1.42 diff -u -r1.42 Makefile.nmake --- packaging/nsis/Makefile.nmake 23 May 2004 22:21:30 -0000 1.42 +++ packaging/nsis/Makefile.nmake 5 Jun 2004 05:04:02 -0000 @@ -108,7 +108,9 @@ /DGETTEXT_DIR=$(GETTEXT_DIR) \ /DVERSION=$(VERSION) \ /DWTAP_VERSION=$(WTAP_VERSION) \ +!IF "$(NET_SNMP_DIR)" != "" /DNET_SNMP_DIR=$(NET_SNMP_DIR) \ +!ENDIF !IF "$(ADNS_DIR)" != "" /DADNS_DIR=$(ADNS_DIR) \ !ENDIF Index: packaging/nsis/ethereal.nsi =================================================================== RCS file: /cvsroot/ethereal/packaging/nsis/ethereal.nsi,v retrieving revision 1.56 diff -u -r1.56 ethereal.nsi --- packaging/nsis/ethereal.nsi 23 May 2004 22:21:30 -0000 1.56 +++ packaging/nsis/ethereal.nsi 5 Jun 2004 05:04:03 -0000 @@ -318,6 +318,7 @@ File "..\..\plugins\v5ua\v5ua.dll" SectionEnd +!ifdef NET_SNMP_DIR Section "SNMP MIBs" SecMIBs ;------------------------------------------- !ifdef GTK1_DIR & GTK2_DIR @@ -326,6 +327,7 @@ SetOutPath $INSTDIR\snmp\mibs File "${NET_SNMP_DIR}\mibs\*.txt" SectionEnd +!endif ; SectionDivider ;------------------------------------------- @@ -464,7 +466,9 @@ !insertmacro MUI_DESCRIPTION_TEXT ${SecText2Pcap} "Text2pcap is a program that reads in an ASCII hex dump and writes the data into a libpcap-style capture file." !insertmacro MUI_DESCRIPTION_TEXT ${SecMergecap} "Mergecap is a program that combines multiple saved capture files into a single output file." !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} "Plugins with some extended dissections." +!ifdef NET_SNMP_DIR !insertmacro MUI_DESCRIPTION_TEXT ${SecMIBs} "SNMP MIBs for better SNMP dissection." +!endif !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} "Start menu shortcuts." !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopIcon} "Ethereal desktop icon." !insertmacro MUI_FUNCTION_DESCRIPTION_END
- Follow-Ups:
- Re: [Ethereal-dev] [PATCH] Make Net-SNMP Optional for VC++ Build
- From: Ulf Lamping
- Re: [Ethereal-dev] [PATCH] Make Net-SNMP Optional for VC++ Build
- Prev by Date: Re: [Ethereal-dev] Re: [PATCH] packet-pktc.c: PKTC MTA FQDN dissector
- Next by Date: Re: [Ethereal-dev] FW: building ethereal with MSVC
- Previous by thread: Re: [Ethereal-dev] FW: building ethereal with MSVC
- Next by thread: Re: [Ethereal-dev] [PATCH] Make Net-SNMP Optional for VC++ Build
- Index(es):