make libgsf-1 an optional dependency

dzsave vanishes if you don't have it, but you can still build vips
This commit is contained in:
John Cupitt 2014-05-09 13:13:18 +01:00
parent d9affe1c2a
commit f6de1e7cb9
6 changed files with 37 additions and 7 deletions

View File

@ -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()

View File

@ -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

View File

@ -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])

View File

@ -114,11 +114,13 @@
#include <stdlib.h>
#include <string.h>
#include <gsf/gsf.h>
#include <vips/vips.h>
#include <vips/internal.h>
#ifdef HAVE_GSF
#include <gsf/gsf.h>
/* 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 );
}

View File

@ -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();

View File

@ -76,7 +76,9 @@
#include <limits.h>
#include <string.h>
#ifdef HAVE_GSF
#include <gsf/gsf.h>
#endif /*HAVE_GSF*/
#include <vips/vips.h>
#include <vips/thread.h>
@ -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.