summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2012-12-13 17:23:47 +0000
committerVincent Sanders <vince@netsurf-browser.org>2012-12-13 17:23:47 +0000
commit16d67095a6731f329bad971985e8983cdc054efe (patch)
treecde78d6c8ca1cf6035fcf29e4bc0a4b684fcee45 /Makefile
parent45906b9dc2c87181f359289abc034f84b44947c4 (diff)
downloadnetsurf-16d67095a6731f329bad971985e8983cdc054efe.tar.gz
netsurf-16d67095a6731f329bad971985e8983cdc054efe.tar.bz2
add pkg-config macro for libraries which are not controled by configuration
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 25 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index d8ce8a657..91f3aac08 100644
--- a/Makefile
+++ b/Makefile
@@ -318,6 +318,31 @@ endef
# Extend flags with appropriate values from pkg-config for enabled features
#
+# 1: pkg-config required modules for feature
+# 2: Human-readable name for the feature
+define pkg_config_find_and_add
+ ifeq ($$(PKG_CONFIG),)
+ $$(error pkg-config is required to auto-detect feature availability)
+ endif
+
+ PKG_CONFIG_$(1)_EXISTS := $$(shell $$(PKG_CONFIG) --exists $(1) && echo yes)
+
+ ifeq ($$(PKG_CONFIG_$(1)_EXISTS),yes)
+ CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(1))
+ LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(1))
+ ifneq ($(MAKECMDGOALS),clean)
+ $$(info PKG.CNFG: $(2) ($(1)) enabled)
+ endif
+ else
+ ifneq ($(MAKECMDGOALS),clean)
+ $$(info PKG.CNFG: $(2) ($(1)) failed)
+ $$(error Unable to find library for: $(2) ($(1)))
+ endif
+ endif
+endef
+
+# Extend flags with appropriate values from pkg-config for enabled features
+#
# 1: Feature name (ie, NETSURF_USE_RSVG -> RSVG)
# 2: pkg-config required modules for feature
# 3: Human-readable name for the feature