Skip to content

Commit 96e0237

Browse files
committed
build: don't hard-code pkg-config
1 parent 8611241 commit 96e0237

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

projects/unix/Makefile

+10-2
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ ifeq ($(OS), OSX)
137137
endif
138138
endif
139139

140+
# test for essential build dependencies
141+
ifeq ($(origin PKG_CONFIG), undefined)
142+
PKG_CONFIG = $(CROSS_COMPILE)pkg-config
143+
ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)
144+
$(error $(PKG_CONFIG) not found)
145+
endif
146+
endif
147+
140148
ifeq ($(OS), LINUX)
141149
HIDAPI_NAME=hidapi-hidraw
142150
else
@@ -145,9 +153,9 @@ endif
145153

146154
# test for presence of HIDLIB
147155
ifeq ($(origin HID_CFLAGS) $(origin HID_LDLIBS), undefined undefined)
148-
HIDAPI_CONFIG = $(CROSS_COMPILE)pkg-config $(HIDAPI_NAME)
156+
HIDAPI_CONFIG = $(PKG_CONFIG) $(HIDAPI_NAME)
149157
ifeq ($(shell which $(HIDAPI_CONFIG) 2>/dev/null),)
150-
HIDAPI_CONFIG = $(CROSS_COMPILE)pkg-config $(HIDAPI_NAME)
158+
HIDAPI_CONFIG = $(PKG_CONFIG) $(HIDAPI_NAME)
151159
ifeq ($(shell which $(HIDAPI_CONFIG) 2>/dev/null),)
152160
$(error No HIDAPI development libraries found!)
153161
else

0 commit comments

Comments
 (0)