support building pppdump with the system zlib

Forwarded: https://github.com/paulusmack/ppp/pull/189
but nacked: "it caused compile failures (on Fedora at least), which
reminded me that the zlib.c here is not the same as upstream; it has
extra functions that I added a long time ago."

--- a/pppdump/Makefile.linux
+++ b/pppdump/Makefile.linux
@@ -6,15 +6,39 @@
 BINDIR = $(DESTDIR)/sbin
 MANDIR = $(DESTDIR)/share/man/man8
 
+DO_DEFLATE=y
+DO_BSD_COMPRESS=y
+HAVE_ZLIB=n
+
 CFLAGS = $(COPTS) -I../include/net
-OBJS = pppdump.o bsd-comp.o deflate.o zlib.o
+OBJS = pppdump.o
+LIBS =
+
+ifdef DO_DEFLATE
+CFLAGS += -DDO_DEFLATE=1
+OBJS += deflate.o
+ifdef HAVE_ZLIB
+LIBS += -lz
+else
+OBJS += zlib.o
+endif
+else
+CFLAGS += -DDO_DEFLATE=0
+endif
 
+ifdef DO_BSD_COMPRESS
+CFLAGS += -DDO_BSD_COMPRESS=1
+OBJS += bsd-comp.o
+else
+CFLAGS += -DDO_BSD_COMPRESS=0
+endif
+ 
 INSTALL= install
 
 all:	pppdump
 
 pppdump: $(OBJS)
-	$(CC) $(LDFLAGS) -o pppdump $(OBJS)
+	$(CC) $(LDFLAGS) -o pppdump $(OBJS) $(LIBS)
 
 clean:
 	rm -f pppdump $(OBJS) *~
