[Pixman] [PATCH] Use pkg-config to determine the flags to use with libpng

Søren Sandmann sandmann at cs.au.dk
Sun Sep 11 16:49:16 PDT 2011


From: Søren Sandmann Pedersen <ssp at redhat.com>

Previously we would unconditionally link with -lpng leading to build
failures on systems without libpng.
---
 configure.ac     |    2 +-
 test/Makefile.am |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 21613e1..dc523df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -804,7 +804,7 @@ AC_SUBST(TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR)
 dnl ==================
 dnl libpng
 
-AC_CHECK_LIB([png], [png_write_info], [have_libpng=yes], [have_libpng=no])
+PKG_CHECK_MODULES(PNG, [libpng], have_libpng=yes, have_libpng=no)
 
 if test x$have_libpng = xyes; then
     AC_DEFINE([HAVE_LIBPNG], [1], [Whether we have libpng])
diff --git a/test/Makefile.am b/test/Makefile.am
index 52ef8ad..6687bed 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,7 +1,7 @@
 AM_CFLAGS = @OPENMP_CFLAGS@
 AM_LDFLAGS = @OPENMP_CFLAGS@ @TESTPROGS_EXTRA_LDFLAGS@
-LDADD = $(top_builddir)/pixman/libpixman-1.la -lm -lpng
-INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman
+LDADD = $(top_builddir)/pixman/libpixman-1.la -lm  @PNG_LIBS@
+INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman @PNG_CFLAGS@
 
 TESTPROGRAMS =			\
 	a1-trap-test		\
-- 
1.6.0.6



More information about the Pixman mailing list