Centralize checks for Freetype, with a user override

This lets us find a library in a non-standard library directory
(via -L in the pkg-config metadata), and allows overrides similar to
the Autoconf convention, e.g.

    make FREETYPE_CFLAGS=-I/opt/freetype/include \
        FREETYPE_LIBS="-L/opt/freetype/lib -lfreetype"

If pkg-config didn't work, assume that Freetype is in the default
location.
This commit is contained in:
Simon McVittie 2013-05-19 20:52:23 +01:00
parent 1fe4e0c239
commit 608347c84d

View file

@ -271,7 +271,6 @@ ifneq ($(BUILD_CLIENT),0)
OPENAL_LIBS=$(shell pkg-config --silence-errors --libs openal)
SDL_CFLAGS=$(shell pkg-config --silence-errors --cflags sdl|sed 's/-Dmain=SDL_main//')
SDL_LIBS=$(shell pkg-config --silence-errors --libs sdl)
FREETYPE_CFLAGS=$(shell pkg-config --silence-errors --cflags freetype2)
endif
# Use sdl-config if all else fails
ifeq ($(SDL_CFLAGS),)
@ -385,10 +384,6 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu"))
CLIENT_LIBS += -lrt
endif
ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += $(FREETYPE_CFLAGS)
endif
ifeq ($(ARCH),x86)
# linux32 make ...
BASE_CFLAGS += -m32
@ -466,10 +461,6 @@ ifeq ($(PLATFORM),darwin)
endif
endif
ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += $(FREETYPE_CFLAGS)
endif
BASE_CFLAGS += -D_THREAD_SAFE=1
ifeq ($(USE_LOCAL_HEADERS),1)
@ -584,7 +575,7 @@ ifeq ($(PLATFORM),mingw32)
RENDERER_LIBS = -lgdi32 -lole32 -lopengl32
ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += -Ifreetype2
FREETYPE_CFLAGS = -Ifreetype2
endif
ifeq ($(USE_CURL),1)
@ -913,10 +904,6 @@ endif
TARGETS =
ifeq ($(USE_FREETYPE),1)
BASE_CFLAGS += -DBUILD_FREETYPE
endif
ifndef FULLBINEXT
FULLBINEXT=.$(ARCH)$(BINEXT)
endif
@ -1048,7 +1035,11 @@ else
endif
ifeq ($(USE_FREETYPE),1)
RENDERER_LIBS += -lfreetype
FREETYPE_CFLAGS ?= $(shell pkg-config --silence-errors --cflags freetype2 || true)
FREETYPE_LIBS ?= $(shell pkg-config --silence-errors --libs freetype2 || echo -lfreetype)
BASE_CFLAGS += -DBUILD_FREETYPE $(FREETYPE_CFLAGS)
RENDERER_LIBS += $(FREETYPE_LIBS)
endif
ifeq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))