Use pkg-config to determine the flags to use with libpng
authorSøren Sandmann Pedersen <ssp@redhat.com>
Sun, 11 Sep 2011 23:44:06 +0000 (19:44 -0400)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Tue, 13 Sep 2011 02:39:53 +0000 (22:39 -0400)
Previously we would unconditionally link with -lpng leading to build
failures on systems without libpng.

configure.ac
test/Makefile.am

index 21613e1..dc523df 100644 (file)
@@ -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])
index 52ef8ad..6687bed 100644 (file)
@@ -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            \