From b0bd0da696481fa7f6a97e1236e219e29b51b9e4 Mon Sep 17 00:00:00 2001 From: Tamas TEVESZ Date: Sun, 12 Feb 2017 11:44:24 +0100 Subject: Autodetect XLSX support Both libzip and libXML have pkg-config files. Exploit this fact to autodetect whether XLSX support may be compiled. --- src/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 512b81c..5e98400 100644 --- a/src/Makefile +++ b/src/Makefile @@ -55,9 +55,10 @@ CFLAGS += -DUSELOCALE #CFLAGS += -DXLS #LDLIBS += -lxlsreader -# Uncomment for basic XLSX support. Requires libzip and libxml2 -#CFLAGS += -DXLSX -I/usr/include/libxml2 -#LDLIBS += -lzip -lxml2 +ifneq ($(shell pkg-config --exists libzip libxml-2.0 || echo 'no'),no) +CFLAGS += -DXLSX $(shell pkg-config --cflags libxml-2.0 libzip) +LDLIBS += $(shell pkg-config --libs libxml-2.0 libzip) +endif OBJS = $(patsubst %.c, %.o, $(wildcard *.c) $(wildcard utils/*.c)) gram.o -- cgit v1.2.3