[PATCH] Use pkg-config to find msgpack library when available
authorJames McCoy <jamessan@jamessan.com>
Wed, 15 Jun 2016 13:06:50 +0000 (09:06 -0400)
committerAndrii Senkovych <andrii@senkovych.com>
Sun, 26 Aug 2018 12:30:36 +0000 (13:30 +0100)
Since 0.5.8, msgpack-c has provided a pkg-config file.  If it's
installed, use pkg-config to get the relevant CFLAGS/LDFLAGS.

Signed-off-by: James McCoy <jamessan@jamessan.com>
Gbp-Pq: Name msgpack-pkgconfig.patch

Makefile

index e29ad4b8951d318b79df422bf5bff0cdbf1d32f8..40a7787fdb73a2b17866a8062218add6bb9a82fd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,11 +9,17 @@ CFLAGS ?= -O0 -ggdb -Wall -Wextra -I. -Ijansson/src -Ihttp-parser
 LDFLAGS ?= -levent -pthread
 
 # check for MessagePack
-MSGPACK_LIB=$(shell ls /usr/lib/libmsgpack.so 2>/dev/null)
-ifneq ($(strip $(MSGPACK_LIB)),)
+ifneq ($(findstring yes,$(shell pkg-config --exists msgpack && echo yes)),)
        FORMAT_OBJS += formats/msgpack.o
-       CFLAGS += -DMSGPACK=1
-       LDFLAGS += -lmsgpack
+       CFLAGS += -DMSGPACK=1 $(shell pkg-config --cflags msgpack)
+       LDFLAGS += $(shell pkg-config --libs msgpack)
+else
+       MSGPACK_LIB=$(shell ls /usr/lib/libmsgpack.so 2>/dev/null)
+       ifneq ($(strip $(MSGPACK_LIB)),)
+               FORMAT_OBJS += formats/msgpack.o
+               CFLAGS += -DMSGPACK=1
+               LDFLAGS += -lmsgpack
+       endif
 endif