about summary refs log tree commit diff
path: root/other/pamx/Makefile
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-06-26 21:54:57 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2011-06-26 21:54:57 +0000
commite91046e523112cff2cf737bfb0841eb0040e4246 (patch)
treefea60927c3c927005c4c5aa4ff81ae0d75a6db25 /other/pamx/Makefile
parent807b2912512e4a5b69b3583a67f0eb1ee0f9ece7 (diff)
downloadnetpbm-mirror-e91046e523112cff2cf737bfb0841eb0040e4246.tar.gz
netpbm-mirror-e91046e523112cff2cf737bfb0841eb0040e4246.tar.xz
netpbm-mirror-e91046e523112cff2cf737bfb0841eb0040e4246.zip
Use pkg-config for X libraries
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1498 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'other/pamx/Makefile')
-rw-r--r--other/pamx/Makefile26
1 files changed, 21 insertions, 5 deletions
diff --git a/other/pamx/Makefile b/other/pamx/Makefile
index a40ea3a6..b41cadf8 100644
--- a/other/pamx/Makefile
+++ b/other/pamx/Makefile
@@ -8,13 +8,23 @@ VPATH=.:$(SRCDIR)/$(SUBDIR)
 include $(BUILDDIR)/config.mk
 
 EXTERN_INCLUDE =
-ifneq ($(X11LIB),NONE)
-  ifneq ($(X11HDR_DIR),)
-    EXTERN_INCLUDES += -I$(X11HDR_DIR)
+
+ifeq ($(shell pkg-config x11 --modversion --silence-errors),)
+  # Pkg-config has never heard of X11, or doesn't even exist
+
+  ifneq ($(X11LIB),NONE)
+    HAVE_X11LIB = Y
+    ifneq ($(X11HDR_DIR)x,x)
+      EXTERN_INCLUDES += -I$(X11HDR_DIR)
+    endif
   endif
+else
+  HAVE_X11LIB = Y
+  X11LIB = $(shell pkg-config x11 --libs)
+  EXTERN_INCLUDES += $(shell pkg-config x11 --cflags)
 endif
 
-ifneq ($(X11LIB),NONE)
+ifeq ($(HAVE_X11LIB),Y)
   BINARIES += pamx
 
   PAMX_OBJECTS = \
@@ -39,7 +49,13 @@ all: $(BINARIES)
 
 include $(SRCDIR)/common.mk
 
+ifeq ($(shell pkg-config x11 --libs),)
+  X11_LIBOPTS = $(shell $(LIBOPT) $(LIBOPTR) $(X11LIB))
+else
+  X11_LIBOPTS = $(shell pkg-config x11 --libs)
+endif
+
 pamx: $(PAMX_OBJECTS) $(NETPBMLIB) $(LIBOPT)
 	$(LD) -o $@ $(PAMX_OBJECTS) \
-	  $(shell $(LIBOPT) $(NETPBMLIB) $(X11LIB)) \
+	  $(shell $(LIBOPT) $(NETPBMLIB) $(X11_LIBOPTS)) \
 	  $(LDFLAGS) $(LDLIBS) $(MATHLIB) $(RPATH) $(LADD)