[poppler] 5 commits - configure.ac goo/Makefile.am m4/libjpeg.m4 poppler/Makefile.am splash/Makefile.am utils/Makefile.am

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Mar 28 11:26:42 PDT 2012


 configure.ac        |   96 +++++++++++++++++++++++++++++++++++++++++++++++-----
 goo/Makefile.am     |   15 ++++++++
 m4/libjpeg.m4       |    6 +++
 poppler/Makefile.am |    6 +++
 splash/Makefile.am  |   16 ++++++++
 utils/Makefile.am   |    6 +++
 6 files changed, 137 insertions(+), 8 deletions(-)

New commits:
commit 47b910d35b2cf5914ed4c07f751c5e8c304be7fc
Author: suzuki toshiya <mpsuzuki at hiroshima-u.ac.jp>
Date:   Wed Mar 28 20:21:44 2012 +0200

    Add quotes
    
    this is quite small fix. In poppler's configure, basically the shell
    variables are not enclosed, and not quoted, aslike
            if test x$use_glib = x; then
    This syntax make the test command confused when use_glib is multi-word
    value, as, "no (required cairo output)". In such case, test cannot know
    how to evaluate the token "no" "(required" "cairo", so some "syntax error"
    messages are given. Thus, quoting of the variable would be safer.

diff --git a/configure.ac b/configure.ac
index cb7e4b6..3c30ea8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -546,8 +546,8 @@ else
   use_glib="no (requires cairo output)"
   enable_poppler_glib="no"
 fi
-if test x$use_glib = x; then
-   use_glib=$enable_poppler_glib
+if test x"$use_glib" = x; then
+   use_glib="$enable_poppler_glib"
 fi
 AM_CONDITIONAL(BUILD_POPPLER_GLIB, test x$enable_poppler_glib = xyes)
 AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
commit 78224609f6c1d87deee72b60a8f8f9f6c36ac75f
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Mar 28 20:21:11 2012 +0200

    Workaround Windows problem with libjpeg
    
    In libjpeg6b, there is a type definition conflict issue in jmorecfg.h.
    jmorecfg.h typedefs INT16 as short, INT32 as long. The latter conflict
    with basetsd.h of Microsoft Windows SDK or MinGW that typedefs INT32
    as int. basetsd.h is included by windows.h, so, if the users work with
    ANSI C features only, the conflict does not appear, it would be the
    background why such fundamental error has been preserved.
    Anyway, jmorecfg.h designer was aware about the conflict with X11 headers
    (Xmd.h defines INT16, INT32, etc), so if we pretend as if Xmd.h were
    included (by defining XMD_H), this issue can be bypassed. Attached patch
    checks the conflict, then, if there is a conflict, tries XMD_H trick, and
    uses it if it works. If jmorecfg.h or basetsd.h was manually fixed to
    prevent this issue, this trick is not used.

diff --git a/configure.ac b/configure.ac
index e26c09d..cb7e4b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -310,6 +310,7 @@ AC_ARG_ENABLE(libjpeg,
               enable_libjpeg="try")
 AC_ARG_VAR([LIBJPEG_CFLAGS], [C compiler flags for LIBJPEG])
 if test x$enable_libjpeg != xno; then
+
   dnl
   dnl POPPLER_FIND_JPEG uses "USER_INCLUDES" and "USER_LIBS"
   dnl to receive the flags for header and library directories.
@@ -319,6 +320,47 @@ if test x$enable_libjpeg != xno; then
   USER_INCLUDES="$USER_INCLUDES $LIBJPEG_CFLAGS"
   USER_LDFLAGS="$USER_LDFLAGS $LIBJPEG_CFLAGS"
   POPPLER_FIND_JPEG
