changeset 1766:914543dfada1

Autodetect libpng via pkg-config.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 26 Oct 2017 20:33:46 +0300
parents 8ea2a5a09ff9
children aba021739dae
files Makefile Makefile.gen
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Oct 25 18:27:50 2017 +0300
+++ b/Makefile	Thu Oct 26 20:33:46 2017 +0300
@@ -26,8 +26,9 @@
 # For Solaris you may need:
 #CFLAGS += -DHAVE_UINT_T
 
-LIBPNG_CFLAGS += -DHAVE_LIBPNG `pkg-config --cflags libpng`
-LIBPNG_LDFLAGS +=  `pkg-config --libs libpng`
+HAVE_LIBPNG ?= `pkg-config --atleast-version=1.2 libpng && echo "yes"`
+LIBPNG_CFLAGS ?= `pkg-config --cflags libpng`
+LIBPNG_LDFLAGS ?=  `pkg-config --libs libpng`
 
 
 ###
--- a/Makefile.gen	Wed Oct 25 18:27:50 2017 +0300
+++ b/Makefile.gen	Thu Oct 26 20:33:46 2017 +0300
@@ -41,6 +41,10 @@
 	$(MKLOC_BIN) $(COMBINE_BIN) $(MAPSTATS_BIN) \
 	$(addprefix $(MAP_PATH),$(filter %.html,$(MAP_FILES)))
 
+ifeq ($(HAVE_LIBPNG),yes)
+LIBPNG_CFLAGS += -DHAVE_LIBPNG=1
+endif
+
 THLIBS_A = $(OBJPATH)thlibs.a
 THLIBS_OBJ = th_util.o th_string.o th_args.o th_datastruct.o