start adding pdfium tests
though they fail with link problems
This commit is contained in:
parent
1b78f3044d
commit
9c2ae52820
16
configure.ac
16
configure.ac
@ -751,6 +751,21 @@ if test x"$with_OpenEXR" != "xno"; then
|
||||
)
|
||||
fi
|
||||
|
||||
# pdfium
|
||||
AC_ARG_WITH([pdfium],
|
||||
AS_HELP_STRING([--without-pdfium], [build without pdfium (default: test)]))
|
||||
|
||||
if test x"$with_pdfium" != x"no"; then
|
||||
FIND_PDFIUM([
|
||||
AC_MSG_WARN([PDFium found, disabling poppler])
|
||||
with_pdfium=yes
|
||||
with_poppler=no
|
||||
],[
|
||||
AC_MSG_WARN([PDFium not found])
|
||||
with_pdfium=no
|
||||
])
|
||||
fi
|
||||
|
||||
# poppler
|
||||
AC_ARG_WITH([poppler],
|
||||
AS_HELP_STRING([--without-poppler], [build without poppler (default: test)]))
|
||||
@ -1253,6 +1268,7 @@ file import with OpenEXR: $with_OpenEXR
|
||||
file import with OpenSlide: $with_openslide
|
||||
(requires openslide-3.3.0 or later)
|
||||
file import with matio: $with_matio
|
||||
PDF import with PDFium $with_pdfium
|
||||
PDF import with poppler-glib: $with_poppler
|
||||
(requires poppler-glib 0.16.0 or later)
|
||||
SVG import with librsvg-2.0: $with_rsvg
|
||||
|
@ -69,12 +69,12 @@
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif /*HAVE_SYS_FILE_H*/
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif /*HAVE_UNISTD_H*/
|
||||
@ -190,6 +190,15 @@ vips__open_image_write( const char *filename, gboolean temp )
|
||||
flags |= _O_TEMPORARY;
|
||||
#endif /*_O_TEMPORARY*/
|
||||
|
||||
#ifdef O_TMPFILE
|
||||
/* Added in linux 3.11, but still not available in most glibc. We
|
||||
* unlink the file ourselves anyway, so it doesn't matter if this
|
||||
* fails.
|
||||
*/
|
||||
if( temp )
|
||||
flags |= O_TMPFILE;
|
||||
#endif /*O_TMPFILE*/
|
||||
|
||||
if( (fd = vips_tracked_open( filename, flags, 0666 )) < 0 ) {
|
||||
vips_error_system( errno, "VipsImage",
|
||||
_( "unable to write to \"%s\"" ),
|
||||
|
127
m4/pdfium.m4
Normal file
127
m4/pdfium.m4
Normal file
@ -0,0 +1,127 @@
|
||||
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
|
||||
dnl
|
||||
dnl FIND_PDFIUM[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
|
||||
dnl ---------------------------------------------------
|
||||
dnl
|
||||
dnl Find pdfium libraries and headers
|
||||
dnl
|
||||
dnl Put -I stuff in PDFIUM_INCLUDES
|
||||
dnl Put PDFium objects in PDFIUM_LIBS (add this to link line untouched!)
|
||||
dnl Define HAVE_PDFIUM if found
|
||||
dnl
|
||||
AC_DEFUN([FIND_PDFIUM], [
|
||||
AC_REQUIRE([AC_PATH_XTRA])
|
||||
|
||||
ZLIB_INCLUDES=""
|
||||
ZLIB_LIBS=""
|
||||
|
||||
AC_ARG_WITH(pdfium,
|
||||
AS_HELP_STRING([--without-pdfium], [build without pdfium (default: test)]))
|
||||
# Treat --without-pdfium like --without-pdfium-includes
|
||||
# --without-pdfium-libraries
|
||||
if test "$with_pdfium" = "no"; then
|
||||
PDFIUM_INCLUDES=no
|
||||
PDFIUM_LIBS=no
|
||||
fi
|
||||
|
||||
# pdfium has a huge set of libraries, including its own jpeg ... we can't use
|
||||
# -L/-l as usual, since the libjpeg.a here will break our -ljpeg later.
|
||||
# Instead, just add these .a files plus their path to the list of objects to
|
||||
# link.
|
||||
pdfium_objects="libbigint.a libchrome_zlib.a libfdrm.a libformfiller.a \
|
||||
libfpdfapi.a libfpdfdoc.a libfpdftext.a libfx_agg.a libfxcodec.a \
|
||||
libfxcrt.a libfx_freetype.a libfxge.a libfxjs.a libfx_lcms2.a \
|
||||
libfx_libopenjpeg.a libfx_lpng.a libgmock_main.a libimage_diff.a \
|
||||
libjpeg.a libminizip.a libpdfium.a libpwl.a libsimd.a \
|
||||
libsimd_asm.a libyasm_utils.a libzlib_x86_simd.a"
|
||||
|
||||
AC_ARG_WITH(pdfium-includes,
|
||||
AS_HELP_STRING([--with-pdfium-includes=DIR], [pdfium includes are in DIR]),
|
||||
PDFIUM_INCLUDES="-I$withval")
|
||||
AC_ARG_WITH(pdfium-libraries,
|
||||
AS_HELP_STRING([--with-pdfium-libraries=DIR], [pdfium libraries are in DIR]),
|
||||
PDFIUM_LIBS="$withval")
|
||||
|
||||
AC_MSG_CHECKING(for PDFIUM)
|
||||
|
||||
# Look for fpdfview.h ... this is a documented header, so it should be a good
|
||||
# target ... it won't be in the standard search path, but try $PREFIX
|
||||
if test "$PDFIUM_INCLUDES" = ""; then
|
||||
pdfium_save_CPPFLAGS="$CPPFLAGS"
|
||||
|
||||
CPPFLAGS="-I${prefix}/include $CPPFLAGS"
|
||||
|
||||
AC_TRY_COMPILE([#include <fpdfview.h>],[int a;],[
|
||||
PDFIUM_INCLUDES="-I${prefix}/include"
|
||||
], [
|
||||
PDFIUM_INCLUDES="no"
|
||||
])
|
||||
|
||||
CPPFLAGS="$pdfium_save_CPPFLAGS"
|
||||
fi
|
||||
|
||||
# Now for the libraries ... if there's nothing set, try $PREFIX/lib
|
||||
if test "$PDFIUM_LIBS" = ""; then
|
||||
pdfium_save_LIBS="$LIBS"
|
||||
pdfium_save_CPPFLAGS="$CPPFLAGS"
|
||||
|
||||
for i in $pdfium_objects; do
|
||||
LIBS="$prefix/lib/$i $LIBS"
|
||||
done
|
||||
CPPFLAGS="$PDFIUM_INCLUDES $CPPFLAGS"
|
||||
|
||||
AC_TRY_LINK([#include <fpdfview.h>],
|
||||
[FPDF_DOCUMENT doc; doc = FPDF_LoadDocument("", "")], [
|
||||
echo link success
|
||||
PDFIUM_LIBS="${prefix}/lib"
|
||||
], [
|
||||
echo link fail
|
||||
PDFIUM_LIBS=no
|
||||
])
|
||||
|
||||
LIBS="$pdfium_save_LIBS"
|
||||
CPPFLAGS="$pdfium_save_CPPFLAGS"
|
||||
fi
|
||||
|
||||
# Print a helpful message
|
||||
pdfium_libraries_result="$PDFIUM_LIBS"
|
||||
pdfium_includes_result="$PDFIUM_INCLUDES"
|
||||
|
||||
if test x"$pdfium_libraries_result" = x""; then
|
||||
pdfium_libraries_result="in default path"
|
||||
fi
|
||||
if test x"$pdfium_includes_result" = x""; then
|
||||
pdfium_includes_result="in default path"
|
||||
fi
|
||||
|
||||
if test "$pdfium_libraries_result" = "no"; then
|
||||
pdfium_libraries_result="(none)"
|
||||
fi
|
||||
if test "$pdfium_includes_result" = "no"; then
|
||||
pdfium_includes_result="(none)"
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([libraries $pdfium_libraries_result, headers $pdfium_includes_result])
|
||||
|
||||
if test x"$PDFIUM_LIBS" != x"no"; then
|
||||
dir="$PDFIUM_LIBS"
|
||||
PDFIUM_LIBS=""
|
||||
for i in $pdfium_objects; do
|
||||
PDFIUM_LIBS="$PDFIUM_LIBS $dir/$i"
|
||||
done
|
||||
fi
|
||||
|
||||
AC_SUBST(PDFIUM_LIBS)
|
||||
AC_SUBST(PDFIUM_INCLUDES)
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test "$PDFIUM_INCLUDES" != "no" && test "$PDFIUM_LIBS" != "no"; then
|
||||
AC_DEFINE(HAVE_PDFIUM,1,[Define if you have pdfium libraries and header files.])
|
||||
$1
|
||||
else
|
||||
PDFIUM_INCLUDES=""
|
||||
PDFIUM_LIBS=""
|
||||
$2
|
||||
fi
|
||||
|
||||
])dnl
|
Loading…
Reference in New Issue
Block a user