From db8eb226e3c5c811bd09b9656e9df054cc985645 Mon Sep 17 00:00:00 2001
From: Clemens Terasa <clemens.terasa@garz-fricke.com>
Date: Fri, 25 Sep 2020 07:57:34 +0200
Subject: [PATCH] pamx: Fix pkg-config X11 query

The query for the pkg-config was not working as expected. This was
probably not an issue for X11 systems, however it deos create problems
with non-x11 builds.

Fix it similar to https://sourceforge.net/p/netpbm/code/3682/
---
 other/pamx/Makefile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/other/pamx/Makefile b/other/pamx/Makefile
index 4e06e0f..c9fc9f8 100644
--- a/other/pamx/Makefile
+++ b/other/pamx/Makefile
@@ -9,7 +9,10 @@ include $(BUILDDIR)/config.mk
 
 EXTERN_INCLUDE =
 
-ifeq ($(shell pkg-config x11 --modversion --silence-errors),)
+TEST_PKGCONFIG_X11 := \
+	if pkg-config x11 --exists; then echo exists; fi
+
+ifeq ($(shell $(TEST_PKGCONFIG_X11)),)
   # Pkg-config has never heard of X11, or doesn't even exist
 
   ifneq ($(X11LIB),NONE)
@@ -46,7 +49,7 @@ all: $(BINARIES)
 
 include $(SRCDIR)/common.mk
 
-ifeq ($(shell pkg-config x11 --libs),)
+ifeq ($(shell $(TEST_PKGCONFIG_X11)),)
   X11_LIBOPTS = $(shell $(LIBOPT) $(LIBOPTR) $(X11LIB))
 else
   X11_LIBOPTS = $(shell pkg-config x11 --libs)