Ethereal-dev: [Ethereal-dev] Creating a libproto (take 2)
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Mon, 1 Jul 2002 05:51:17 +0200
Hello, the patch below is my second shot at making the dissectors a library of their own. That way they are linked only once instead of twice if both ethereal and tethereal (and ignoring dftest) are built. As I have played quite a lot with the ..._static_... targets, it's very likely I've broken a few things I don't know about. I also had to disable static builds in case shared builds are selected, because ethereal wouldn't compile on my linux system unless I configured with --enable-static=no, because my system doesn't have a static libsnmp and the linking process enforces a static version of the library. I don't think that both targets - static and dynamic should be configurable at the same time. If dynamic is selected, I see no reason to build the static version of the plugins (and install them) as well, so I changed configure.in acordingly. Still to do: - Fix the build process in the plugins directory as well. - Test on platforms other than Linux/ix86. - Move everything that is part of libproto into epan/proto/ and adjust the build for that. -> which leads to: - Discuss, whether epan should have it's own configure process (as it does now) or whether this should be integrated into the top level configure (the info page of autoconf or automake doesn't speak too highly of this construct :) If anyone would like to give me some feedback: you are more than welcome. Ciao Jörg PS: In case that I haven't introduced too many new bugs/bad concepts, please apply this patch so I won't have to submit a patch that changes everything at once. That would make finding the causes of bugs after a big change much harder.
Index: ethereal/Makefile.am =================================================================== RCS file: /cvsroot/ethereal/Makefile.am,v retrieving revision 1.444 diff -u -r1.444 Makefile.am --- Makefile.am 2002/06/29 00:05:05 1.444 +++ Makefile.am 2002/07/01 03:38:32 @@ -65,7 +65,7 @@ man1_MANS = @ethereal_man@ @editcap_man@ @mergecap_man@ @tethereal_man@ @text2pcap_man@ @idl2eth_man@ man_MANS = -EXTRA_PROGRAMS = ethereal ethereal_static tethereal tethereal_static editcap mergecap dftest text2pcap +EXTRA_PROGRAMS = ethereal tethereal editcap mergecap dftest text2pcap EXTRA_SCRIPTS = idl2eth # @@ -333,18 +333,45 @@ packet-ypxfr.c \ packet-zebra.c -if HAVE_PLUGINS -plugin_src = \ - plugins/gryphon/packet-gryphon.c \ - plugins/mgcp/packet-mgcp.c \ - plugins/giop/packet-cosnaming.c \ - plugins/giop/packet-coseventcomm.c +DISSECTOR_COMMON_SRC = \ + aftypes.h \ + alignment.h \ + afn.c \ + afn.h \ + asn1.c \ + asn1.h \ + bridged_pids.h \ + etypes.h \ + follow.c \ + follow.h \ + format-oid.h \ + greproto.h \ + in_cksum.c \ + in_cksum.h \ + ipproto.c \ + ipproto.h \ + llcsaps.h \ + nlpid.h \ + oui.h \ + ppptypes.h \ + ptvcursor.c \ + ptvcursor.h \ + reassemble.c \ + reassemble.h \ + register.h \ + rpc_defrag.h \ + smb.h \ + util.c \ + util.h \ + x11-declarations.h \ + x11-register-info.h \ + x264_prt_id.h \ + xdlc.c \ + xdlc.h \ + xmlstub.c \ + xmlstub.h -plugin_static_ldadd = \ - plugins/gryphon/packet-gryphon-static.o \ - plugins/mgcp/packet-mgcp-static.o \ - plugins/giop/packet-cosnaming-static.o \ - plugins/giop/packet-coseventcomm-static.o +if HAVE_PLUGINS plugin_libs = \ plugins/gryphon/gryphon.la \ @@ -352,17 +379,34 @@ plugins/giop/cosnaming.la \ plugins/giop/coseventcomm.la +if ENABLE_STATIC +plugin_ldadd = \ + plugins/gryphon/packet-gryphon-static.o \ + plugins/mgcp/packet-mgcp-static.o \ + plugins/giop/packet-cosnaming-static.o \ + plugins/giop/packet-coseventcomm-static.o + +plugin_src = \ + plugins/gryphon/packet-gryphon.c \ + plugins/mgcp/packet-mgcp.c \ + plugins/giop/packet-cosnaming.c \ + plugins/giop/packet-coseventcomm.c + +else plugin_ldadd = \ "-dlopen" self \ "-dlopen" plugins/gryphon/gryphon.la \ "-dlopen" plugins/mgcp/mgcp.la \ "-dlopen" plugins/giop/cosnaming.la \ "-dlopen" plugins/giop/coseventcomm.la -else + plugin_src = -plugin_static_ldadd = +endif +else +plugin_src = + plugin_libs = plugin_ldadd = @@ -486,13 +530,6 @@ packet-ypxfr.h ETHEREAL_COMMON_SRC = \ - aftypes.h \ - alignment.h \ - afn.c \ - afn.h \ - asn1.c \ - asn1.h \ - bridged_pids.h \ column.c \ column.h \ color.h \ @@ -500,21 +537,8 @@ conditions.h \ capture_stop_conditions.h \ capture_stop_conditions.c \ - etypes.h \ - follow.c \ - follow.h \ - format-oid.h \ - greproto.h \ - in_cksum.c \ - in_cksum.h \ - ipproto.c \ - ipproto.h \ - llcsaps.h \ - nlpid.h \ - oui.h \ pcap-util.c \ pcap-util.h \ - ppptypes.h \ prefs.c \ prefs.h \ prefs-int.h \ @@ -522,33 +546,15 @@ print.h \ ps.c \ ps.h \ - ptvcursor.c \ - ptvcursor.h \ - reassemble.c \ - reassemble.h \ - register.h \ ringbuffer.c \ - ringbuffer.h \ - rpc_defrag.h \ - smb.h \ - util.c \ - util.h \ - x11-declarations.h \ - x11-register-info.h \ - x264_prt_id.h \ - xdlc.c \ - xdlc.h \ - xmlstub.c \ - xmlstub.h + ringbuffer.h BUILT_SOURCES = \ x11-declarations.h \ x11-register-info.h ethereal_SOURCES = \ - $(DISSECTOR_SRC) \ $(ETHEREAL_COMMON_SRC) \ - register.c \ capture.c \ capture.h \ file.c \ @@ -566,27 +572,6 @@ summary.h \ ui_util.h -ethereal_static_SOURCES = \ - $(DISSECTOR_SRC) \ - $(ETHEREAL_COMMON_SRC) \ - register-static.c \ - capture.c \ - capture.h \ - file.c \ - file.h \ - filters.c \ - filters.h \ - globals.h \ - menu.h \ - progress_dlg.h \ - proto_hier_stats.h \ - proto_hier_stats.c \ - simple_dialog.h \ - statusbar.h \ - summary.c \ - summary.h \ - ui_util.h - EXTRA_ethereal_SOURCES = \ snprintf.c \ snprintf.h \ @@ -600,6 +585,13 @@ strptime.c \ strptime.h +noinst_LIBRARIES = libproto.a + +libproto_a_SOURCES = \ + $(DISSECTOR_SRC) \ + $(DISSECTOR_COMMON_SRC) \ + register.c + # Optional objects that I know how to build. These will be # linked into the ethereal executable. # They will also be linked into the tethereal executable; if this @@ -614,6 +606,7 @@ # Additional libs that I know how to build. These will be # linked into the ethereal executable. ethereal_additional_libs = \ + libproto.a \ wiretap/libwiretap.a \ gtk/libui.a \ epan/libethereal.a \ @@ -626,10 +619,6 @@ $(ethereal_additional_libs) \ $(plugin_libs) -ethereal_static_DEPENDENCIES = \ - $(ethereal_optional_objects) \ - $(ethereal_additional_libs) - # This automake variable adds to the link-line for the executable. # # Note that Ethereal doesn't have to be linked with @GLIB_LIBS@, as @@ -637,6 +626,17 @@ # @SOCKET_LIBS@ or @NSL_LIBS@, as those should also be included in # @GTK_LIBS@ (as those are also needed for X applications, and GTK+ # applications are X applications). + +if ENABLE_STATIC +ethereal_LDFLAGS = -Wl,-static -all-static +#ethereal_all_static = -all-static +else +ethereal_LDFLAGS = -export-dynamic +#ethereal_all_static = +endif + +# $(ethereal_all_static) \### + ethereal_LDADD = \ $(ethereal_optional_objects) \ $(ethereal_additional_libs) \ @@ -644,32 +644,14 @@ $(plugin_ldadd) \ @PCAP_LIBS@ @GTK_LIBS@ -ethereal_static_LDADD = \ - "-all-static" \ - $(plugin_static_ldadd) \ - $(ethereal_optional_objects) \ - $(ethereal_additional_libs) \ - @SNMP_LIBS@ @SSL_LIBS@ \ - @PCAP_LIBS@ @GTK_LIBS@ - -ethereal_LDFLAGS = -export-dynamic -ethereal_static_LDFLAGS = -Wl,-static - tethereal_SOURCES = \ - $(DISSECTOR_SRC) \ - $(ETHEREAL_COMMON_SRC) \ - register.c \ - tethereal.c - -tethereal_static_SOURCES = \ - $(DISSECTOR_SRC) \ $(ETHEREAL_COMMON_SRC) \ - register-static.c \ tethereal.c # Additional libs that I know how to build. These will be # linked into the tethereal executable. tethereal_additional_libs = \ + libproto.a \ wiretap/libwiretap.a \ epan/libethereal.a \ epan/ftypes/libftypes.a \ @@ -681,31 +663,22 @@ $(tethereal_additional_libs) \ $(plugin_libs) -tethereal_static_DEPENDENCIES = \ - $(ethereal_optional_objects) \ - $(tethereal_additional_libs) - # This automake variable adds to the link-line for the executable + tethereal_LDADD = wiretap/libwiretap.a \ + $(ethereal_all_static) \ $(ethereal_optional_objects) \ $(tethereal_additional_libs) \ @SNMP_LIBS@ @SSL_LIBS@ \ $(plugin_ldadd) \ @GLIB_LIBS@ -lm \ @PCAP_LIBS@ @SOCKET_LIBS@ @NSL_LIBS@ - -tethereal_static_LDADD = \ - "-all-static" \ - $(plugin_static_ldadd) \ - wiretap/libwiretap.a \ - $(ethereal_optional_objects) \ - $(tethereal_additional_libs) \ - @SNMP_LIBS@ @SSL_LIBS@ \ - @GLIB_LIBS@ -lm \ - @PCAP_LIBS@ @SOCKET_LIBS@ @NSL_LIBS@ +if ENABLE_STATIC +tethereal_LDFLAGS = -Wl,-static +else tethereal_LDFLAGS = -export-dynamic -tethereal_static_LDFLAGS = -Wl,-static +endif # Optional objects that I know how to build, and that are needed by # text2pcap. @@ -770,13 +743,9 @@ # The first argument is the directory in which the source files live. # All subsequent arguments are the files to scan. # -register.c: $(DISSECTOR_SRC) $(srcdir)/make-reg-dotc +register.c: $(plugin_src) $(DISSECTOR_SRC) $(srcdir)/make-reg-dotc @echo Making register.c - @$(srcdir)/make-reg-dotc register.c $(srcdir) $(DISSECTOR_SRC) - -register-static.c: $(plugin_src) $(DISSECTOR_SRC) $(srcdir)/make-reg-dotc - @echo Making register-static.c - @$(srcdir)/make-reg-dotc register-static.c $(srcdir) $(plugin_src) $(DISSECTOR_SRC) + @$(srcdir)/make-reg-dotc register.c $(srcdir) $(plugin_src) $(DISSECTOR_SRC) ps.c: print.ps rdps ./rdps $(srcdir)/print.ps ps.c @@ -792,12 +761,11 @@ dftest_SOURCES = \ - $(DISSECTOR_SRC) \ $(ETHEREAL_COMMON_SRC) \ - register.c \ dftest.c dftest_additional_libs = \ + libproto.a \ wiretap/libwiretap.a \ epan/libethereal.a \ epan/ftypes/libftypes.a \ @@ -820,11 +788,11 @@ dftest_LDFLAGS = -export-dynamic CLEANFILES = \ - idl2eth + idl2eth \ + libproto.a DISTCLEANFILES = \ register.c \ - register-static.c \ rdps \ ps.c \ *~ @@ -934,7 +902,6 @@ install-exec-hook: -chmod +s $(DESTDIR)$(bindir)/ethereal -chmod +s $(DESTDIR)$(bindir)/tethereal - -chmod +s $(DESTDIR)$(bindir)/ethereal_static else install-exec-hook: endif Index: ethereal/configure.in =================================================================== RCS file: /cvsroot/ethereal/configure.in,v retrieving revision 1.168 diff -u -r1.168 configure.in --- configure.in 2002/06/28 20:15:30 1.168 +++ configure.in 2002/07/01 03:38:32 @@ -676,6 +676,7 @@ AM_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) +AM_CONDITIONAL(ENABLE_STATIC, test x$enable_shared = xno) AM_CONFIG_HEADER(config.h) AC_CONFIG_SUBDIRS(epan wiretap) AC_OUTPUT(
- Prev by Date: Re: [Ethereal-dev] Add some missing static declarations (editcap, text2pcap)
- Previous by thread: Re: [Ethereal-dev] Unable to make ethereal under Solaris 7
- Index(es):