Jelajahi Sumber

jansson: test if pkg-config knows about jansson library

Daniel-Constantin Mierla 9 tahun lalu
induk
melakukan
a04755addf
1 mengubah file dengan 14 tambahan dan 7 penghapusan
  1. 14 7
      modules/jansson/Makefile

+ 14 - 7
modules/jansson/Makefile

@@ -1,21 +1,28 @@
 #
 # jansson module makefile
 #
-# 
+#
 # WARNING: do not run this directly, it should be run by the master Makefile
 
 include ../../Makefile.defs
 auto_gen=
 NAME=jansson.so
 
-BUILDER = $(shell which pkg-config)
-ifeq ($(BUILDER),)
-	DEFS+=-I$(LOCALBASE)/include \
-	LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -ljansson
+ifeq ($(CROSS_COMPILE),)
+JNS_BUILDER=$(shell \
+	if pkg-config --exists jansson; then \
+		echo 'pkg-config jansson'; \
+	fi)
+endif
+
+ifneq ($(JNS_BUILDER),)
+	DEFS += $(shell $(JNS_BUILDER) --cflags)
+	LIBS += $(shell $(JNS_BUILDER) --libs)
 else
-	DEFS+= $(shell pkg-config --cflags jansson)
-	LIBS+= $(shell pkg-config --libs jansson)
+	DEFS+=-I$(LOCALBASE)/include
+	LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -ljansson
 endif
+
 DEFS+=-DOPENSER_MOD_INTERFACE
 
 SERLIBPATH=../../lib