[Pixman] [PATCH] Only link with -lpng when libpng is actually available

Andrea Canciani ranma42 at gmail.com
Sun Sep 11 16:15:36 PDT 2011


How about using pkg-config to detect the availability of libpng and
the flags required to use it?

Andrea

On Sun, Sep 11, 2011 at 1:09 PM, Søren Sandmann <sandmann at cs.au.dk> wrote:
> From: Søren Sandmann Pedersen <ssp at redhat.com>
>
> Fixes build on systems that don't have libpng
> ---
>  configure.ac     |    1 +
>  test/Makefile.am |    5 ++++-
>  2 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 21613e1..fdb2521 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -811,6 +811,7 @@ if test x$have_libpng = xyes; then
>  fi
>
>  AC_SUBST(HAVE_LIBPNG)
> +AM_CONDITIONAL(HAVE_LIBPNG, test $have_libpng = yes)
>
>  AC_OUTPUT([pixman-1.pc
>            pixman-1-uninstalled.pc
> diff --git a/test/Makefile.am b/test/Makefile.am
> index 52ef8ad..7bd826e 100644
> --- a/test/Makefile.am
> +++ b/test/Makefile.am
> @@ -1,6 +1,9 @@
>  AM_CFLAGS = @OPENMP_CFLAGS@
>  AM_LDFLAGS = @OPENMP_CFLAGS@ @TESTPROGS_EXTRA_LDFLAGS@
> -LDADD = $(top_builddir)/pixman/libpixman-1.la -lm -lpng
> +LDADD = $(top_builddir)/pixman/libpixman-1.la -lm
> +if HAVE_LIBPNG
> +LDADD += -lpng
> +endif
>  INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman
>
>  TESTPROGRAMS =                 \
> --
> 1.6.0.6
>
> _______________________________________________
> Pixman mailing list
> Pixman at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pixman
>


More information about the Pixman mailing list