From 7553f60aed74c0f5bb04df221d3191cbc2bcfc06 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Sun, 12 Jun 2022 13:22:36 +0200 Subject: [PATCH] Minor cleanups (#2857) - Remove `HAVE_LCMS` definition in favor of `HAVE_LCMS2`. - Remove `HAVE_WINDOWS_H` definition in favor of `G_OS_WIN32`. - Remove stray `vips_text_get_type` in `conversion.c`. - Remove duplicated `unistd.h` include. - Remove redundant `strcasecmp` definition, we use `g_ascii_strcasecmp` everywhere. - Remove unnecessary header checks in `configure.ac` and `meson.build`. - Ensure `unistd.h` include is guarded with `HAVE_UNISTD_H`. - Fail early when `-Dfontconfig=enabled` and `pangoft2` is not found. --- configure.ac | 2 +- libvips/colour/icc_transform.c | 2 +- libvips/conversion/conversion.c | 6 ------ libvips/include/vips/deprecated.h | 4 ++-- libvips/iofuncs/connection.c | 1 - libvips/iofuncs/sbuf.c | 1 - libvips/iofuncs/source.c | 1 - libvips/iofuncs/sourcecustom.c | 1 - libvips/iofuncs/sourceginput.c | 1 - libvips/iofuncs/target.c | 1 - libvips/iofuncs/targetcustom.c | 1 - meson.build | 10 ++++------ tools/vips.c | 4 ---- tools/vipsedit.c | 2 ++ 14 files changed, 10 insertions(+), 27 deletions(-) diff --git a/configure.ac b/configure.ac index 6e079fb9..42bfebf6 100644 --- a/configure.ac +++ b/configure.ac @@ -304,7 +304,7 @@ EXTRA_LIBS_USED="" # Checks for header files. 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]) +AC_CHECK_HEADERS([sys/file.h sys/param.h sys/mman.h unistd.h io.h direct.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_RESTRICT diff --git a/libvips/colour/icc_transform.c b/libvips/colour/icc_transform.c index 0a733bf7..c38662e2 100644 --- a/libvips/colour/icc_transform.c +++ b/libvips/colour/icc_transform.c @@ -1437,7 +1437,7 @@ vips_icc_is_compatible_profile( VipsImage *image, return( TRUE ); } -#endif /*HAVE_LCMS*/ +#endif /*HAVE_LCMS2*/ /** * vips_icc_import: (method) diff --git a/libvips/conversion/conversion.c b/libvips/conversion/conversion.c index 32d901d8..5886b617 100644 --- a/libvips/conversion/conversion.c +++ b/libvips/conversion/conversion.c @@ -402,9 +402,6 @@ vips_conversion_operation_init( void ) extern GType vips_subsample_get_type( void ); extern GType vips_msb_get_type( void ); extern GType vips_byteswap_get_type( void ); -#ifdef HAVE_PANGOFT2 - extern GType vips_text_get_type( void ); -#endif /*HAVE_PANGOFT2*/ extern GType vips_xyz_get_type( void ); extern GType vips_falsecolour_get_type( void ); extern GType vips_gamma_get_type( void ); @@ -454,9 +451,6 @@ vips_conversion_operation_init( void ) vips_subsample_get_type(); vips_msb_get_type(); vips_byteswap_get_type(); -#ifdef HAVE_PANGOFT2 - vips_text_get_type(); -#endif /*HAVE_PANGOFT2*/ vips_xyz_get_type(); vips_falsecolour_get_type(); vips_gamma_get_type(); diff --git a/libvips/include/vips/deprecated.h b/libvips/include/vips/deprecated.h index 5f283378..5f7a94cf 100644 --- a/libvips/include/vips/deprecated.h +++ b/libvips/include/vips/deprecated.h @@ -40,14 +40,14 @@ extern "C" { /* On win32, need to override the wingdi defs for these. Yuk! */ -#ifdef HAVE_WINDOWS_H +#ifdef G_OS_WIN32 #ifdef RGB #undef RGB #endif #ifdef CMYK #undef CMYK #endif -#endif /*HAVE_WINDOWS_H*/ +#endif /*G_OS_WIN32*/ /* Bits per Band */ #define BBBYTE 8 diff --git a/libvips/iofuncs/connection.c b/libvips/iofuncs/connection.c index f7533529..03bc4e6b 100644 --- a/libvips/iofuncs/connection.c +++ b/libvips/iofuncs/connection.c @@ -50,7 +50,6 @@ #include #include #include -#include #include #include diff --git a/libvips/iofuncs/sbuf.c b/libvips/iofuncs/sbuf.c index 0f757586..6eea995b 100644 --- a/libvips/iofuncs/sbuf.c +++ b/libvips/iofuncs/sbuf.c @@ -50,7 +50,6 @@ #include #include #include -#include #include #include diff --git a/libvips/iofuncs/source.c b/libvips/iofuncs/source.c index 39637bb3..d9573f4d 100644 --- a/libvips/iofuncs/source.c +++ b/libvips/iofuncs/source.c @@ -69,7 +69,6 @@ #include #include #include -#include #include diff --git a/libvips/iofuncs/sourcecustom.c b/libvips/iofuncs/sourcecustom.c index 0620bcec..93703372 100644 --- a/libvips/iofuncs/sourcecustom.c +++ b/libvips/iofuncs/sourcecustom.c @@ -50,7 +50,6 @@ #include #include #include -#include #include #include diff --git a/libvips/iofuncs/sourceginput.c b/libvips/iofuncs/sourceginput.c index 3c0d6f33..d5fb6e7f 100644 --- a/libvips/iofuncs/sourceginput.c +++ b/libvips/iofuncs/sourceginput.c @@ -47,7 +47,6 @@ #include #include #include -#include #include #include diff --git a/libvips/iofuncs/target.c b/libvips/iofuncs/target.c index 723971a7..995b1e0e 100644 --- a/libvips/iofuncs/target.c +++ b/libvips/iofuncs/target.c @@ -54,7 +54,6 @@ #include #include #include -#include #include diff --git a/libvips/iofuncs/targetcustom.c b/libvips/iofuncs/targetcustom.c index 87bfae24..603422d5 100644 --- a/libvips/iofuncs/targetcustom.c +++ b/libvips/iofuncs/targetcustom.c @@ -50,7 +50,6 @@ #include #include #include -#include #include #include diff --git a/meson.build b/meson.build index 7d9b8f7a..af6b3555 100644 --- a/meson.build +++ b/meson.build @@ -336,10 +336,12 @@ if pangocairo_dep.found() cfg_var.set('HAVE_PANGOCAIRO', '1') endif +# text rendering with fontconfig requires pangoft2 +pangoft2_dep = dependency('pangoft2', version: '>=1.32.6', required: get_option('fontconfig')) fontconfig_dep = dependency('fontconfig', required: get_option('fontconfig')) -if fontconfig_dep.found() and pangocairo_dep.found() +if pangoft2_dep.found() and fontconfig_dep.found() and pangocairo_dep.found() + libvips_deps += pangoft2_dep libvips_deps += fontconfig_dep - libvips_deps += dependency('pangoft2', version: '>=1.32.6') cfg_var.set('HAVE_FONTCONFIG', '1') endif @@ -385,7 +387,6 @@ endif lcms_dep = dependency('lcms2', required: get_option('lcms')) if lcms_dep.found() libvips_deps += lcms_dep - cfg_var.set('HAVE_LCMS', '1') cfg_var.set('HAVE_LCMS2', '1') endif @@ -537,9 +538,6 @@ endif if cc.has_header('direct.h') cfg_var.set('HAVE_DIRECT_H', '1') endif -if cc.has_header('windows.h') - cfg_var.set('HAVE_WINDOWS_H', '1') -endif if get_option('deprecated') cfg_var.set('ENABLE_DEPRECATED', '1') endif diff --git a/tools/vips.c b/tools/vips.c index 392877b4..05ca901c 100644 --- a/tools/vips.c +++ b/tools/vips.c @@ -102,10 +102,6 @@ #include #endif -#ifdef G_OS_WIN32 -#define strcasecmp(a,b) _stricmp(a,b) -#endif /*G_OS_WIN32*/ - static char *main_option_plugin = NULL; static gboolean main_option_version; diff --git a/tools/vipsedit.c b/tools/vipsedit.c index f0c7c00d..218d8e0f 100644 --- a/tools/vipsedit.c +++ b/tools/vipsedit.c @@ -57,7 +57,9 @@ #include #include #include +#ifdef HAVE_UNISTD_H #include +#endif /*HAVE_UNISTD_H*/ #include #include