Following r226271, allow disabling lzma support with "WITHOUT_LZMA_SUPPORT".

Correct r226271 which should have used WITHOUT_BZIP2_SUPPORT per r166255.

Obtained from:	Juniper Networks
This commit is contained in:
David E. O'Brien 2013-01-08 18:37:12 +00:00
parent 9f18a157e8
commit 9b6b681624
4 changed files with 22 additions and 6 deletions

View File

@ -24,7 +24,7 @@ SMAKE= MAKEFLAGS= ${MAKE} -C ${.CURDIR}
all:
@echo '1..16'
@${SMAKE} C_check || { cd ${.CURDIR} ; ${MAKE} failure ; }
@${SMAKE} C_check || { ${MAKE} -C ${.CURDIR} failure ; }
@echo "ok 1 - C_check # Test of -C flag existence detected no regression."
@echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \
diff -u ${.CURDIR}/regress.variables.out - || \

View File

@ -0,0 +1,2 @@
.\" $FreeBSD$
Set to build some programs without optional lzma compression support.

View File

@ -40,17 +40,24 @@ MLINKS= grep.1 egrep.1 \
grep.1 lzfgrep.1
.endif
LDADD= -lz
DPADD= ${LIBZ}
.if !defined(WITHOUT_LZMA_SUPPORT)
LDADD+= -llzma
DPADD+= ${LIBLZMA}
LINKS+= ${BINDIR}/${PROG} ${BINDIR}/xzgrep \
${BINDIR}/${PROG} ${BINDIR}/xzegrep \
${BINDIR}/${PROG} ${BINDIR}/xzfgrep \
${BINDIR}/${PROG} ${BINDIR}/lzgrep \
${BINDIR}/${PROG} ${BINDIR}/lzegrep \
${BINDIR}/${PROG} ${BINDIR}/lzfgrep
.else
CFLAGS+= -DWITHOUT_LZMA
.endif
LDADD= -lz -llzma
DPADD= ${LIBZ} ${LIBLZMA}
.if !defined(WITHOUT_BZIP2)
.if !defined(WITHOUT_BZIP2_SUPPORT)
LDADD+= -lbz2
DPADD+= ${LIBBZ2}

View File

@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <lzma.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
@ -50,6 +49,10 @@ __FBSDID("$FreeBSD$");
#include <wctype.h>
#include <zlib.h>
#ifndef WITHOUT_LZMA
#include <lzma.h>
#endif
#ifndef WITHOUT_BZIP2
#include <bzlib.h>
#endif
@ -60,7 +63,9 @@ __FBSDID("$FreeBSD$");
#define LNBUFBUMP 80
static gzFile gzbufdesc;
#ifndef WITHOUT_LZMA
static lzma_stream lstrm = LZMA_STREAM_INIT;
#endif
#ifndef WITHOUT_BZIP2
static BZFILE* bzbufdesc;
#endif
@ -116,6 +121,7 @@ grep_refill(struct file *f)
nr = -1;
}
#endif
#ifndef WITHOUT_LZMA
} else if ((filebehave == FILE_XZ) || (filebehave == FILE_LZMA)) {
lzma_action action = LZMA_RUN;
uint8_t in_buf[MAXBUFSIZ];
@ -146,6 +152,7 @@ grep_refill(struct file *f)
return (-1);
bufrem = MAXBUFSIZ - lstrm.avail_out;
return (0);
#endif /* WIHTOUT_LZMA */
} else
nr = read(f->fd, buffer, MAXBUFSIZ);