about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--GNUmakefile12
1 files changed, 8 insertions, 4 deletions
diff --git a/GNUmakefile b/GNUmakefile
index d6745eaf..d6e59c20 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -272,9 +272,6 @@ endif
 ifneq ($(LINUXSVGALIB),NONE)
   MERGELIBS += $(LINUXSVGALIB)
 endif
-ifneq ($(X11LIB),NONE)
-  MERGELIBS += $(X11LIB)
-endif
 
 ifeq ($(shell libpng$(PNGVER)-config --version),)
   PNGLD = $(shell $(LIBOPT) $(LIBOPTR) $(PNGLIB) $(ZLIB))
@@ -288,6 +285,13 @@ else
   XML2LD=$(shell xml2-config --libs)
 endif
 
+ifeq ($(shell pkg-config x11 --libs),)
+  X11LD = $(shell $(LIBOPT) $(LIBOPTR) $(X11LIB))
+else
+  X11LD = $(shell pkg-config x11 --libs)
+endif
+
+
 
 # If URTLIB is BUNDLED_URTLIB, then we're responsible for building it, which
 # means it needs to be a dependency:
@@ -330,7 +334,7 @@ netpbm:%:%.o $(OBJECT_DEP) $(NETPBMLIB) $(URTLIBDEP) $(LIBOPT)
 # Note that LDFLAGS might contain -L options, so order is important.
 	$(LD) -o $@ $< $(OBJECT_LIST) \
           $(LDFLAGS) $(shell $(LIBOPT) $(NETPBMLIB) $(MERGELIBS)) \
-	  $(PNGLD) $(XML2LD) $(MATHLIB) $(NETWORKLD) $(LADD)
+	  $(PNGLD) $(XML2LD) $(X11LD) $(MATHLIB) $(NETWORKLD) $(LADD)
 
 netpbm.o: mergetrylist