From 8635973dc3d2748342655477ba3f0ac4532da487 Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Sun, 3 Sep 2017 21:25:31 -0700 Subject: [PATCH] use sdl-config (if available) to determine the link flags this fixes the compilation of vwebp_sdl on MacOS. BUG=webp:355 Change-Id: I48c5607f31965b220db6bf707cff22b7157e0bb6 --- makefile.unix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/makefile.unix b/makefile.unix index 85959c10..5e7761ef 100644 --- a/makefile.unix +++ b/makefile.unix @@ -34,6 +34,16 @@ else GL_LIBS = -lglut -lGL endif +# SDL flags: use sdl-config if it exists +SDL_CONFIG = $(shell sdl-config --version 2> /dev/null) +ifneq ($(SDL_CONFIG),) + SDL_LIBS = $(shell sdl-config --libs) + SDL_FLAGS = $(shell sdl-config --cflags) +else + # use best-guess + SDL_LIBS = -lSDL + SDL_FLAGS = +endif # To install libraries on Mac OS X: # 1. Install MacPorts (http://www.macports.org/install.php) @@ -440,8 +450,8 @@ extras/vwebp_sdl: extras/vwebp_sdl.o extras/vwebp_sdl: extras/webp_to_sdl.o extras/vwebp_sdl: imageio/libimageio_util.a extras/vwebp_sdl: src/libwebp.a -extras/vwebp_sdl: EXTRA_FLAGS += -DWEBP_HAVE_SDL -extras/vwebp_sdl: EXTRA_LIBS += -lSDL +extras/vwebp_sdl: EXTRA_FLAGS += -DWEBP_HAVE_SDL $(SDL_FLAGS) +extras/vwebp_sdl: EXTRA_LIBS += $(SDL_LIBS) $(OUT_EXAMPLES) $(EXTRA_EXAMPLES) $(OTHER_EXAMPLES): $(CC) -o $@ $^ $(LDFLAGS)