+
+  dnl check INT16, INT32 typedef conflict in jmorecfg.h
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_CFLAGS="$CFLAGS"
+  CPPFLAGS="$CPPFLAGS $LIBJPEG_CFLAGS"
+  CFLAGS="$CFLAGS $LIBJPEG_CFLAGS"
+  AC_MSG_CHECKING([libjpeg.h works correctly])
+  AC_COMPILE_IFELSE([
+    AC_LANG_PROGRAM([
+#ifdef _WIN32
+#include <windows.h>
+#endif
+#include <sys/types.h>
+#include <stdio.h>
+#include <jpeglib.h>
+],[{return 0;}])],[
+    AC_MSG_RESULT([ok])
+  ],[
+    AC_MSG_RESULT([no])
+    AC_MSG_CHECKING([libjpeg.h problem can be fixed by XMD_H macro])
+    CPPFLAGS="$CPPFLAGS -DXMD_H"
+    CFLAGS="$CFLAGS -DXMD_H"
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([
+#ifdef _WIN32
+#include <windows.h>
+#endif
+#include <sys/types.h>
+#include <stdio.h>
+#include <jpeglib.h>
+],[{return 0;}])],[
+      AC_MSG_RESULT([ok, -DXMD_H is added to LIBJPEG_CFLAGS])
+      LIBJPEG_CFLAGS="$LIBJPEG_CFLAGS -DXMD_H"
+    ],[
+      AC_MSG_RESULT([no, disable libjpeg])
+      enable_libjpeg="no"
+    ])
+  ])
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  CFLAGS="$ac_save_CFLAGS"
+
   dnl POPPLER_FIND_JPEG sets LIBJPEG_LIBS
   AC_SUBST(LIBJPEG_CFLAGS)
   USER_INCLUDES="$ac_save_USER_INCLUDES"
commit d8cf31f8c7e190939525ad68cd4617fb48fea60e
Author: suzuki toshiya <mpsuzuki at hiroshima-u.ac.jp>
Date:   Wed Mar 28 20:20:43 2012 +0200

    update Makefile.am to reflect LIBJPEG_CFLAGS, LIBTIFF_CFLAGS, LIBPNG_CFLAGS for related sources.

diff --git a/goo/Makefile.am b/goo/Makefile.am
index 1921b1e..f4f9730 100644
--- a/goo/Makefile.am
+++ b/goo/Makefile.am
@@ -22,12 +22,27 @@ poppler_goo_include_HEADERS =			\
 
 endif
 
+if BUILD_LIBJPEG
+libjpeg_includes = $(LIBJPEG_CFLAGS)
+endif
+
+if BUILD_LIBTIFF
+libtiff_includes = $(LIBTIFF_CFLAGS)
+endif
+
+if BUILD_LIBOPENJPEG
+libjpeg2000_includes = $(LIBOPENJPEG_CFLAGS)
+endif
+
 if BUILD_LIBPNG
 libpng_includes = $(LIBPNG_CFLAGS)
 endif
 
 INCLUDES =					\
 	-I$(top_srcdir)				\
+	$(libjpeg_includes)                     \
+	$(libtiff_includes)                     \
+	$(libjpeg2000_includes)                 \
 	$(libpng_includes)
 
 libgoo_la_SOURCES =				\
diff --git a/poppler/Makefile.am b/poppler/Makefile.am
index 819938b..86ca4e0 100644
--- a/poppler/Makefile.am
+++ b/poppler/Makefile.am
@@ -61,6 +61,8 @@ libjpeg_sources =				\
 
 libjpeg_libs =					\
 	$(LIBJPEG_LIBS)
+libjpeg_includes =				\
+	$(LIBJPEG_CFLAGS)
 
 endif
 
@@ -90,6 +92,8 @@ libjpeg2000_sources =				\
 
 libjpeg2000_libs =				\
 	$(LIBOPENJPEG_LIBS)
+libjpeg2000_includes =				\
+	$(LIBOPENJPEG_CFLAGS)
 
 else
 
@@ -141,7 +145,9 @@ INCLUDES =					\
 	$(splash_includes)			\
 	$(cairo_includes)			\
 	$(arthur_includes)			\
+	$(libjpeg_includes)			\
 	$(libtiff_includes)			\
+	$(libjpeg2000_includes)			\
 	$(libpng_includes)			\
 	$(libcurl_includes)			\
 	$(FREETYPE_CFLAGS)			\
