Skip to content

Commit b007759

Browse files
committed
build: use pkg-config for SDL2
SDL2 hasn't required suing sdl2-config in a long time and using pkg-config can have better results for distros.
1 parent 966a5df commit b007759

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

projects/unix/Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -351,16 +351,18 @@ endif
351351

352352
# test for presence of SDL
353353
ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
354-
SDL_CONFIG = $(CROSS_COMPILE)sdl2-config
355-
ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
356-
$(error No SDL development libraries found!)
357-
else
358-
ifeq ($(NETPLAY), 1)
359-
SDL_LDLIBS += -lSDL2_net
354+
ifeq ($(shell $(PKG_CONFIG) --modversion sdl2 2>/dev/null),)
355+
$(error No SDL2 development libraries found!)
356+
endif
357+
ifeq ($(NETPLAY), 1)
358+
ifeq ($(shell $(PKG_CONFIG) --modversion SDL2_net 2>/dev/null),)
359+
$(error No SDL2_net development libraries found!)
360360
endif
361+
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags SDL2_net)
362+
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs SDL2_net)
361363
endif
362-
SDL_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
363-
SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs)
364+
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl2)
365+
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl2)
364366
endif
365367
CFLAGS += $(SDL_CFLAGS)
366368
LDLIBS += $(SDL_LDLIBS)

0 commit comments

Comments
 (0)