diff --git a/Makefile b/Makefile index 1563d703..086048dc 100644 --- a/Makefile +++ b/Makefile @@ -982,31 +982,37 @@ ifeq ($(USE_CURL),1) endif ifeq ($(USE_CODEC_VORBIS),1) - CLIENT_CFLAGS += -DUSE_CODEC_VORBIS - CLIENT_LIBS += -lvorbisfile -lvorbis + VORBIS_CFLAGS ?= $(shell pkg-config --silence-errors --cflags vorbisfile vorbis || true) + VORBIS_LIBS ?= $(shell pkg-config --silence-errors --libs vorbisfile vorbis || echo -lvorbisfile -lvorbis) + CLIENT_CFLAGS += -DUSE_CODEC_VORBIS $(VORBIS_CFLAGS) + CLIENT_LIBS += $(VORBIS_LIBS) NEED_OGG=1 endif ifeq ($(USE_CODEC_OPUS),1) CLIENT_CFLAGS += -DUSE_CODEC_OPUS ifeq ($(USE_INTERNAL_OPUS),1) - CLIENT_CFLAGS += -DOPUS_BUILD -DHAVE_LRINTF -DFLOATING_POINT -DUSE_ALLOCA \ + OPUS_CFLAGS = -DOPUS_BUILD -DHAVE_LRINTF -DFLOATING_POINT -DUSE_ALLOCA \ -I$(OPUSDIR)/include -I$(OPUSDIR)/celt -I$(OPUSDIR)/silk \ - -I$(OPUSDIR)/silk/float - - CLIENT_CFLAGS += -I$(OPUSFILEDIR)/include + -I$(OPUSDIR)/silk/float -I$(OPUSFILEDIR)/include else - CLIENT_LIBS += -lopusfile -lopus + OPUS_CFLAGS=$(shell pkg-config --silence-errors --cflags opusfile opus || true) + OPUS_LIBS=$(shell pkg-config --silence-errors --libs opusfile opus || echo -lopusfile -lopus) endif + CLIENT_CFLAGS += $(OPUS_CFLAGS) + CLIENT_LIBS += $(OPUS_LIBS) NEED_OGG=1 endif ifeq ($(NEED_OGG),1) ifeq ($(USE_INTERNAL_OGG),1) - CLIENT_CFLAGS += -I$(OGGDIR)/include + OGG_CFLAGS = -I$(OGGDIR)/include else - CLIENT_LIBS += -logg + OGG_CFLAGS ?= $(shell pkg-config --silence-errors --cflags ogg || true) + OGG_LIBS ?= $(shell pkg-config --silence-errors --libs ogg || echo -logg) endif + CLIENT_CFLAGS += $(OGG_CFLAGS) + CLIENT_LIBS += $(OGG_LIBS) endif ifeq ($(USE_RENDERER_DLOPEN),1)