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
This commit is contained in:
Pascal Massimino 2017-09-03 21:25:31 -07:00
parent e9459382b0
commit 8635973dc3

View File

@ -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)