From 6c0eced22c1ddf387ca87ad5eb9664fee9911331 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 4 Oct 2013 11:54:01 +0100 Subject: [PATCH] build fixes for OS X stupid libjpeg and their stupid bool type argh --- ChangeLog | 3 ++ configure.ac | 6 ++-- libvips/deprecated/im_jpeg2vips.c | 4 +-- libvips/foreign/Makefile.am | 1 + libvips/foreign/jpeg.h | 31 +++++++++-------- libvips/foreign/jpeg2vips.c | 11 +----- libvips/foreign/jpegload.c | 12 +------ libvips/foreign/jpegsave.c | 12 +------ libvips/foreign/vips2jpeg.c | 11 +----- libvips/foreign/vipsjpeg.h | 57 +++++++++++++++++++++++++++++++ 10 files changed, 85 insertions(+), 63 deletions(-) create mode 100644 libvips/foreign/vipsjpeg.h diff --git a/ChangeLog b/ChangeLog index 6a327143..08f36131 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +3/10/13 started 7.36.0 +- fiex to help OS X build + 3/10/13 started 7.36.0 - version bump diff --git a/configure.ac b/configure.ac index 938a622d..b213592a 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # also update the version number in the m4 macros below -AC_INIT([vips], [7.36.0], [vipsip@jiscmail.ac.uk]) +AC_INIT([vips], [7.36.1], [vipsip@jiscmail.ac.uk]) # required for gobject-introspection AC_PREREQ(2.62) @@ -17,7 +17,7 @@ AC_CONFIG_MACRO_DIR([m4]) # user-visible library versioning m4_define([vips_major_version], [7]) m4_define([vips_minor_version], [36]) -m4_define([vips_micro_version], [0]) +m4_define([vips_micro_version], [1]) m4_define([vips_version], [vips_major_version.vips_minor_version.vips_micro_version]) @@ -37,7 +37,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date` # binary interface changes not backwards compatible?: reset age to 0 LIBRARY_CURRENT=35 -LIBRARY_REVISION=0 +LIBRARY_REVISION=1 LIBRARY_AGE=0 # patched into include/vips/version.h diff --git a/libvips/deprecated/im_jpeg2vips.c b/libvips/deprecated/im_jpeg2vips.c index eda579fb..a42392c8 100644 --- a/libvips/deprecated/im_jpeg2vips.c +++ b/libvips/deprecated/im_jpeg2vips.c @@ -49,9 +49,7 @@ #include #ifdef HAVE_JPEG -#include -#include -#include "../foreign/jpeg.h" +#include "../foreign/vipsjpeg.h" #endif /*HAVE_JPEG*/ static int diff --git a/libvips/foreign/Makefile.am b/libvips/foreign/Makefile.am index a027cf84..6b1262e7 100644 --- a/libvips/foreign/Makefile.am +++ b/libvips/foreign/Makefile.am @@ -58,6 +58,7 @@ libforeign_la_SOURCES = \ vips2jpeg.c \ jpeg2vips.c \ jpeg.h \ + vipsjpeg.h \ jpegload.c \ jpegsave.c diff --git a/libvips/foreign/jpeg.h b/libvips/foreign/jpeg.h index e456161e..2b29c5b0 100644 --- a/libvips/foreign/jpeg.h +++ b/libvips/foreign/jpeg.h @@ -35,6 +35,22 @@ extern "C" { #endif /*__cplusplus*/ +/* jpeglib includes jconfig.h, which can define HAVE_STDLIB_H ... which we + * also define. Make sure it's turned off. + */ +#ifdef HAVE_STDLIB_H +#undef HAVE_STDLIB_H +#endif /*HAVE_STDLIB_H*/ + +/* jpeglib defines its own boolean type which then clashes with everyone + * elses. Turn it off and make our own. + */ +#define HAVE_BOOLEAN +typedef int boolean; + +#include +#include + /* Define a new error handler for when we bomb out. */ typedef struct { @@ -48,24 +64,9 @@ typedef struct { FILE *fp; /* fclose() if non-NULL */ } ErrorManager; -extern const char *vips__jpeg_suffs[]; - void vips__new_output_message( j_common_ptr cinfo ); void vips__new_error_exit( j_common_ptr cinfo ); -int vips__jpeg_write_file( VipsImage *in, - const char *filename, int Q, const char *profile, - gboolean optimize_coding ); -int vips__jpeg_write_buffer( VipsImage *in, - void **obuf, size_t *olen, int Q, const char *profile, - gboolean optimize_coding ); - -int vips__isjpeg( const char *filename ); -int vips__jpeg_read_file( const char *name, VipsImage *out, - gboolean header_only, int shrink, gboolean fail, gboolean readbehind ); -int vips__jpeg_read_buffer( void *buf, size_t len, VipsImage *out, - gboolean header_only, int shrink, int fail, gboolean readbehind ); - #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/foreign/jpeg2vips.c b/libvips/foreign/jpeg2vips.c index 50fd43d3..6c214c33 100644 --- a/libvips/foreign/jpeg2vips.c +++ b/libvips/foreign/jpeg2vips.c @@ -119,17 +119,8 @@ #include #include -/* jpeglib includes jconfig.h, which can define HAVE_STDLIB_H ... which we - * also define. Make sure it's turned off. - */ -#ifdef HAVE_STDLIB_H -#undef HAVE_STDLIB_H -#endif /*HAVE_STDLIB_H*/ - -#include -#include - #include "jpeg.h" +#include "vipsjpeg.h" /* Stuff we track during a read. */ diff --git a/libvips/foreign/jpegload.c b/libvips/foreign/jpegload.c index e89d66f3..c24dd690 100644 --- a/libvips/foreign/jpegload.c +++ b/libvips/foreign/jpegload.c @@ -68,17 +68,7 @@ #include #include -/* jpeglib includes jconfig.h, which can define HAVE_STDLIB_H ... which we - * also define. Make sure it's turned off. - */ -#ifdef HAVE_STDLIB_H -#undef HAVE_STDLIB_H -#endif /*HAVE_STDLIB_H*/ - -#include -#include - -#include "jpeg.h" +#include "vipsjpeg.h" typedef struct _VipsForeignLoadJpeg { VipsForeignLoad parent_object; diff --git a/libvips/foreign/jpegsave.c b/libvips/foreign/jpegsave.c index 5af0e4d3..e14c6086 100644 --- a/libvips/foreign/jpegsave.c +++ b/libvips/foreign/jpegsave.c @@ -66,17 +66,7 @@ #include #include -/* jpeglib includes jconfig.h, which can define HAVE_STDLIB_H ... which we - * also define. Make sure it's turned off. - */ -#ifdef HAVE_STDLIB_H -#undef HAVE_STDLIB_H -#endif /*HAVE_STDLIB_H*/ - -#include -#include - -#include "jpeg.h" +#include "vipsjpeg.h" typedef struct _VipsForeignSaveJpeg { VipsForeignSave parent_object; diff --git a/libvips/foreign/vips2jpeg.c b/libvips/foreign/vips2jpeg.c index a3f3e396..104f1079 100644 --- a/libvips/foreign/vips2jpeg.c +++ b/libvips/foreign/vips2jpeg.c @@ -121,17 +121,8 @@ #endif /*UNTAGGED_EXIF*/ #endif /*HAVE_EXIF*/ -/* jpeglib includes jconfig.h, which can define HAVE_STDLIB_H ... which we - * also define. Make sure it's turned off. - */ -#ifdef HAVE_STDLIB_H -#undef HAVE_STDLIB_H -#endif /*HAVE_STDLIB_H*/ - -#include -#include - #include "jpeg.h" +#include "vipsjpeg.h" /* New output message method - send to VIPS. */ diff --git a/libvips/foreign/vipsjpeg.h b/libvips/foreign/vipsjpeg.h new file mode 100644 index 00000000..b4337812 --- /dev/null +++ b/libvips/foreign/vipsjpeg.h @@ -0,0 +1,57 @@ +/* simple interface to our jpg functions + */ + +/* + + Copyright (C) 1991-2005 The National Gallery + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA + + */ + +/* + + These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk + + */ + +#ifndef VIPS_VIPSJPEG_H +#define VIPS_VIPSJPEG_H + +#ifdef __cplusplus +extern "C" { +#endif /*__cplusplus*/ + +extern const char *vips__jpeg_suffs[]; + +int vips__jpeg_write_file( VipsImage *in, + const char *filename, int Q, const char *profile, + gboolean optimize_coding ); +int vips__jpeg_write_buffer( VipsImage *in, + void **obuf, size_t *olen, int Q, const char *profile, + gboolean optimize_coding ); + +int vips__isjpeg( const char *filename ); +int vips__jpeg_read_file( const char *name, VipsImage *out, + gboolean header_only, int shrink, gboolean fail, gboolean readbehind ); +int vips__jpeg_read_buffer( void *buf, size_t len, VipsImage *out, + gboolean header_only, int shrink, int fail, gboolean readbehind ); + +#ifdef __cplusplus +} +#endif /*__cplusplus*/ + +#endif /*VIPS_VIPSJPEG_H*/