From 5bbf0049365ad01540580182a2a7d851485167b3 Mon Sep 17 00:00:00 2001 From: bjarni Date: Fri, 31 Mar 2006 10:04:18 +0000 Subject: [PATCH] (svn r4197) reentered STATIC_ZLIB_PATH (removed in 4183) since it turned out that it's used after all --- Makefile | 13 +++++++++++-- makefiledir/Makefile.config_writer | 1 + makefiledir/Makefile.libdetection | 20 ++++++++++++++++++-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f48ad707a1..04f0b67b5c 100644 --- a/Makefile +++ b/Makefile @@ -416,8 +416,17 @@ endif # zlib config ifdef WITH_ZLIB - CDEFS += -DWITH_ZLIB - LIBS += -lz + CDEFS += -DWITH_ZLIB + ifdef STATIC + ifdef OSX + # OSX links dynamically to zlib, even in static builds since it's always present in the system + LIBS += -lz + else + LIBS += $(STATIC_ZLIB_PATH) + endif + else + LIBS += -lz + endif endif # libpng config diff --git a/makefiledir/Makefile.config_writer b/makefiledir/Makefile.config_writer index 2f3351a32d..a305c89d0b 100644 --- a/makefiledir/Makefile.config_writer +++ b/makefiledir/Makefile.config_writer @@ -67,6 +67,7 @@ $(MAKE_CONFIG): $(call CONFIG_LINE,WITH_ZLIB:=$(WITH_ZLIB)) $(call CONFIG_LINE,WITH_SDL:=$(WITH_SDL)) $(call CONFIG_LINE,WITH_PNG:=$(WITH_PNG)) + $(call CONFIG_LINE,STATIC_ZLIB_PATH:=$(STATIC_ZLIB_PATH)) $(call CONFIG_LINE,WITH_COCOA:=$(WITH_COCOA)) $(call CONFIG_LINE,) diff --git a/makefiledir/Makefile.libdetection b/makefiledir/Makefile.libdetection index a8859505f1..ade09c076c 100644 --- a/makefiledir/Makefile.libdetection +++ b/makefiledir/Makefile.libdetection @@ -81,8 +81,8 @@ WITH_SDL:=$(shell $(SDL-CONFIG) --version 2>/dev/null) WITH_PNG:=$(shell $(LIBPNG-CONFIG) --version 2>/dev/null) ifdef WITH_PNG -# LibPNG depends on Zlib -WITH_ZLIB:=1 + # LibPNG depends on Zlib + WITH_ZLIB:=1 else # We go looking for zlib with a little hack WITH_ZLIB:=$(shell ls /usr/include | grep "zlib.h" 2>/dev/null) \ @@ -92,6 +92,22 @@ WITH_ZLIB:=1 endif endif +ifdef WITH_ZLIB + TEMP:=$(shell ls /lib 2>/dev/null | grep "zlib.a")$(shell ls /lib 2>/dev/null | grep "libz.a") + ifdef TEMP + STATIC_ZLIB_PATH:=/lib/$(TEMP) + else + TEMP:=$(shell ls /usr/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/lib 2>/dev/null | grep "libz.a") + ifdef TEMP + STATIC_ZLIB_PATH:=/usr/lib/$(TEMP) + else + TEMP:=$(shell ls /usr/local/lib 2>/dev/null | grep "zlib.a")$(shell ls /usr/local/lib 2>/dev/null | grep "libz.a") + ifdef TEMP + STATIC_ZLIB_PATH:=/usr/local/lib/$(TEMP) + endif + endif + endif +endif # sets the default paths ifdef UNIX