diff --git a/splash/Makefile.am b/splash/Makefile.am
index 914b308..4330c53 100644
--- a/splash/Makefile.am
+++ b/splash/Makefile.am
@@ -1,8 +1,24 @@
 INCLUDES =					\
 	-I$(top_srcdir)				\
 	-I$(top_srcdir)/goo			\
+	$(libjpeg_includes)			\
+	$(libtiff_includes)			\
+	$(libpng_includes)			\
 	$(FREETYPE_CFLAGS)
 
+# SplashBitmap includes JpegWriter.h, TiffWriter.h, PNGWriter.h
+if BUILD_LIBJPEG
+libjpeg_includes = $(LIBJPEG_CFLAGS)
+endif
+
+if BUILD_LIBTIFF
+libtiff_includes = $(LIBTIFF_CFLAGS)
+endif
+
+if BUILD_LIBPNG
+libpng_includes = $(LIBPNG_CFLAGS)
+endif
+
 noinst_LTLIBRARIES = libsplash.la
 
 if ENABLE_XPDF_HEADERS
diff --git a/utils/Makefile.am b/utils/Makefile.am
index c0105d9..ad845c1 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -117,6 +117,12 @@ pdftohtml_SOURCES =				\
 	HtmlUtils.h				\
 	$(common)
 
+# HtmlOutputDev uses goo/PNGWriter.h that may depend on libpng header
+pdftohtml_CXXFLAGS = $(AM_CXXFLAGS)
+if BUILD_LIBPNG
+pdftohtml_CXXFLAGS += $(LIBPNG_CFLAGS)
+endif
+
 pdfseparate_SOURCES =				\
 	pdfseparate.cc				\
 	$(common)
commit f0c13f5efc641c63627b8f0b0815b6b511d8d196
Author: suzuki toshiya <mpsuzuki at hiroshima-u.ac.jp>
Date:   Wed Mar 28 20:20:06 2012 +0200

    Configure improvements for libs in non default paths
    
    evaluate pkg-config-like environmental variables like LIBJPEG_CFLAGS,
    LIBJPEG_LIBS, LIBTIFF_CFLAGS and LIBTIFF_LIBS in configuration.

diff --git a/configure.ac b/configure.ac
index 539dd17..e26c09d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -193,21 +193,46 @@ AC_ARG_ENABLE(libtiff,
 		enable_libtiff=$enableval,
 		enable_libtiff="try")
 
+AC_ARG_VAR([LIBTIFF_CFLAGS], [C compiler flags for LIBTIFF])
+AC_ARG_VAR([LIBTIFF_LIBS], [linker flags to link LIBTIFF (default is -ltiff)])
+ac_save_CPPFLAGS="$CPPFLAGS"
+ac_save_CXXFLAGS="$CXXFLAGS"
+ac_save_LIBS="$LDFLAGS"
+CPPFLAGS="$CPPFLAGS $LIBTIFF_CFLAGS"
+CXXFLAGS="$CXXFLAGS $LIBTIFF_CFLAGS"
+LIBS="$LIBS $LIBTIFF_LIBS"
 if test x$enable_libtiff = xyes; then
-  AC_CHECK_LIB([tiff], [TIFFOpen],,
-		AC_MSG_ERROR("*** libtiff library not found ***"))
+  if test x"$LIBTIFF_LIBS" != ; then
+    AC_CHECK_FUNC([TIFFOpen],,
+		  AC_MSG_ERROR("*** libtiff library not found ***"))
+  else
+    AC_CHECK_LIB([tiff], [TIFFOpen],,
+		  AC_MSG_ERROR("*** libtiff library not found ***"))
+  fi
   AC_CHECK_HEADERS([tiffio.h],,
 		AC_MSG_ERROR("*** libtiff headers not found ***"))
 elif test x$enable_libtiff = xtry; then
