better libdir guessing

take the lib directory name (eg. "lib64" etc.) from the configure
time libdir
This commit is contained in:
John Cupitt 2021-07-02 11:50:34 +01:00
parent ad40d881dd
commit d07dee8b0c
1 changed files with 9 additions and 4 deletions

View File

@ -1205,18 +1205,23 @@ const char *
vips_guess_libdir( const char *argv0, const char *env_name )
{
const char *prefix = vips_guess_prefix( argv0, env_name );
static char *libdir = NULL;
static char *libdir = NULL;
char *suffix;
if( libdir )
return( libdir );
/* Have we been moved since configure? If not, use the configure-time
* libdir.
* libdir.
*
* The lib directory name can be eg. "lib", "lib64" etc. depending on
* the platform, so copy that from the configure-time libdir if we can.
*/
if( strcmp( prefix, VIPS_PREFIX ) == 0 )
libdir = VIPS_LIBDIR;
else if ( strstr(VIPS_LIBDIR, "/lib64") )
libdir = g_strdup_printf( "%s/lib64", prefix );
else if( (suffix = strrchr( VIPS_LIBDIR, G_DIR_SEPARATOR )) )
libdir = g_strdup_printf( "%s%s", prefix, suffix );
else
libdir = g_strdup_printf( "%s/lib", prefix );