# Normally configure builds both a static and a shared library.
# If you want to build just a static library, use: ./configure --static
-# To use the asm code, type:
-# cp contrib/asm?86/match.S ./match.S
-# make LOC=-DASMV OBJA=match.o
-
# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
# make install
# To install in $HOME instead of /usr/local, use:
LDFLAGS=
TEST_LDFLAGS=-L. libz.a
LDSHARED=$(CC)
-CPP=$(CC) -E
STATICLIB=libz.a
SHAREDLIB=libz.so
man3dir = ${mandir}/man3
pkgconfigdir = ${libdir}/pkgconfig
-OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o $(ARCH_STATIC_OBJS)
+OBJZ = adler32.o crc32.o deflate.o match.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o $(ARCH_STATIC_OBJS)
OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
OBJC = $(OBJZ) $(OBJG)
-PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo $(ARCH_SHARED_OBJS)
+PIC_OBJZ = adler32.lo crc32.lo deflate.lo match.o infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo $(ARCH_SHARED_OBJS)
PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
-# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
-OBJA =
-PIC_OBJA =
-
-OBJS = $(OBJC) $(OBJA)
+OBJS = $(OBJC)
-PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
+PIC_OBJS = $(PIC_OBJC)
all: $(ARCHDIR) static shared
$(AR) $(ARFLAGS) $@ $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
-match.o: match.S
- $(CPP) match.S > _match.s
- $(CC) -c _match.s
- mv _match.o match.o
- rm -f _match.s
-
-match.lo: match.S
- $(CPP) match.S > _match.s
- $(CC) -c -fPIC _match.s
- mv _match.o match.lo
- rm -f _match.s
-
example.o: test/example.c zlib.h zconf.h
$(CC) $(CFLAGS) -I. -c -o $@ test/example.c
test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
cc=${CC-${CROSS_PREFIX}gcc}
cflags=${CFLAGS-"-O3"}
-# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
case "$cc" in
*gcc*) gcc=1 ;;
*clang*) gcc=1 ;;
TEST="all teststatic testshared"
fi
-# check for underscores in external names for use by assembler code
-CPP=${CPP-"$CC -E"}
-case $CFLAGS in
- *ASMV*)
- echo >> configure.log
- show "$NM $test.o | grep _hello"
- if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
- CPP="$CPP -DNO_UNDERLINE"
- echo Checking for underline in external names... No. | tee -a configure.log
- else
- echo Checking for underline in external names... Yes. | tee -a configure.log
- fi ;;
-esac
-
echo >> configure.log
# check for large file support, and if none, check for fseeko()
echo ARFLAGS = $ARFLAGS >> configure.log
echo CC = $CC >> configure.log
echo CFLAGS = $CFLAGS >> configure.log
-echo CPP = $CPP >> configure.log
echo EXE = $EXE >> configure.log
echo LDCONFIG = $LDCONFIG >> configure.log
echo LDFLAGS = $LDFLAGS >> configure.log
/^SFLAGS *=/s#=.*#=$SFLAGS#
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
/^LDSHARED *=/s#=.*#=$LDSHARED#
-/^CPP *=/s#=.*#=$CPP#
/^STATICLIB *=/s#=.*#=$STATICLIB#
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
sed < zlib.pc.in "
/^CC *=/s#=.*#=$CC#
/^CFLAGS *=/s#=.*#=$CFLAGS#
-/^CPP *=/s#=.*#=$CPP#
/^LDSHARED *=/s#=.*#=$LDSHARED#
/^STATICLIB *=/s#=.*#=$STATICLIB#
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
/* @(#) $Id$ */
#include "deflate.h"
+#include "match.h"
#if defined(X86_CPUID)
#include "arch/x86/x86.h"
local void putShortMSB (deflate_state *s, uInt b);
ZLIB_INTERNAL void flush_pending (z_streamp strm);
ZLIB_INTERNAL int read_buf (z_streamp strm, Byte *buf, unsigned size);
-#ifdef ASMV
- void match_init (void); /* asm code initialization */
- uInt longest_match (deflate_state *s, IPos cur_match);
-#else
-local uInt longest_match (deflate_state *s, IPos cur_match);
-#endif
#ifdef DEBUG
local void check_match (deflate_state *s, IPos start, IPos match, int length);
s->match_length = s->prev_length = MIN_MATCH-1;
s->match_available = 0;
s->ins_h = 0;
-#ifdef ASMV
- match_init(); /* initialize the asm code */
-#endif
}
-#include "match.c"
-
#ifdef DEBUG
/* ===========================================================================
* Check that the match at match_start is indeed a match.
#include "inflate.h"
#include "inffast.h"
-#ifndef ASMINF
-
/* Allow machine dependent optimization for post-increment or pre-increment.
Based on testing to date,
Pre-increment preferred for:
- Larger unrolled copy loops (three is about right)
- Moving len -= 3 statement into middle of loop
*/
-
-#endif /* !ASMINF */
#include "deflate.h"
#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
-# define longest_match std2_longest_match
+# define std2_longest_match
#else
-# define longest_match std1_longest_match
+# define std1_longest_match
#endif
+#ifdef std1_longest_match
+
/*
* Standard longest_match
*
*/
-local unsigned std1_longest_match(deflate_state *z_const s, IPos cur_match)
+ZLIB_INTERNAL unsigned longest_match(deflate_state *z_const s, IPos cur_match)
{
z_const unsigned wmask = s->w_mask;
z_const Pos *prev = s->prev;
return best_len;
return s->lookahead;
}
+#endif
+#ifdef std2_longest_match
/*
* UNALIGNED_OK longest_match
*
*/
-local unsigned std2_longest_match(deflate_state *z_const s, IPos cur_match)
+ZLIB_INTERNAL unsigned longest_match(deflate_state *z_const s, IPos cur_match)
{
z_const unsigned wmask = s->w_mask;
z_const Pos *prev = s->prev;
return best_len;
return s->lookahead;
}
+#endif
#ifdef DEBUG
flags += 1 << 8;
#endif
-#if defined(ASMV) || defined(ASMINF)
- flags += 1 << 9;
-#endif
#ifdef ZLIB_WINAPI
flags += 1 << 10;
#endif