diff --git a/ChangeLog b/ChangeLog index e0f581c9..947d1abc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,7 +21,7 @@ - vips_system() now supports many input images and you can change image argument order - support 16-bit palette TIFFs, plus palette TIFFs can have an alpha -- libgsf is now required +- libgsf-1 is now an optional dependancy - dzsave can directly write a ZIP file - add ".vips" as an alternative suffix for vips files - added vips_tiffload_buffer() diff --git a/README.md b/README.md index eac78059..2ede97aa 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,10 @@ The IJG JPEG library. If available, libvips adds support for EXIF metadata in JPEG files. +## libgsf-1 + +If available, libvips adds support for creating image pyramids with dzsave. + ## libtiff The TIFF library. It needs to be built with support for JPEG and diff --git a/configure.ac b/configure.ac index 8ae7d2c1..1a3e793e 100644 --- a/configure.ac +++ b/configure.ac @@ -314,8 +314,8 @@ AC_CHECK_LIB(m,hypot,[AC_DEFINE(HAVE_HYPOT,1,[have hypot() in libm.])]) # have to have these # need glib 2.6 for GOption -PKG_CHECK_MODULES(REQUIRED, glib-2.0 >= 2.6 gmodule-2.0 libxml-2.0 gobject-2.0 libgsf-1) -PACKAGES_USED="$PACKAGES_USED glib-2.0 libxml-2.0 gmodule-2.0 gobject-2.0 libgsf-1" +PKG_CHECK_MODULES(REQUIRED, glib-2.0 >= 2.6 gmodule-2.0 libxml-2.0 gobject-2.0) +PACKAGES_USED="$PACKAGES_USED glib-2.0 libxml-2.0 gmodule-2.0 gobject-2.0" # after 2.28 we have a monotonic timer PKG_CHECK_MODULES(MONOTONIC, glib-2.0 >= 2.28,[ @@ -350,6 +350,18 @@ GTK_DOC_CHECK([1.14],[--flavour no-tmpl]) # optional supporting libraries +AC_ARG_WITH([gsf], + AS_HELP_STRING([--without-gsf], [build without libgsf-1 (default: test)])) + +if test x"$with_gsf" != "xno"; then + PKG_CHECK_MODULES(GSF, libgsf-1, + [AC_DEFINE(HAVE_GSF,1,[define if you have libgsf-1 installed.]) + with_gsf=yes + PACKAGES_USED="$PACKAGES_USED libgsf-1"], + [AC_MSG_WARN([libgsf-1 not found; disabling dzsave support]) + with_gsf=no]) +fi + AC_ARG_WITH([fftw], AS_HELP_STRING([--without-fftw], [build without fftw (default: test)])) @@ -770,5 +782,7 @@ file import/export with libpng: $with_png (requires libpng-1.2.9 or later) file import/export with libtiff: $with_tiff file import/export with libjpeg: $with_jpeg +image pyramid export: $with_gsf + (requires libgsf-1) use libexif to load/save JPEG metadata: $with_libexif build Python binding: $with_python]) diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index f590500a..58f24e19 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -114,11 +114,13 @@ #include #include -#include - #include #include +#ifdef HAVE_GSF + +#include + /* Round N down to P boundary. */ #define ROUND_DOWN(N,P) ((N) - ((N) % P)) @@ -129,7 +131,7 @@ /* Simple wrapper around libgsf. * - * We need to be able to do scattered writes to structred files. So while + * We need to be able to do scattered writes to structured files. So while * building a zip (for example) we need to be able to write to file/a/b.jpg, * then to file/c/d.jpg, then back to file/a/e.jpg. This is tricky with the * libgsf API which is happier doing writes in order. @@ -1802,6 +1804,8 @@ vips_foreign_save_dz_init( VipsForeignSaveDz *dz ) dz->container = VIPS_FOREIGN_DZ_CONTAINER_FS; } +#endif /*HAVE_GSF*/ + /** * vips_dzsave: * @in: image to save @@ -1857,4 +1861,3 @@ vips_dzsave( VipsImage *in, const char *name, ... ) return( result ); } - diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index a8b23b7d..e16218a9 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -1702,7 +1702,10 @@ vips_foreign_operation_init( void ) vips_foreign_save_raw_fd_get_type(); vips_foreign_load_vips_get_type(); vips_foreign_save_vips_get_type(); + +#ifdef HAVE_GSF vips_foreign_save_dz_get_type(); +#endif /*HAVE_GSF*/ #ifdef HAVE_PNG vips_foreign_load_png_get_type(); diff --git a/libvips/iofuncs/init.c b/libvips/iofuncs/init.c index 0b5c0ea0..8491706b 100644 --- a/libvips/iofuncs/init.c +++ b/libvips/iofuncs/init.c @@ -76,7 +76,9 @@ #include #include +#ifdef HAVE_GSF #include +#endif /*HAVE_GSF*/ #include #include @@ -307,9 +309,11 @@ vips__init( const char *argv0 ) */ vips_vector_init(); +#ifdef HAVE_GSF /* Use this for structured file write. */ gsf_init(); +#endif /*HAVE_GSF*/ /* Register vips_shutdown(). This may well not get called and many * platforms don't support it anyway. @@ -436,7 +440,9 @@ vips_shutdown( void ) vips__thread_profile_stop(); +#ifdef HAVE_GSF gsf_shutdown(); +#endif /*HAVE_GSF*/ /* In dev releases, always show leaks. But not more than once, it's * annoying.