Skip to contentSkip to conversation

support building pppdump with the system zlib

PATCH In review Marco d'Itri 2 participants 2 messages Aug 19, 2007 PPP protocol drivers and compressors

lore
Share & tools
lore
#0 lore raw

PATCH 8/14 support building pppdump with the system zlib

pppdump/Makefile.linux +27 -3
@@ -2,15 +2,40 @@ DESTDIR = $(INSTROOT)@DESTDIR@
 BINDIR = $(DESTDIR)/sbin
 MANDIR = $(DESTDIR)/share/man/man8
 
-CFLAGS= -O -I../include/net
-OBJS = pppdump.o bsd-comp.o deflate.o zlib.o
+DO_DEFLATE=y
+DO_BSD_COMPRESS=y
+HAVE_ZLIB=n
+
+OPTS := -O2 -Wall
+CFLAGS := -I../include/net
+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) -o pppdump $(OBJS)
+	$(CC) $(CFLAGS) $(OPTS) -o pppdump $(OBJS) $(LIBS)
 
 clean:
 	rm -f pppdump $(OBJS) *~
Signature · 2 lines
ciao,
Marco
#1 lore raw

pppdump/Makefile.linux DESTDIR = $(INSTROOT)@DESTDIR@ · line 20

Quoted 5 lines · Marco d'Itri
pppdump/Makefile.linux +5 -0
+ifdef HAVE_ZLIB
+LIBS += -lz
+else
+OBJS += zlib.o
+endif

Are you sure that the Z_BLOCK value of the flush parameter to inflate works the same as the Z_PACKET_FLUSH value that I added to zlib.c? Possibly it does, but there could be differences. (Note that both constants have the value 5.)

Also it seems a bit dangerous to build deflate.o against the zlib.h in pppd but link it against the system zlib, which has a longer z_stream definition. If you use the system zlib.h you will hit the Z_PACKET_FLUSH vs. Z_BLOCK thing of course.

Paul.