summaryrefslogtreecommitdiffstats
path: root/tests/deckard/platform.mk
diff options
context:
space:
mode:
Diffstat (limited to 'tests/deckard/platform.mk')
-rw-r--r--tests/deckard/platform.mk27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/deckard/platform.mk b/tests/deckard/platform.mk
new file mode 100644
index 0000000..4a96c71
--- /dev/null
+++ b/tests/deckard/platform.mk
@@ -0,0 +1,27 @@
+# Evaluate library
+define have_lib
+ifeq ($$(strip $$($(1)_LIBS)),)
+ HAS_$(1) := no
+else
+ HAS_$(1) := yes
+endif
+endef
+
+# Find library (pkg-config)
+define find_lib
+ $(call find_alt,$(1),$(1),$(2))
+endef
+
+# Find library alternative (pkg-config)
+define find_alt
+ ifeq ($$(strip $$($(1)_LIBS)),)
+ ifneq ($(strip $(3)),)
+ $(1)_VER := $(shell pkg-config --atleast-version=$(3) $(2) && echo $(3))
+ endif
+ ifeq ($(strip $(3)),$$($(1)_VER))
+ $(1)_CFLAGS := $(shell pkg-config --cflags $(2) --silence-errors)
+ $(1)_LIBS := $(shell pkg-config --libs $(2) --silence-errors)
+ endif
+ endif
+ $(call have_lib,$(1),$(3))
+endef