Merge branch '8.11'
This commit is contained in:
commit
706c2a112d
@ -1,6 +1,12 @@
|
||||
14/6/21 started 8.12
|
||||
- all tools support `--version`
|
||||
|
||||
14/8/20 started 8.11.1
|
||||
- add more example code to C docs
|
||||
- update libtool support in configure.ac
|
||||
- more startup info if VIPS_INFO is set
|
||||
- command-line programs set glib prgname (no longer set for you by VIPS_INIT)
|
||||
|
||||
14/8/20 started 8.11
|
||||
- add vips_jpegload_source() and vips_svgload_source() to public C API
|
||||
- integrate doxygen in build system to generate C++ API docs
|
||||
|
71
configure.ac
71
configure.ac
@ -4,7 +4,7 @@
|
||||
|
||||
AC_INIT([vips], [8.12.0], [vipsip@jiscmail.ac.uk])
|
||||
# required for gobject-introspection
|
||||
AC_PREREQ(2.62)
|
||||
AC_PREREQ([2.69])
|
||||
|
||||
# gobject-introspection recommends -Wno-portability
|
||||
# foreign stops complaints about a missing README (we use README.md instead)
|
||||
@ -117,8 +117,7 @@ AC_DEFINE_UNQUOTED(G_LOG_DOMAIN, "VIPS", [Domain for glib logging messages.])
|
||||
|
||||
m4_define([debug_default], [no])
|
||||
AC_ARG_ENABLE(debug,
|
||||
AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
|
||||
[turn on debugging @<:@default=debug_default()@:>@]),,
|
||||
AS_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],[turn on debugging @<:@default=debug_default()@:>@]),,
|
||||
enable_debug=debug_default())
|
||||
|
||||
if test x"$enable_debug" = x"yes"; then
|
||||
@ -180,8 +179,8 @@ AC_DEFINE_UNQUOTED(VIPS_ICC_DIR,"$profile_dir",[default directory for ICC profil
|
||||
# we want largefile support, if possible
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
# we use libtool
|
||||
LT_INIT
|
||||
# we use libtool and can generate DLLs cleanly on win32 if necessary
|
||||
LT_INIT([win32-dll])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_AWK
|
||||
@ -285,21 +284,6 @@ AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([errno.h math.h fcntl.h limits.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/time.h sys/mman.h sys/types.h sys/stat.h unistd.h io.h direct.h windows.h])
|
||||
|
||||
# uncomment to change which libs we build
|
||||
# AC_DISABLE_SHARED
|
||||
# AC_DISABLE_STATIC
|
||||
AC_LIBTOOL_WIN32_DLL
|
||||
AC_CHECK_TOOL(DLLWRAP, dllwrap)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump)
|
||||
AC_CHECK_TOOL(RANLIB, ranlib)
|
||||
AC_CHECK_TOOL(STRIP, strip)
|
||||
AC_CHECK_TOOL(AR, ar)
|
||||
AC_CHECK_TOOL(AS, as)
|
||||
AC_CHECK_TOOL(LD, ld)
|
||||
AC_PROVIDE([AC_LIBTOOL_WIN32_DLL])
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_RESTRICT
|
||||
AX_GCC_VAR_ATTRIBUTE(vector_size)
|
||||
@ -322,14 +306,14 @@ fi
|
||||
if test x"$ax_cv_have_var_attribute_vector_size" = x"yes"; then
|
||||
AC_MSG_CHECKING([for C++ vector shuffle])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_TRY_COMPILE([
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
typedef float v4f __attribute__((vector_size(4 * sizeof(float)),aligned(16)));
|
||||
],[
|
||||
]], [[
|
||||
v4f f; f[3] = 99;
|
||||
],[
|
||||
]])],[
|
||||
AC_MSG_RESULT([yes])
|
||||
have_vector_shuffle=yes
|
||||
], [
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
have_vector_shuffle=no
|
||||
])
|
||||
@ -345,15 +329,15 @@ fi
|
||||
if test x"$have_vector_shuffle" = x"yes"; then
|
||||
AC_MSG_CHECKING([for C++ vector arithmetic])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_TRY_COMPILE([
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
typedef float v4f __attribute__((vector_size(4 * sizeof(float)),aligned(16)));
|
||||
],[
|
||||
]], [[
|
||||
v4f f = {1, 2, 3, 4}; f *= 12.0;
|
||||
v4f g = {5, 6, 7, 8}; f = g > 0 ? g : -1 * g;
|
||||
],[
|
||||
]])],[
|
||||
AC_MSG_RESULT([yes])
|
||||
have_vector_arith=yes
|
||||
], [
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
have_vector_arith=no
|
||||
])
|
||||
@ -365,7 +349,7 @@ fi
|
||||
if test x"$have_vector_arith" = x"yes"; then
|
||||
AC_MSG_CHECKING([for C++ signed constants in vector templates])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_TRY_COMPILE([
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
typedef float v4f __attribute__((vector_size(4 * sizeof(float)),aligned(16)));
|
||||
template <typename T>
|
||||
static void
|
||||
@ -374,10 +358,10 @@ if test x"$have_vector_arith" = x"yes"; then
|
||||
v4f f;
|
||||
f = -1 * B;
|
||||
}
|
||||
],[
|
||||
],[
|
||||
]], [[
|
||||
]])],[
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
have_vector_arith=no
|
||||
])
|
||||
@ -1429,32 +1413,29 @@ fi
|
||||
VIPS_CFLAGS="$VIPS_CFLAGS $VIPS_DEBUG_FLAGS $REQUIRED_CFLAGS"
|
||||
VIPS_LIBS="$VIPS_LIBS $REQUIRED_LIBS -lm"
|
||||
|
||||
# autoconf hates multi-line AC_SUBST so we have to have another copy of this
|
||||
# thing
|
||||
# build options relevant at runtime ... this becomes `vips --vips-config`
|
||||
# output
|
||||
VIPS_CONFIG="\
|
||||
enable debug: $enable_debug, \
|
||||
enable deprecated library components: $enable_deprecated, \
|
||||
enable modules: $gmodule_supported_flag, \
|
||||
enable docs with gtkdoc: $enable_gtk_doc, \
|
||||
gobject introspection: $found_introspection, \
|
||||
RAD load/save: $with_radiance, \
|
||||
Analyze7 load/save: $with_analyze, \
|
||||
PPM load/save: $with_ppm, \
|
||||
GIF load: $with_nsgif, \
|
||||
generate C++ docs: $with_doxygen, \
|
||||
use fftw3 for FFT: $with_fftw, \
|
||||
accelerate loops with orc: $with_orc, \
|
||||
ICC profile support with lcms: $with_lcms, \
|
||||
zlib: $with_zlib, \
|
||||
text rendering with pangocairo: $with_pangocairo, \
|
||||
font file support with fontconfig: $with_fontconfig, \
|
||||
RAD load/save: $with_radiance, \
|
||||
Analyze7 load/save: $with_analyze, \
|
||||
PPM load/save: $with_ppm, \
|
||||
GIF load: $with_nsgif, \
|
||||
EXIF metadata support with libexif: $with_libexif, \
|
||||
JPEG load/save with libjpeg: $with_jpeg, \
|
||||
JXL load/save with libjxl: $with_libjxl (dynamic module: $with_libjxl_module), \
|
||||
JPEG2000 load/save with libopenjp2: $with_libopenjp2, \
|
||||
PNG load with libspng: $with_libspng, \
|
||||
PNG load/save with libpng: $with_png, \
|
||||
8bpp PNG quantisation: $with_imagequant, \
|
||||
PNG quantisation to 8 bit: $with_imagequant, \
|
||||
TIFF load/save with libtiff: $with_tiff, \
|
||||
image pyramid save: $with_gsf, \
|
||||
HEIC/AVIF load/save with libheif: $with_heif (dynamic module: $with_heif_module), \
|
||||
@ -1463,7 +1444,7 @@ PDF load with PDFium: $with_pdfium, \
|
||||
PDF load with poppler-glib: $with_poppler (dynamic module: $with_poppler_module), \
|
||||
SVG load with librsvg-2.0: $with_rsvg, \
|
||||
EXR load with OpenEXR: $with_OpenEXR, \
|
||||
slide load with OpenSlide: $with_openslide (dynamic module: $with_openslide_module), \
|
||||
OpenSlide load: $with_openslide (dynamic module: $with_openslide_module), \
|
||||
Matlab load with matio: $with_matio, \
|
||||
NIfTI load/save with niftiio: $with_nifti, \
|
||||
FITS load/save with cfitsio: $with_cfitsio, \
|
||||
@ -1568,7 +1549,7 @@ PNG load with libspng: $with_libspng
|
||||
(requires libspng-0.6 or later)
|
||||
PNG load/save with libpng: $with_png
|
||||
(requires libpng-1.2.9 or later)
|
||||
8bpp PNG quantisation: $with_imagequant
|
||||
PNG quantisation to 8 bit: $with_imagequant
|
||||
(requires libimagequant)
|
||||
TIFF load/save with libtiff: $with_tiff
|
||||
image pyramid save: $with_gsf
|
||||
@ -1582,7 +1563,7 @@ PDF load with poppler-glib: $with_poppler (dynamic module: $with_pop
|
||||
SVG load with librsvg-2.0: $with_rsvg
|
||||
(requires librsvg-2.0 2.34.0 or later)
|
||||
EXR load with OpenEXR: $with_OpenEXR
|
||||
slide load with OpenSlide: $with_openslide (dynamic module: $with_openslide_module)
|
||||
OpenSlide support: $with_openslide (dynamic module: $with_openslide_module)
|
||||
(requires openslide-3.3.0 or later)
|
||||
Matlab load with matio: $with_matio
|
||||
NIfTI load/save with niftiio: $with_nifti
|
||||
|
123
doc/using-C.xml
123
doc/using-C.xml
@ -76,9 +76,12 @@
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See #VipsOperation for more detail on VIPS
|
||||
reference counting conventions.
|
||||
See #VipsOperation for more detail on VIPS
|
||||
reference counting conventions. See the <link
|
||||
linkend="reference-pools-ref">Reference pools</link>
|
||||
section below for a way to automate reference counting in C.
|
||||
</para>
|
||||
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="using-C-operations">
|
||||
@ -133,21 +136,21 @@ where:
|
||||
in - Input image, input VipsImage
|
||||
out - Output image, output VipsImage
|
||||
x - Left edge of input in output, input gint
|
||||
default: 0
|
||||
min: -1000000000, max: 1000000000
|
||||
default: 0
|
||||
min: -1000000000, max: 1000000000
|
||||
y - Top edge of input in output, input gint
|
||||
default: 0
|
||||
min: -1000000000, max: 1000000000
|
||||
default: 0
|
||||
min: -1000000000, max: 1000000000
|
||||
width - Image width in pixels, input gint
|
||||
default: 1
|
||||
min: 1, max: 1000000000
|
||||
default: 1
|
||||
min: 1, max: 1000000000
|
||||
height - Image height in pixels, input gint
|
||||
default: 1
|
||||
min: 1, max: 1000000000
|
||||
default: 1
|
||||
min: 1, max: 1000000000
|
||||
optional arguments:
|
||||
extend - How to generate the extra pixels, input VipsExtend
|
||||
default: black
|
||||
allowed: black, copy, repeat, mirror, white, background
|
||||
default: black
|
||||
allowed: black, copy, repeat, mirror, white, background
|
||||
background - Colour for background pixels, input VipsArrayDouble
|
||||
operation flags: sequential-unbuffered
|
||||
</programlisting>
|
||||
@ -260,6 +263,102 @@ main( int argc, char **argv )
|
||||
return( 0 );
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
</refsect3>
|
||||
|
||||
<refsect3 id="reference-pools-ref">
|
||||
<title>Reference pools</title>
|
||||
<para>
|
||||
libvips has a simple system to automate at least some reference counting
|
||||
issues. Reference pools are arrays of object pointers which will be
|
||||
released automatically when some other object is finalized.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The code below crops a many-page image (perhaps a GIF or PDF). It
|
||||
splits the image into separate pages, crops each page, reassembles the
|
||||
cropped areas, and saves again. It creates a <code>context</code>
|
||||
object representing the state of processing, and
|
||||
<code>crop_animation</code> allocates two reference pools off that using
|
||||
<code>vips_object_local_array</code>, one to hold the cropped frames,
|
||||
and one to assemble and copy the result.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
All unreffing is handled by <code>main</code>, and it doesn't need to
|
||||
know anything about <code>crop_animation</code>.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Reference pool example</title>
|
||||
<programlisting language="C">
|
||||
#include <vips/vips.h>
|
||||
|
||||
static int
|
||||
crop_animation( VipsObject *context, VipsImage *image, VipsImage **out,
|
||||
int left, int top, int width, int height )
|
||||
{
|
||||
int page_height = vips_image_get_page_height( image );
|
||||
int n_pages = image->Ysize / page_height;
|
||||
VipsImage **page = (VipsImage **) vips_object_local_array( context, n_pages );
|
||||
VipsImage **copy = (VipsImage **) vips_object_local_array( context, 1 );
|
||||
|
||||
int i;
|
||||
|
||||
/* Split the image into cropped frames.
|
||||
*/
|
||||
for( i = 0; i < n_pages; i++ )
|
||||
if( vips_crop( image, &page[i],
|
||||
left, page_height * i + top, width, height, NULL ) )
|
||||
return( -1 );
|
||||
|
||||
/* Reassemble the frames and set the page height. You must copy before
|
||||
* modifying metadata.
|
||||
*/
|
||||
if( vips_arrayjoin( page, &copy[0], n_pages, "across", 1, NULL ) ||
|
||||
vips_copy( copy[0], out, NULL ) )
|
||||
return( -1 );
|
||||
vips_image_set_int( *out, "page-height", height );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
VipsImage *image;
|
||||
VipsObject *context;
|
||||
VipsImage *x;
|
||||
|
||||
if( VIPS_INIT( NULL ) )
|
||||
vips_error_exit( NULL );
|
||||
|
||||
if( !(image = vips_image_new_from_file( argv[1],
|
||||
"access", VIPS_ACCESS_SEQUENTIAL,
|
||||
NULL )) )
|
||||
vips_error_exit( NULL );
|
||||
|
||||
context = VIPS_OBJECT( vips_image_new() );
|
||||
if( crop_animation( context, image, &x, 10, 10, 500, 500 ) ) {
|
||||
g_object_unref( image );
|
||||
g_object_unref( context );
|
||||
vips_error_exit( NULL );
|
||||
}
|
||||
g_object_unref( image );
|
||||
g_object_unref( context );
|
||||
image = x;
|
||||
|
||||
if( vips_image_write_to_file( image, argv[2], NULL ) ) {
|
||||
g_object_unref( image );
|
||||
vips_error_exit( NULL );
|
||||
}
|
||||
|
||||
g_object_unref( image );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
</refsect3>
|
||||
|
@ -182,17 +182,15 @@ static void
|
||||
vips_foreign_save_jp2k_warning_callback( const char *msg, void *client )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
g_warning( "jp2ksave: %s", class->nickname, msg );
|
||||
g_warning( "jp2ksave: %s", msg );
|
||||
#endif /*DEBUG*/
|
||||
}
|
||||
|
||||
/* The openjpeg info and warning callbacks are incredibly chatty.
|
||||
*/
|
||||
static void
|
||||
vips_foreign_save_jp2k_info_callback( const char *msg, void *client )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
g_info( "jp2ksave: %s", class->nickname, msg );
|
||||
g_info( "jp2ksave: %s", msg );
|
||||
#endif /*DEBUG*/
|
||||
}
|
||||
|
||||
|
@ -274,9 +274,7 @@ vips_load_plugins( const char *fmt, ... )
|
||||
(void) vips_vsnprintf( dir_name, VIPS_PATH_MAX - 1, fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "vips_load_plugins: searching \"%s\"\n", dir_name );
|
||||
#endif /*DEBUG*/
|
||||
g_info( "searching \"%s\"", dir_name );
|
||||
|
||||
if( !(dir = g_dir_open( dir_name, 0, NULL )) )
|
||||
/* Silent success for dir not there.
|
||||
@ -296,9 +294,7 @@ vips_load_plugins( const char *fmt, ... )
|
||||
vips_snprintf( path, VIPS_PATH_MAX - 1,
|
||||
"%s" G_DIR_SEPARATOR_S "%s", dir_name, name );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "vips_load_plugins: loading \"%s\"\n", path );
|
||||
#endif /*DEBUG*/
|
||||
g_info( "loading \"%s\"", path );
|
||||
|
||||
module = g_module_open( path, G_MODULE_BIND_LAZY );
|
||||
if( !module ) {
|
||||
@ -419,6 +415,24 @@ vips_init( const char *argv0 )
|
||||
return( 0 );
|
||||
started = TRUE;
|
||||
|
||||
if( g_getenv( "VIPS_INFO" )
|
||||
#if ENABLE_DEPRECATED
|
||||
|| g_getenv( "IM_INFO" )
|
||||
#endif
|
||||
)
|
||||
vips_verbose();
|
||||
if( g_getenv( "VIPS_PROFILE" ) )
|
||||
vips_profile_set( TRUE );
|
||||
if( g_getenv( "VIPS_LEAK" ) )
|
||||
vips_leak_set( TRUE );
|
||||
if( g_getenv( "VIPS_TRACE" ) )
|
||||
vips_cache_set_trace( TRUE );
|
||||
if( g_getenv( "VIPS_PIPE_READ_LIMIT" ) )
|
||||
vips_pipe_read_limit =
|
||||
g_ascii_strtoll( g_getenv( "VIPS_PIPE_READ_LIMIT" ),
|
||||
NULL, 10 );
|
||||
vips_pipe_read_limit_set( vips_pipe_read_limit );
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
/* Windows has a limit of 512 files open at once for the fopen() family
|
||||
* of functions, and 2048 for the _open() family. This raises the limit
|
||||
@ -461,10 +475,17 @@ vips_init( const char *argv0 )
|
||||
|
||||
/* Try to discover our prefix.
|
||||
*/
|
||||
if( (prefix = g_getenv( "VIPSHOME" )) )
|
||||
g_info( "VIPSHOME = %s", prefix );
|
||||
if( !(prefix = vips_guess_prefix( argv0, "VIPSHOME" )) ||
|
||||
!(libdir = vips_guess_libdir( argv0, "VIPSHOME" )) )
|
||||
return( -1 );
|
||||
|
||||
g_info( "VIPS_PREFIX = %s", VIPS_PREFIX );
|
||||
g_info( "VIPS_LIBDIR = %s", VIPS_LIBDIR );
|
||||
g_info( "prefix = %s", prefix );
|
||||
g_info( "libdir = %s", libdir );
|
||||
|
||||
/* Get i18n .mo files from $VIPSHOME/share/locale/.
|
||||
*/
|
||||
locale = g_build_filename( prefix, "share", "locale", NULL );
|
||||
@ -472,24 +493,6 @@ vips_init( const char *argv0 )
|
||||
g_free( locale );
|
||||
bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" );
|
||||
|
||||
if( g_getenv( "VIPS_INFO" )
|
||||
#if ENABLE_DEPRECATED
|
||||
|| g_getenv( "IM_INFO" )
|
||||
#endif
|
||||
)
|
||||
vips_verbose();
|
||||
if( g_getenv( "VIPS_PROFILE" ) )
|
||||
vips_profile_set( TRUE );
|
||||
if( g_getenv( "VIPS_LEAK" ) )
|
||||
vips_leak_set( TRUE );
|
||||
if( g_getenv( "VIPS_TRACE" ) )
|
||||
vips_cache_set_trace( TRUE );
|
||||
if( g_getenv( "VIPS_PIPE_READ_LIMIT" ) )
|
||||
vips_pipe_read_limit =
|
||||
g_ascii_strtoll( g_getenv( "VIPS_PIPE_READ_LIMIT" ),
|
||||
NULL, 10 );
|
||||
vips_pipe_read_limit_set( vips_pipe_read_limit );
|
||||
|
||||
/* Register base vips types.
|
||||
*/
|
||||
(void) vips_image_get_type();
|
||||
@ -952,10 +955,7 @@ extract_prefix( const char *dir, const char *name )
|
||||
char vname[VIPS_PATH_MAX];
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "extract_prefix: trying for dir = \"%s\", name = \"%s\"\n",
|
||||
dir, name );
|
||||
#endif /*DEBUG*/
|
||||
g_info( "trying for dir = \"%s\", name = \"%s\"", dir, name );
|
||||
|
||||
/* Is dir relative? Prefix with cwd.
|
||||
*/
|
||||
@ -991,9 +991,7 @@ extract_prefix( const char *dir, const char *name )
|
||||
if( vips_ispostfix( vname, G_DIR_SEPARATOR_S ) )
|
||||
vname[strlen( vname ) - 1] = '\0';
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "extract_prefix: canonicalised path = \"%s\"\n", vname );
|
||||
#endif /*DEBUG*/
|
||||
g_info( "canonicalised path = \"%s\"", vname );
|
||||
|
||||
/* Ought to be a "/bin" at the end now.
|
||||
*/
|
||||
@ -1001,9 +999,7 @@ extract_prefix( const char *dir, const char *name )
|
||||
return( NULL );
|
||||
vname[strlen( vname ) - strlen( G_DIR_SEPARATOR_S "bin" )] = '\0';
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "extract_prefix: found \"%s\"\n", vname );
|
||||
#endif /*DEBUG*/
|
||||
g_info( "found \"%s\"", vname );
|
||||
|
||||
return( vips_strdup( NULL, vname ) );
|
||||
}
|
||||
@ -1025,10 +1021,8 @@ scan_path( char *path, const char *name )
|
||||
vips_snprintf( str, VIPS_PATH_MAX,
|
||||
"%s" G_DIR_SEPARATOR_S "%s", p, name );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "scan_path: looking in \"%s\" for \"%s\"\n",
|
||||
g_info( "looking in \"%s\" for \"%s\"",
|
||||
p, name );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
if( vips_existsf( "%s", str ) &&
|
||||
(prefix = extract_prefix( str, name )) ) {
|
||||
@ -1051,9 +1045,7 @@ find_file( const char *name )
|
||||
if( !path )
|
||||
return( NULL );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "vips_guess_prefix: g_getenv( \"PATH\" ) == \"%s\"\n", path );
|
||||
#endif /*DEBUG*/
|
||||
g_info( "g_getenv( \"PATH\" ) == \"%s\"", path );
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
{
|
||||
@ -1083,6 +1075,17 @@ guess_prefix( const char *argv0, const char *name )
|
||||
{
|
||||
char *prefix;
|
||||
|
||||
/* We've already checked for VIPSHOME. If the configure-time
|
||||
* library prefix looks OK, use the configure-time prefix.
|
||||
*/
|
||||
if( vips_existsf( "%s/vips-modules-%d.%d",
|
||||
VIPS_LIBDIR, VIPS_MAJOR_VERSION, VIPS_MINOR_VERSION ) ) {
|
||||
g_info( "found %s/vips-modules-%d.%d",
|
||||
VIPS_LIBDIR, VIPS_MAJOR_VERSION, VIPS_MINOR_VERSION );
|
||||
g_info( "using configure-time prefix" );
|
||||
return( VIPS_PREFIX );
|
||||
}
|
||||
|
||||
/* Try to guess from argv0.
|
||||
*/
|
||||
if( argv0 ) {
|
||||
@ -1090,10 +1093,7 @@ guess_prefix( const char *argv0, const char *name )
|
||||
/* Must point to our executable.
|
||||
*/
|
||||
if( (prefix = extract_prefix( argv0, name )) ) {
|
||||
#ifdef DEBUG
|
||||
printf( "vips_guess_prefix: found \"%s\" from "
|
||||
"argv0\n", prefix );
|
||||
#endif /*DEBUG*/
|
||||
g_info( "found \"%s\" from argv0", prefix );
|
||||
return( prefix );
|
||||
}
|
||||
}
|
||||
@ -1101,10 +1101,7 @@ guess_prefix( const char *argv0, const char *name )
|
||||
/* Look along path for name.
|
||||
*/
|
||||
if( (prefix = find_file( name )) ) {
|
||||
#ifdef DEBUG
|
||||
printf( "vips_guess_prefix: found \"%s\" from "
|
||||
"PATH\n", prefix );
|
||||
#endif /*DEBUG*/
|
||||
g_info( "found \"%s\" from PATH", prefix );
|
||||
return( prefix );
|
||||
}
|
||||
}
|
||||
@ -1127,10 +1124,7 @@ guess_prefix( const char *argv0, const char *name )
|
||||
g_free( resolved );
|
||||
|
||||
if( prefix ) {
|
||||
#ifdef DEBUG
|
||||
printf( "vips_guess_prefix: found \"%s\" "
|
||||
"from cwd\n", prefix );
|
||||
#endif /*DEBUG*/
|
||||
g_info( "found \"%s\" from cwd", prefix );
|
||||
return( prefix );
|
||||
}
|
||||
}
|
||||
@ -1167,13 +1161,8 @@ vips_guess_prefix( const char *argv0, const char *env_name )
|
||||
|
||||
/* Already set?
|
||||
*/
|
||||
if( (prefix = g_getenv( env_name )) ) {
|
||||
#ifdef DEBUG
|
||||
printf( "vips_guess_prefix: found \"%s\" in environment\n",
|
||||
prefix );
|
||||
#endif /*DEBUG*/
|
||||
if( (prefix = g_getenv( env_name )) )
|
||||
return( prefix );
|
||||
}
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
prefix = vips__windows_prefix();
|
||||
@ -1231,13 +1220,6 @@ vips_guess_libdir( const char *argv0, const char *env_name )
|
||||
else
|
||||
libdir = g_strdup_printf( "%s/lib", prefix );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "vips_guess_libdir: VIPS_PREFIX = %s\n", VIPS_PREFIX );
|
||||
printf( "vips_guess_libdir: VIPS_LIBDIR = %s\n", VIPS_LIBDIR );
|
||||
printf( "vips_guess_libdir: prefix = %s\n", prefix );
|
||||
printf( "vips_guess_libdir: libdir = %s\n", libdir );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
return( libdir );
|
||||
}
|
||||
|
||||
|
@ -528,6 +528,14 @@ main( int argc, char **argv )
|
||||
textdomain( GETTEXT_PACKAGE );
|
||||
setlocale( LC_ALL, "" );
|
||||
|
||||
{
|
||||
char *basename;
|
||||
|
||||
basename = g_path_get_basename( argv[0] );
|
||||
g_set_prgname( basename );
|
||||
g_free( basename );
|
||||
}
|
||||
|
||||
/* On Windows, argv is ascii-only .. use this to get a utf-8 version of
|
||||
* the args.
|
||||
*/
|
||||
|
@ -141,6 +141,14 @@ main( int argc, char **argv )
|
||||
textdomain( GETTEXT_PACKAGE );
|
||||
setlocale( LC_ALL, "" );
|
||||
|
||||
{
|
||||
char *basename;
|
||||
|
||||
basename = g_path_get_basename( argv[0] );
|
||||
g_set_prgname( basename );
|
||||
g_free( basename );
|
||||
}
|
||||
|
||||
/* On Windows, argv is ascii-only .. use this to get a utf-8 version of
|
||||
* the args.
|
||||
*/
|
||||
|
@ -180,6 +180,14 @@ main( int argc, char *argv[] )
|
||||
textdomain( GETTEXT_PACKAGE );
|
||||
setlocale( LC_ALL, "" );
|
||||
|
||||
{
|
||||
char *basename;
|
||||
|
||||
basename = g_path_get_basename( argv[0] );
|
||||
g_set_prgname( basename );
|
||||
g_free( basename );
|
||||
}
|
||||
|
||||
/* On Windows, argv is ascii-only .. use this to get a utf-8 version of
|
||||
* the args.
|
||||
*/
|
||||
|
@ -496,9 +496,13 @@ main( int argc, char **argv )
|
||||
textdomain( GETTEXT_PACKAGE );
|
||||
setlocale( LC_ALL, "" );
|
||||
|
||||
/* The operation cache is not useful for processing many files.
|
||||
vips_cache_set_max( 0 );
|
||||
*/
|
||||
{
|
||||
char *basename;
|
||||
|
||||
basename = g_path_get_basename( argv[0] );
|
||||
g_set_prgname( basename );
|
||||
g_free( basename );
|
||||
}
|
||||
|
||||
/* On Windows, argv is ascii-only .. use this to get a utf-8 version of
|
||||
* the args.
|
||||
|
Loading…
Reference in New Issue
Block a user