SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 43210876beaa355e96fe8a94069d301a4c9a6219 parent 8760cc55174409ddab92b719a2964c3462e27749 Author: Maximilian Mader <max@bastelstu.be> Date: Wed, 13 Jul 2022 18:07:24 +0200 Use `pkg-config` to check if OpenAL is available If `pkg-config` is available, the OpenAL driver will be compiled unless OpenAL dev headers cannot be found or `ENABLE_OPENAL=0` is set. If `pkg-config` is unavailable `ENABLE_OPENAL=1` can be set to force the use of OpenAL. In this case users must make sure that they have OpenAL dev headers installed to compile successfully. Diffstat:
| M | Makefile | 25 | +++++++++++++++++++------ |
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile @@ -24,12 +24,6 @@ NATIVE_CC := cc SDL_AUDIO_DRIVERS ?= sdl endif -ifneq ($(ENABLE_OPENAL),) -CFLAGS += -DENABLE_OPENAL -LDFLAGS += -lopenal -SDL_AUDIO_DRIVERS += openal -endif - PB12_COMPRESS := build/pb12$(EXESUFFIX) ifeq ($(PLATFORM),Darwin) @@ -139,16 +133,35 @@ endif ifeq (,$(PKG_CONFIG)) SDL_CFLAGS := $(shell sdl2-config --cflags) SDL_LDFLAGS := $(shell sdl2-config --libs) -lpthread + +# We cannot detect the presence of OpenAL dev headers, +# so we must do this manually +ifeq ($(ENABLE_OPENAL),1) +SDL_CFLAGS += -DENABLE_OPENAL +SDL_LDFLAGS += -lopenal +SDL_AUDIO_DRIVERS += openal +endif else SDL_CFLAGS := $(shell $(PKG_CONFIG) --cflags sdl2) SDL_LDFLAGS := $(shell $(PKG_CONFIG) --libs sdl2) -lpthread + +# Allow OpenAL to be disabled even if the development libraries are available +ifneq ($(ENABLE_OPENAL),0) +ifeq ($(shell $(PKG_CONFIG) --exists openal && echo 0),0) +SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags openal) -DENABLE_OPENAL +SDL_LDFLAGS += $(shell $(PKG_CONFIG) --libs openal) +SDL_AUDIO_DRIVERS += openal +endif endif +endif + ifeq (,$(PKG_CONFIG)) GL_LDFLAGS := -lGL else GL_CFLAGS := $(shell $(PKG_CONFIG) --cflags gl) GL_LDFLAGS := $(shell $(PKG_CONFIG) --libs gl || echo -lGL) endif + ifeq ($(PLATFORM),windows32) CFLAGS += -IWindows -Drandom=rand --target=i386-pc-windows LDFLAGS += -lmsvcrt -lcomdlg32 -luser32 -lshell32 -lole32 -lSDL2main -Wl,/MANIFESTFILE:NUL --target=i386-pc-windows
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.