2009-04-25 03:30:10 +00:00
|
|
|
Debian-specific modifications to the upstream Makefile.in to
|
|
|
|
build a shared library.
|
|
|
|
|
2008-07-07 14:41:48 +00:00
|
|
|
--- a/Makefile.in
|
|
|
|
+++ b/Makefile.in
|
2020-03-20 18:07:31 +00:00
|
|
|
@@ -40,6 +40,14 @@ mandir = @mandir@
|
2006-05-24 07:18:36 +00:00
|
|
|
srcdir = @srcdir@
|
|
|
|
VPATH = @srcdir@
|
|
|
|
|
|
|
|
+# some defines for shared library compilation
|
2020-03-20 18:07:31 +00:00
|
|
|
+MAJ=0.8
|
|
|
|
+LIBVERSION=$(shell head -1 debian/changelog | perl -nle 'm/\S+\s+\((\S+)-\S+\)/ and print $$1')
|
2006-05-24 07:18:36 +00:00
|
|
|
+LIBNAME=pcap
|
|
|
|
+LIBRARY=lib$(LIBNAME).a
|
|
|
|
+SOLIBRARY=lib$(LIBNAME).so
|
2009-04-25 03:30:10 +00:00
|
|
|
+SHAREDLIB=$(SOLIBRARY).$(LIBVERSION)
|
2006-05-24 07:18:36 +00:00
|
|
|
+
|
|
|
|
#
|
|
|
|
# You shouldn't need to edit anything below.
|
|
|
|
#
|
2020-03-20 18:07:31 +00:00
|
|
|
@@ -69,7 +77,8 @@ INSTALL_RPCAPD=@INSTALL_RPCAPD@
|
2018-07-26 14:46:38 +00:00
|
|
|
EXTRA_NETWORK_LIBS=@EXTRA_NETWORK_LIBS@
|
2006-05-24 07:18:36 +00:00
|
|
|
|
2018-07-26 14:46:38 +00:00
|
|
|
# Standard CFLAGS for building members of a shared library
|
2019-10-12 16:28:32 +00:00
|
|
|
-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)
|
2020-03-20 18:07:31 +00:00
|
|
|
+CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ) -Wl,--version-script=libpcap-symbols.lds
|
2006-05-24 07:18:36 +00:00
|
|
|
|
|
|
|
INSTALL = @INSTALL@
|
|
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
2020-03-20 18:07:31 +00:00
|
|
|
@@ -84,7 +93,11 @@ YACC = @YACC@
|
2009-04-25 03:30:10 +00:00
|
|
|
# problem if you don't own the file but can write to the directory.
|
2006-05-24 07:18:36 +00:00
|
|
|
.c.o:
|
|
|
|
@rm -f $@
|
2013-04-01 21:07:34 +00:00
|
|
|
- $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
|
|
|
|
+ $(CC) $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c
|
2009-04-25 03:30:10 +00:00
|
|
|
+
|
2020-03-20 18:07:31 +00:00
|
|
|
+%_pic.o: %.c
|
2006-05-24 07:18:36 +00:00
|
|
|
+ @rm -f $@
|
2013-04-01 21:07:34 +00:00
|
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c
|
2009-04-25 03:30:10 +00:00
|
|
|
|
2018-07-26 14:46:38 +00:00
|
|
|
PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @NETFILTER_SRC@ @DBUS_SRC@ @NETMAP_SRC@ @RDMA_SRC@
|
2016-12-10 09:56:22 +00:00
|
|
|
FSRC = @V_FINDALLDEVS@
|
2020-03-20 18:07:31 +00:00
|
|
|
@@ -101,6 +114,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(
|
2006-05-24 07:18:36 +00:00
|
|
|
# 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)
|
2020-03-20 18:07:31 +00:00
|
|
|
+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)
|
2011-05-24 09:51:08 +00:00
|
|
|
PUBHDR = \
|
|
|
|
pcap.h \
|
|
|
|
pcap-bpf.h \
|
2020-03-20 18:07:31 +00:00
|
|
|
@@ -155,7 +169,7 @@ TAGFILES = \
|
2006-05-24 07:18:36 +00:00
|
|
|
|
2018-07-26 14:46:38 +00:00
|
|
|
CLEANFILES = $(OBJ) libpcap.a libpcap.so.`cat $(srcdir)/VERSION` \
|
2013-04-01 21:07:34 +00:00
|
|
|
$(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
|
2018-07-26 14:46:38 +00:00
|
|
|
- lex.yy.c pcap-config libpcap.pc
|
|
|
|
+ lex.yy.c pcap-config libpcap.pc $(OBJ_PIC)
|
2009-04-25 03:30:10 +00:00
|
|
|
|
|
|
|
MAN1 = pcap-config.1
|
|
|
|
|
2020-03-20 18:07:31 +00:00
|
|
|
@@ -392,7 +406,7 @@ libpcap.a: $(OBJ)
|
2013-04-01 21:07:34 +00:00
|
|
|
$(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
|
2011-05-24 10:42:49 +00:00
|
|
|
$(RANLIB) $@
|
|
|
|
|
|
|
|
-shared: libpcap.$(DYEXT)
|
|
|
|
+shared: $(SHAREDLIB)
|
|
|
|
|
2013-04-01 21:07:34 +00:00
|
|
|
libpcap.so: $(OBJ)
|
|
|
|
@rm -f $@
|
2020-03-20 18:07:31 +00:00
|
|
|
@@ -468,6 +482,13 @@ libpcap.shareda: $(OBJ)
|
2011-05-24 09:51:08 +00:00
|
|
|
#
|
|
|
|
libpcap.none:
|
2006-05-24 07:18:36 +00:00
|
|
|
|
|
|
|
+$(SHAREDLIB): $(OBJ_PIC)
|
|
|
|
+ -@rm -f $@
|
2020-03-20 18:07:31 +00:00
|
|
|
+ -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ)
|
2013-04-01 21:07:34 +00:00
|
|
|
+ $(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $(SHAREDLIB) $(OBJ_PIC) -lc $(LIBS)
|
2020-03-20 18:07:31 +00:00
|
|
|
+ ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ)
|
|
|
|
+ ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY)
|
2006-05-24 07:18:36 +00:00
|
|
|
+
|
2009-04-25 03:30:10 +00:00
|
|
|
scanner.c: $(srcdir)/scanner.l
|
2016-12-10 09:56:22 +00:00
|
|
|
$(LEX) -P pcap_ --header-file=scanner.h --nounput -o scanner.c $<
|
|
|
|
scanner.h: scanner.c
|
2020-03-20 18:07:31 +00:00
|
|
|
@@ -480,6 +501,9 @@ scanner.h: scanner.c
|
2016-12-10 09:56:22 +00:00
|
|
|
scanner.o: scanner.c grammar.h
|
2013-04-01 21:07:34 +00:00
|
|
|
$(CC) $(FULL_CFLAGS) -c scanner.c
|
2006-05-24 07:18:36 +00:00
|
|
|
|
2016-12-10 09:56:22 +00:00
|
|
|
+scanner_pic.o: scanner.c grammar.h
|
2013-04-01 21:07:34 +00:00
|
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c scanner.c
|
2006-05-24 07:18:36 +00:00
|
|
|
+
|
2016-12-10 09:56:22 +00:00
|
|
|
grammar.c: $(srcdir)/grammar.y
|
2018-07-26 14:46:38 +00:00
|
|
|
$(YACC) -p pcap_ -o grammar.c -d $<
|
|
|
|
grammar.h: grammar.c
|
2020-03-20 18:07:31 +00:00
|
|
|
@@ -492,6 +516,10 @@ grammar.h: grammar.c
|
2018-07-26 14:46:38 +00:00
|
|
|
grammar.o: grammar.c scanner.h
|
|
|
|
$(CC) $(FULL_CFLAGS) -c grammar.c
|
|
|
|
|
2020-03-20 18:07:31 +00:00
|
|
|
+grammar_pic.o: grammar.c
|
|
|
|
+ @rm -f $@
|
2018-07-26 14:46:38 +00:00
|
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c grammar.c
|
|
|
|
+
|
2016-12-10 09:56:22 +00:00
|
|
|
gencode.o: $(srcdir)/gencode.c grammar.h scanner.h
|
|
|
|
$(CC) $(FULL_CFLAGS) -c $(srcdir)/gencode.c
|
2006-05-24 07:18:36 +00:00
|
|
|
|
2020-03-20 18:07:31 +00:00
|
|
|
@@ -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 ./
|
2018-07-26 14:46:38 +00:00
|
|
|
mv $@.tmp $@
|
|
|
|
chmod a+x $@
|
2006-05-24 07:18:36 +00:00
|
|
|
|
|
|
|
+bpf_filter_pic.o: bpf_filter.c
|
2013-04-01 21:07:34 +00:00
|
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -c bpf_filter.c -o $@
|
2006-05-24 07:18:36 +00:00
|
|
|
+
|
2009-04-25 03:30:10 +00:00
|
|
|
#
|
2018-07-26 14:46:38 +00:00
|
|
|
# Remote pcap daemon.
|
2009-04-25 03:30:10 +00:00
|
|
|
#
|
2020-03-20 18:07:31 +00:00
|
|
|
@@ -635,11 +674,9 @@ install-shared: install-shared-$(DYEXT)
|
|
|
|
install-shared-so: libpcap.so
|
2011-05-24 10:42:49 +00:00
|
|
|
[ -d $(DESTDIR)$(libdir) ] || \
|
2006-05-24 07:18:36 +00:00
|
|
|
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
|
2011-05-24 10:42:49 +00:00
|
|
|
- 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
|
2006-05-24 07:18:36 +00:00
|
|
|
+ $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
|
2020-03-20 18:07:31 +00:00
|
|
|
+ ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ)
|
|
|
|
+ ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY)
|
2011-05-24 10:42:49 +00:00
|
|
|
install-shared-dylib: libpcap.dylib
|
|
|
|
[ -d $(DESTDIR)$(libdir) ] || \
|
|
|
|
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
|
2013-04-01 21:07:34 +00:00
|
|
|
--- a/aclocal.m4
|
|
|
|
+++ b/aclocal.m4
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -507,7 +507,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
|
2013-04-01 21:07:34 +00:00
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
2018-07-26 14:46:38 +00:00
|
|
|
- V_SHLIB_CCOPT="$V_SHLIB_CCOPT $PIC_OPT"
|
|
|
|
+ V_SHLIB_CCOPT="$V_SHLIB_CCOPT"
|
2011-05-24 09:51:08 +00:00
|
|
|
V_SONAME_OPT="-Wl,-soname,"
|
|
|
|
V_RPATH_OPT="-Wl,-rpath,"
|
|
|
|
;;
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -570,7 +570,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
|
2011-05-24 09:51:08 +00:00
|
|
|
#
|
|
|
|
# "cc" is GCC.
|
|
|
|
#
|
2018-07-26 14:46:38 +00:00
|
|
|
- V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic"
|
|
|
|
+ V_SHLIB_CCOPT="$V_SHLIB_CCOPT"
|
2011-05-24 09:51:08 +00:00
|
|
|
V_SHLIB_CMD="\$(CC)"
|
|
|
|
V_SHLIB_OPT="-shared"
|
|
|
|
V_SONAME_OPT="-Wl,-soname,"
|
2020-03-20 18:07:31 +00:00
|
|
|
--- /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:
|
|
|
|
+ *;
|
|
|
|
+};
|