123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- Debian-specific modifications to the upstream Makefile.in to
- build a shared library.
- --- a/Makefile.in
- +++ b/Makefile.in
- @@ -40,6 +40,14 @@ mandir = @mandir@
- srcdir = @srcdir@
- VPATH = @srcdir@
-
- +# some defines for shared library compilation
- +MAJ=0.8
- +LIBVERSION=$(shell head -1 debian/changelog | perl -nle 'm/\S+\s+\((\S+)-\S+\)/ and print $$1')
- +LIBNAME=pcap
- +LIBRARY=lib$(LIBNAME).a
- +SOLIBRARY=lib$(LIBNAME).so
- +SHAREDLIB=$(SOLIBRARY).$(LIBVERSION)
- +
- #
- # You shouldn't need to edit anything below.
- #
- @@ -69,7 +77,8 @@ INSTALL_RPCAPD=@INSTALL_RPCAPD@
- EXTRA_NETWORK_LIBS=@EXTRA_NETWORK_LIBS@
-
- # Standard CFLAGS for building members of a shared library
- -FULL_CFLAGS = $(CCOPT) @V_LIB_CCOPT_FAT@ $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
- +FULL_CFLAGS = $(CCOPT) @V_LIB_CCOPT_FAT@ $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS) $(CPPFLAGS)
- +CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ) -Wl,--version-script=libpcap-symbols.lds
-
- INSTALL = @INSTALL@
- INSTALL_PROGRAM = @INSTALL_PROGRAM@
- @@ -84,7 +93,11 @@ YACC = @YACC@
- # problem if you don't own the file but can write to the directory.
- .c.o:
- @rm -f $@
- - $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
- + $(CC) $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c
- +
- +%_pic.o: %.c
- + @rm -f $@
- + $(CC) -fPIC $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c
-
- PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @NETFILTER_SRC@ @DBUS_SRC@ @NETMAP_SRC@ @RDMA_SRC@
- FSRC = @V_FINDALLDEVS@
- @@ -101,6 +114,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(
- # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
- # hack the extra indirection
- OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
- +OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o) $(LIBOBJS:.o=_pic.o)
- PUBHDR = \
- pcap.h \
- pcap-bpf.h \
- @@ -155,7 +169,7 @@ TAGFILES = \
-
- CLEANFILES = $(OBJ) libpcap.a libpcap.so.`cat $(srcdir)/VERSION` \
- $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
- - lex.yy.c pcap-config libpcap.pc
- + lex.yy.c pcap-config libpcap.pc $(OBJ_PIC)
-
- MAN1 = pcap-config.1
-
- @@ -392,7 +406,7 @@ libpcap.a: $(OBJ)
- $(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
- $(RANLIB) $@
-
- -shared: libpcap.$(DYEXT)
- +shared: $(SHAREDLIB)
-
- libpcap.so: $(OBJ)
- @rm -f $@
- @@ -468,6 +482,13 @@ libpcap.shareda: $(OBJ)
- #
- libpcap.none:
-
- +$(SHAREDLIB): $(OBJ_PIC)
- + -@rm -f $@
- + -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ)
- + $(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $(SHAREDLIB) $(OBJ_PIC) -lc $(LIBS)
- + ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ)
- + ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY)
- +
- scanner.c: $(srcdir)/scanner.l
- $(LEX) -P pcap_ --header-file=scanner.h --nounput -o scanner.c $<
- scanner.h: scanner.c
- @@ -480,6 +501,9 @@ scanner.h: scanner.c
- scanner.o: scanner.c grammar.h
- $(CC) $(FULL_CFLAGS) -c scanner.c
-
- +scanner_pic.o: scanner.c grammar.h
- + $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c scanner.c
- +
- grammar.c: $(srcdir)/grammar.y
- $(YACC) -p pcap_ -o grammar.c -d $<
- grammar.h: grammar.c
- @@ -492,6 +516,10 @@ grammar.h: grammar.c
- grammar.o: grammar.c scanner.h
- $(CC) $(FULL_CFLAGS) -c grammar.c
-
- +grammar_pic.o: grammar.c
- + @rm -f $@
- + $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c grammar.c
- +
- gencode.o: $(srcdir)/gencode.c grammar.h scanner.h
- $(CC) $(FULL_CFLAGS) -c $(srcdir)/gencode.c
-
- @@ -504,9 +532,17 @@ snprintf.o: $(srcdir)/missing/snprintf.c
- strlcat.o: $(srcdir)/missing/strlcat.c
- $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
-
- +strlcat_pic.o: $(srcdir)/missing/strlcat.c
- + @rm -f $@
- + $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
- +
- strlcpy.o: $(srcdir)/missing/strlcpy.c
- $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
-
- +strlcpy_pic.o: $(srcdir)/missing/strlcpy.c
- + @rm -f $@
- + $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
- +
- strtok_r.o: $(srcdir)/missing/strtok_r.c
- $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strtok_r.c
-
- @@ -539,6 +575,9 @@ pcap-config: $(srcdir)/pcap-config.in ./
- mv $@.tmp $@
- chmod a+x $@
-
- +bpf_filter_pic.o: bpf_filter.c
- + $(CC) -fPIC $(FULL_CFLAGS) -c bpf_filter.c -o $@
- +
- #
- # Remote pcap daemon.
- #
- @@ -635,11 +674,9 @@ install-shared: install-shared-$(DYEXT)
- install-shared-so: libpcap.so
- [ -d $(DESTDIR)$(libdir) ] || \
- (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
- - VER=`cat $(srcdir)/VERSION`; \
- - MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
- - $(INSTALL_PROGRAM) libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
- - ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
- - ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so
- + $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
- + ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ)
- + ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY)
- install-shared-dylib: libpcap.dylib
- [ -d $(DESTDIR)$(libdir) ] || \
- (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
- --- a/aclocal.m4
- +++ b/aclocal.m4
- @@ -507,7 +507,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
- esac
- ;;
- esac
- - V_SHLIB_CCOPT="$V_SHLIB_CCOPT $PIC_OPT"
- + V_SHLIB_CCOPT="$V_SHLIB_CCOPT"
- V_SONAME_OPT="-Wl,-soname,"
- V_RPATH_OPT="-Wl,-rpath,"
- ;;
- @@ -570,7 +570,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
- #
- # "cc" is GCC.
- #
- - V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic"
- + V_SHLIB_CCOPT="$V_SHLIB_CCOPT"
- V_SHLIB_CMD="\$(CC)"
- V_SHLIB_OPT="-shared"
- V_SONAME_OPT="-Wl,-soname,"
- --- /dev/null
- +++ b/libpcap-symbols.lds
- @@ -0,0 +1,106 @@
- +{
- + global:
- + bpf_dump;
- + bpf_filter;
- + bpf_image;
- + bpf_validate;
- + eproto_db;
- + pcap_breakloop;
- + pcap_can_set_rfmon;
- + pcap_close;
- + pcap_compile;
- + pcap_compile_nopcap;
- + pcap_datalink;
- + pcap_datalink_name_to_val;
- + pcap_datalink_val_to_description;
- + pcap_datalink_val_to_name;
- + pcap_dispatch;
- + pcap_dump;
- + pcap_dump_close;
- + pcap_dump_file;
- + pcap_dump_flush;
- + pcap_dump_fopen;
- + pcap_dump_ftell;
- + pcap_dump_open;
- + pcap_ether_aton;
- + pcap_ether_hostton;
- + pcap_file;
- + pcap_fileno;
- + pcap_findalldevs;
- + pcap_fopen_offline;
- + pcap_freealldevs;
- + pcap_freecode;
- + pcap_get_selectable_fd;
- + pcap_geterr;
- + pcap_getnonblock;
- + pcap_inject;
- + pcap_is_swapped;
- + pcap_lib_version;
- + pcap_list_datalinks;
- + pcap_lookupdev;
- + pcap_lookupnet;
- + pcap_loop;
- + pcap_major_version;
- + pcap_minor_version;
- + pcap_nametoaddr;
- + pcap_nametoaddrinfo;
- + pcap_nametoeproto;
- + pcap_nametollc;
- + pcap_nametonetaddr;
- + pcap_nametoport;
- + pcap_nametoportrange;
- + pcap_nametoproto;
- + pcap_next;
- + pcap_next_etherent;
- + pcap_next_ex;
- + pcap_open_dead;
- + pcap_open_live;
- + pcap_open_offline;
- + pcap_perror;
- + pcap_sendpacket;
- + pcap_set_datalink;
- + pcap_setdirection;
- + pcap_setfilter;
- + pcap_setnonblock;
- + pcap_snapshot;
- + pcap_stats;
- + pcap_statustostr;
- + pcap_strerror;
- + pcap_version;
- + /* introduced in pcap 1.0 */
- + pcap_activate;
- + pcap_create;
- + pcap_datalink_ext;
- + pcap_free_datalinks;
- + pcap_offline_filter;
- + pcap_set_buffer_size;
- + pcap_set_promisc;
- + pcap_set_rfmon;
- + pcap_set_snaplen;
- + pcap_set_timeout;
- + /* introduced in pcap 1.2 */
- + pcap_set_tstamp_type;
- + pcap_list_tstamp_types;
- + pcap_free_tstamp_types;
- + pcap_tstamp_type_name_to_val;
- + pcap_tstamp_type_val_to_name;
- + pcap_tstamp_type_val_to_description;
- + /* introduced in pcap 1.5 */
- + pcap_set_immediate_mode;
- + pcap_set_tstamp_precision;
- + pcap_get_tstamp_precision;
- + pcap_open_dead_with_tstamp_precision;
- + pcap_open_offline_with_tstamp_precision;
- + pcap_fopen_offline_with_tstamp_precision;
- + /* introduced in pcap 1.7 */
- + pcap_dump_open_append;
- + /* introduced in pcap 1.9.0 */
- + pcap_bufsize;
- + pcap_dump_ftell64;
- + pcap_get_required_select_timeout;
- + pcap_set_protocol_linux; /* linux-only */
- + /* introduced in pcap 1.9.1 */
- + pcap_datalink_val_to_description_or_dlt;
- + local:
- + *;
- +};
|