[poppler] configure.ac goo/Makefile.am m4/libpng.m4 poppler/Makefile.am

Albert Astals Cid aacid at kemper.freedesktop.org
Fri Feb 19 12:19:00 PST 2010


 configure.ac        |   12 ++++--
 goo/Makefile.am     |    7 +++
 m4/libpng.m4        |   99 ----------------------------------------------------
 poppler/Makefile.am |    3 +
 4 files changed, 17 insertions(+), 104 deletions(-)

New commits:
commit f9425c0b5b112ac673d0499f79a743afce719593
Author: Hib Eris <hib at hiberis.nl>
Date:   Fri Feb 19 20:18:13 2010 +0000

    use pkgconfig to detect libpng on autotools too

diff --git a/configure.ac b/configure.ac
index c6520a3..b8fb411 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,16 +228,20 @@ AH_TEMPLATE([ENABLE_LIBJPEG],
 dnl Test for libpng
 AC_ARG_ENABLE(libpng,
 	      AC_HELP_STRING([--disable-libpng],
-	                     [Don't build against libpng.]),
+	                     [Do not build against libpng.]),
               enable_libpng=$enableval,
               enable_libpng="try")
+
 if test x$enable_libpng != xno; then
-  POPPLER_FIND_PNG
+  PKG_CHECK_MODULES(LIBPNG, libpng, [enable_libpng="yes"],
+      [enable_libpng="no"])
+fi
+
+if test x$enable_libpng = xyes; then
+  AC_DEFINE(ENABLE_LIBPNG, 1, [Build against libpng.])
 fi
 
 AM_CONDITIONAL(BUILD_LIBPNG, test x$enable_libpng = xyes)
-AH_TEMPLATE([ENABLE_LIBPNG],
-            [Build against libpng.])
 
 dnl Check for freetype headers
 FREETYPE_LIBS=
diff --git a/goo/Makefile.am b/goo/Makefile.am
index aad1108..39d2683 100644
--- a/goo/Makefile.am
+++ b/goo/Makefile.am
@@ -21,8 +21,13 @@ poppler_goo_include_HEADERS =			\
 
 endif
 
+if BUILD_LIBPNG
+libpng_includes = $(LIBPNG_CFLAGS)
+endif
+
 INCLUDES =					\
-	-I$(top_srcdir)
+	-I$(top_srcdir)				\
+	$(libpng_includes)
 
 libgoo_la_SOURCES =				\
 	gfile.cc				\
diff --git a/m4/libpng.m4 b/m4/libpng.m4
deleted file mode 100644
index 2633c13..0000000
--- a/m4/libpng.m4
+++ /dev/null
@@ -1,99 +0,0 @@
-dnl Based on Xpdf configure.in and evince configure.ac
-dnl Based on kde acinclude.m4.in, LGPL Licensed
-
-AC_DEFUN([AC_FIND_FILE],
-[
-$3=NO
-for i in $2;
-do
-  for j in $1;
-  do
-    echo "configure: __oline__: $i/$j" >&AC_FD_CC
-    if test -r "$i/$j"; then
-      echo "taking that" >&AC_FD_CC
-      $3=$i
-      break 2
-    fi
-  done
-done
-])
-
-AC_DEFUN([FIND_PNG_HELPER],
-[
-AC_MSG_CHECKING([for libpng])
-AC_CACHE_VAL(ac_cv_lib_png,
-[
-ac_save_LIBS="$LIBS"
-LIBS="$all_libraries $USER_LDFLAGS -lpng -lm"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
-AC_TRY_LINK(
-[
-#ifdef __cplusplus
-extern "C" {
-#endif
-void png_access_version_number();
-#ifdef __cplusplus
-}
-#endif
-],
-[png_access_version_number();],
-            eval "ac_cv_lib_png=-lpng",
-            eval "ac_cv_lib_png=no")
-LIBS="$ac_save_LIBS"
-CFLAGS="$ac_save_CFLAGS"
-])
-
-if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
-  enable_libpng=yes
-  LIBPNG_LIBS="$ac_cv_lib_png"
-  AC_MSG_RESULT($ac_cv_lib_png)
-else
-  AC_MSG_RESULT(no)
-  $1
-fi
-])
-
-
-AC_DEFUN([POPPLER_FIND_PNG],
-[
-dnl first look for libraries
-FIND_PNG_HELPER(
-   FIND_PNG_HELPER(normal, [],
-    [
-       LIBPNG_LIBS=
-    ]
-   )
-)
-
-dnl then search the headers (can't use simply AC_TRY_xxx, as png.h
-dnl requires system dependent includes loaded before it)
-png_incdirs="`eval echo $includedir` /usr/include /usr/local/include "
-AC_FIND_FILE(png.h, $png_incdirs, png_incdir)
-test "x$png_incdir" = xNO && png_incdir=
-
-dnl if headers _and_ libraries are missing, this is no error, and we
-dnl continue with a warning (the user will get no png support)
-dnl if only one is missing, it means a configuration error, but we still
-dnl only warn
-if test -n "$png_incdir" && test -n "$LIBPNG_LIBS" ; then
-  AC_DEFINE_UNQUOTED(ENABLE_LIBPNG, 1, [Define if you have libpng])
-else
-  if test -n "$png_incdir" || test -n "$LIBPNG_LIBS" ; then
-    AC_MSG_WARN([
-There is an installation error in png support. You seem to have only one of
-either the headers _or_ the libraries installed. You may need to either provide
-correct --with-extra-... options, or the development package of libpng. You
-can get a source package of libpng from http://www.libpng.org/pub/png/libpng.html
-Disabling PNG support.
-])
-  else
-    AC_MSG_WARN([libpng not found. disable PNG support.])
-  fi
-  png_incdir=
-  enable_libpng=no
-  LIBPNG_LIBS=
-fi
-
-AC_SUBST(LIBPNG_LIBS)
-])
diff --git a/poppler/Makefile.am b/poppler/Makefile.am
index 9654bcb..5f6a94a 100644
--- a/poppler/Makefile.am
+++ b/poppler/Makefile.am
@@ -68,6 +68,8 @@ if BUILD_LIBPNG
 
 libpng_libs =					\
 	$(LIBPNG_LIBS)
+libpng_includes =				\
+	$(LIBPNG_CFLAGS)
 
 endif
 
@@ -127,6 +129,7 @@ INCLUDES =					\
 	$(cairo_includes)			\
 	$(arthur_includes)			\
 	$(abiword_includes)			\
+	$(libpng_includes)			\
 	$(FREETYPE_CFLAGS)			\
 	$(FONTCONFIG_CFLAGS)
 


More information about the poppler mailing list