From eeb64b6968ae60dabee5a0d28648f12d089b4810 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 22 Jun 2021 18:09:57 +0100 Subject: [PATCH] change init prefix fallback order Use the configure time prefix second rather than going straight to search. This should help ruby-vips on homebrew. --- libvips/iofuncs/init.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/libvips/iofuncs/init.c b/libvips/iofuncs/init.c index 494cfe12..96b35e82 100644 --- a/libvips/iofuncs/init.c +++ b/libvips/iofuncs/init.c @@ -479,6 +479,11 @@ vips_init( const char *argv0 ) !(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 ); @@ -1068,6 +1073,15 @@ 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( "using configure-time prefix" ); + return( VIPS_PREFIX ); + } + /* Try to guess from argv0. */ if( argv0 ) { @@ -1202,11 +1216,6 @@ vips_guess_libdir( const char *argv0, const char *env_name ) else libdir = g_strdup_printf( "%s/lib", prefix ); - g_info( "VIPS_PREFIX = %s", VIPS_PREFIX ); - g_info( "VIPS_LIBDIR = %s", VIPS_LIBDIR ); - g_info( "prefix = %s", prefix ); - g_info( "libdir = %s", libdir ); - return( libdir ); }