--- Makefile.in +++ Makefile.in @@ -37,6 +37,14 @@ srcdir = @srcdir@ VPATH = @srcdir@ +### +# pcaplib version +VERSION = @PACKAGE_VERSION@ +MAJOR = $(shell echo $(VERSION)|cut -d. -f1) +MINOR = $(shell echo $(VERSION)|cut -d. -f2) +REVISION = $(shell echo $(VERSION)|cut -d. -f3) +export MAJOR MINOR REVISION VERSION + # # You shouldn't need to edit anything below. # @@ -95,31 +103,22 @@ TAGFILES = \ $(SRC) $(HDR) $(TAGHDR) -CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c +LIBNAME = libpcap.so +CLEANFILES = $(OBJ) libpcap.a $(LIBNAME)* $(GENSRC) $(GENHDR) lex.yy.c -all: libpcap.a +all: libpcap.a libpcap.so libpcap.a: $(OBJ) @rm -f $@ ar rc $@ $(OBJ) $(LIBS) $(RANLIB) $@ -shared: libpcap.$(DYEXT) - -# -# XXX - this works with GNU ld, but won't necessarily work with native -# ld on, for example, various SVR4-flavored platforms, or Digital UNIX. -# libpcap.so: $(OBJ) @rm -f $@ - ld -shared -o $@.`cat VERSION` $(OBJ) - -# the following rule succeeds, but the result is untested. -libpcap.dylib: $(OBJ) - rm -f libpcap*.dylib - $(CC) -dynamiclib -undefined error -o libpcap.`cat VERSION`.dylib $(OBJ) \ - -install_name $(libdir)/libpcap.0.dylib -compatibility_version `cat VERSION` \ - -current_version `cat VERSION` + $(CC) -shared -Wl,-soname -Wl,$@.$(MAJOR) -o $@.$(VERSION) $(OBJ) + @rm -f $@.$(MAJOR) $@ + @ln -s $@.$(VERSION) $@.$(MAJOR) + @ln -s $@.$(VERSION) $@ scanner.c: $(srcdir)/scanner.l @@ -170,11 +169,14 @@ bpf_filter.o: bpf_filter.c $(CC) $(CFLAGS) -c bpf_filter.c -install: libpcap.a +install: $(all) [ -d $(DESTDIR)$(libdir) ] || \ (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)) - $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a + $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/ $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a + $(INSTALL_PROGRAM) $(LIBNAME).$(VERSION) $(DESTDIR)$(libdir)/ + @ln -sf $(LIBNAME).$(VERSION) $(DESTDIR)$(libdir)/$(LIBNAME).$(MAJOR) + @ln -sf $(LIBNAME).$(VERSION) $(DESTDIR)$(libdir)/$(LIBNAME) [ -d $(DESTDIR)$(includedir) ] || \ (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir)) $(INSTALL_DATA) $(srcdir)/pcap.h $(DESTDIR)$(includedir)/pcap.h @@ -196,6 +198,7 @@ uninstall: rm -f $(DESTDIR)$(libdir)/libpcap.a + rm -f $(DESTDIR)$(libdir)/$(LIBNAME)* rm -f $(DESTDIR)$(includedir)/pcap.h rm -f $(DESTDIR)$(includedir)/pcap-bpf.h rm -f $(DESTDIR)$(includedir)/pcap-namedb.h --- configure.in +++ configure.in @@ -8,7 +8,8 @@ AC_REVISION($Revision: 1.120.2.8 $) AC_PREREQ(2.50) -AC_INIT(pcap.c) +AC_INIT([libpcap], [0.9.5]) +AC_CONFIG_SRCDIR([pcap.c]) AC_CANONICAL_SYSTEM