From: Joel Rosdahl Date: Fri, 16 Jul 2010 20:36:35 +0000 (+0200) Subject: Link test/main with local zlib if needed X-Git-Tag: v3.1~168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86d6a5d7cb7b6329afbe5e0a44cdf834ffbefec8;p=thirdparty%2Fccache.git Link test/main with local zlib if needed --- diff --git a/.gitignore b/.gitignore index 569aef174..15d45c432 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*.a *.html *.o *.xml diff --git a/Makefile.in b/Makefile.in index 70f703d9c..96855757e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -8,13 +8,15 @@ mandir = @mandir@ datarootdir = @datarootdir@ installcmd = @INSTALL@ +AR = @AR@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ -I. -I$(srcdir) LDFLAGS = @LDFLAGS@ EXEEXT = @EXEEXT@ +RANLIB = @RANLIB@ -libs = @LIBS@ -lm +libs = @LIBS@ -lm -lz base_sources = \ ccache.c mdfour.c hash.c execute.c util.c args.c stats.c version.c \ @@ -22,16 +24,21 @@ base_sources = \ murmurhashneutral2.c hashutil.c getopt_long.c exitfn.c base_objs = $(base_sources:.c=.o) -ccache_sources = main.c $(base_sources) @extra_sources@ +ccache_sources = main.c $(base_sources) ccache_objs = $(ccache_sources:.c=.o) +zlib_sources = \ + zlib/adler32.c zlib/compress.c zlib/crc32.c zlib/deflate.c zlib/gzio.c \ + zlib/inffast.c zlib/inflate.c zlib/inftrees.c zlib/trees.c zlib/zutil.c +zlib_objs = $(zlib_sources:.c=.o) + test_suites = \ $(srcdir)/test/test_util.c test_sources = test/main.c test/framework.c $(test_suites) test_objs = $(test_sources:.c=.o) all_sources = $(ccache_sources) $(test_sources) -all_objs = $(ccache_objs) $(test_objs) +all_objs = $(ccache_objs) $(test_objs) $(zlib_objs) generated_docs = ccache.1 INSTALL.html manual.html NEWS.html README.html @@ -43,7 +50,7 @@ all: ccache$(EXEEXT) .PHONY: docs docs: $(generated_docs) -ccache$(EXEEXT): $(ccache_objs) +ccache$(EXEEXT): $(ccache_objs) @extra_deps@ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(libs) .PHONY: install @@ -57,6 +64,10 @@ install: all clean: rm -f $(files_to_clean) +zlib/libz.a: $(zlib_objs) + $(AR) cr $@ $^ + $(RANLIB) $@ + .PHONY: perf perf: ccache$(EXEEXT) $(srcdir)/perf.py --ccache ccache$(EXEEXT) $(CC) $(CFLAGS) $(CPPFLAGS) $(srcdir)/ccache.c @@ -66,7 +77,7 @@ test: ccache$(EXEEXT) test/main$(EXEEXT) test/main$(EXEEXT) CC='$(CC)' $(srcdir)/test.sh -test/main$(EXEEXT): $(base_objs) $(test_objs) +test/main$(EXEEXT): $(base_objs) $(test_objs) @extra_deps@ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(libs) test/main.o: test/suites.h diff --git a/configure.ac b/configure.ac index 589a2a55e..fdc353edb 100644 --- a/configure.ac +++ b/configure.ac @@ -7,13 +7,18 @@ AC_MSG_NOTICE([Configuring ccache]) AC_CONFIG_HEADER(config.h) -AC_SUBST(extra_sources) +AC_SUBST(extra_deps) AC_SUBST(include_dev_mk) dnl Checks for programs. AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL +AC_PROG_RANLIB +AC_CHECK_TOOL(AR, ar) +if test -z "$ac_ct_AR"; then + AC_MSG_ERROR(cannot find ar) +fi dnl =========================================================================== dnl Feature macro stuff borrowed from Python's configure.in @@ -244,14 +249,11 @@ AC_CACHE_CHECK( AC_CHECK_LIB(z, gzdopen, true) if test $ccache_cv_zlib_1_2_3 = yes && test $ac_cv_lib_z_gzdopen = yes; then use_bundled_zlib=no - LIBS="-lz $LIBS" else use_bundled_zlib=yes - extra_sources="$extra_sources zlib/adler32.c zlib/compress.c zlib/crc32.c" - extra_sources="$extra_sources zlib/deflate.c zlib/gzio.c zlib/inffast.c" - extra_sources="$extra_sources zlib/inflate.c zlib/inftrees.c zlib/trees.c" - extra_sources="$extra_sources zlib/zutil.c" + extra_deps="zlib/libz.a" CPPFLAGS="$CPPFLAGS -I\$(srcdir)/zlib" + LIBS="-Lzlib $LIBS" mkdir -p zlib fi