-  AC_CHECK_LIB([tiff], [TIFFOpen],
-		[enable_libtiff="yes"],
-		[enable_libtiff="no"])
+  if test x"$LIBTIFF_LIBS" != x; then
+    AC_CHECK_FUNC([TIFFOpen],
+		  [enable_libtiff="yes"],
+		  [enable_libtiff="no"])
+  else
+    AC_CHECK_LIB([tiff], [TIFFOpen],
+		 [enable_libtiff="yes"],
+		 [enable_libtiff="no"])
+  fi
   AC_CHECK_HEADERS([tiffio.h],,
 		[enable_libtiff="no"])
 fi
+CPPFLAGS="$ac_save_CPPFLAGS"
+CXXFLAGS="$ac_save_CXXFLAGS"
+LIBS="$ac_save_LIBS"
 
 if test x$enable_libtiff = xyes; then
-  LIBTIFF_LIBS="-ltiff"
+  if test x"$LIBTIFF_LIBS" = x; then
+    LIBTIFF_LIBS="-ltiff"
+  fi
+  AC_SUBST(LIBTIFF_CFLAGSS)
   AC_SUBST(LIBTIFF_LIBS)
   AC_DEFINE(ENABLE_LIBTIFF)
 fi
@@ -283,8 +308,21 @@ AC_ARG_ENABLE(libjpeg,
 	                     [Don't build against libjpeg.]),
               enable_libjpeg=$enableval,
               enable_libjpeg="try")
+AC_ARG_VAR([LIBJPEG_CFLAGS], [C compiler flags for LIBJPEG])
 if test x$enable_libjpeg != xno; then
+  dnl
+  dnl POPPLER_FIND_JPEG uses "USER_INCLUDES" and "USER_LIBS"
+  dnl to receive the flags for header and library directories.
+  dnl
+  ac_save_USER_INCLUDES="$USER_INCLUDES"
+  ac_save_USER_LDFLAGS="$USER_LDFLAGS"
+  USER_INCLUDES="$USER_INCLUDES $LIBJPEG_CFLAGS"
+  USER_LDFLAGS="$USER_LDFLAGS $LIBJPEG_CFLAGS"
   POPPLER_FIND_JPEG
+  dnl POPPLER_FIND_JPEG sets LIBJPEG_LIBS
+  AC_SUBST(LIBJPEG_CFLAGS)
+  USER_INCLUDES="$ac_save_USER_INCLUDES"
+  USER_LDFLAGS="$ac_save_USER_LDFLAGS"
 fi
 
 AM_CONDITIONAL(BUILD_LIBJPEG, test x$enable_libjpeg = xyes)
commit e55f485d803cb1f82e0d8a53d1998e1887c7920f
Author: suzuki toshiya <mpsuzuki at hiroshima-u.ac.jp>
Date:   Wed Mar 28 20:19:08 2012 +0200

    Improve m4/libjpeg.m4
    
    m4/libjpeg.m4 uses USER_INCLUDES and USER_LDFLAGS in it, but
    USER_INCLUDES is not reflected when jpeglib.h is searched.
    this patch modifies m4/libjpeg.m4 to reflect USER_INCLUDES
    when jpeglib.h is searched.

diff --git a/m4/libjpeg.m4 b/m4/libjpeg.m4
index 505abc2..d384343 100644
--- a/m4/libjpeg.m4
+++ b/m4/libjpeg.m4
@@ -68,7 +68,13 @@ KDE_FIND_JPEG_HELPER(6b, 6b,
 
 dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h
 dnl requires system dependent includes loaded before it)
+ac_save_CPPFLAGS="$CPPFLAGS"
+ac_save_CFLAGS="$CFLAGS"
+CPPFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
+CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
 AC_CHECK_HEADER([jpeglib.h], [jpeg_incdir=yes], [jpeg_incdir=NO])
+CPPFLAGS="$ac_save_CPPFLAGS"
+CFLAGS="$ac_save_CFLAGS"
 test "x$jpeg_incdir" = xNO && jpeg_incdir=
 
 dnl if headers _and_ libraries are missing, this is no error, and we


More information about the poppler mailing list