Re: [vim/vim] configure: honor `--disable-hardcopy-pango` with GTK (PR #20945)
h_east (Vim Github Repository) <[email protected]> Wed, 05 Aug 2026 10:48:06 -0700
| Newsgroups | gmane.editors.vim.devel |
|---|---|
| Message-ID | <vim/vim/pull/20945/[email protected]> |
h-east left a comment (vim/vim#20945)
Here is a patch on top of this PR for the Pango 1.44 check.
### What the patch does
The pango detection in `configure.ac` now tests for `pango >= 1.44` in addition
to `pango` and `pangocairo`. `have_pango` gains a third value, `old`, for a
Pango that is installed but too old.
hardcopy-pango is turned off for `old` just as it is for a missing Pango or
Cairo, and the result line says which of the two it was:
```
checking --enable-hardcopy-pango argument... no, Pango is older than 1.44
checking --enable-hardcopy-pango argument... no, Pango or Cairo not found
```
There is no fallback. With a Pango older than 1.44 the PostScript backend is
used, the same as on a system without Pango at all.
When `--enable-hardcopy-pango` is given explicitly, an old Pango takes the
`fail_if_missing` branch this PR adds, so `--enable-fail-if-missing` stops the
configure run instead of silently dropping the feature.
The `--enable-hardcopy-pango` help text names the minimum version.
### Why 1.44
Only one Pango function in `hardcopy_pango.c` needs it,
`pango_font_metrics_get_height()`, which is used to compute the line spacing.
The newest of the remaining calls is `pango_shape_full()` from 1.32.
`have_pango` and `have_cairo` are read in exactly one place, the
`--enable-hardcopy-pango` block, so raising the required version there does not
affect the GTK GUI detection. `pangocairo` is shipped with Pango and carries
the same version, so testing the version once is enough.
A system with Pango 1.42 has Pango installed, so reporting "Pango or Cairo not
found" would be misleading. That is why the two cases are reported
separately: the configure output is what somebody on an older distribution will
look at.
### src/auto/configure
It is included and is byte for byte what autoconf produces for these hunks.
Please do not regenerate it with `make autoconf`: the committed file comes from
a different autoconf version than the one I have here, and regenerating
rewrites the unrelated `AC_SYS_LARGEFILE` block.
### Applying
Save the block below as `pango-1.44.patch` and run this at the top of the work
tree, with this PR checked out:
```
patch -p1 < pango-1.44.patch
```
<details>
<summary>Patch for src/configure.ac and src/auto/configure (2 files, 5 hunks)</summary>
```diff
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -2493,12 +2493,18 @@
AC_MSG_CHECKING(for pango)
have_pango="no"
if "$PKG_CONFIG" --exists 'pango' && "$PKG_CONFIG" --exists 'pangocairo'; then
- have_pango="yes"
- AC_MSG_RESULT([yes])
-
- PANGO_CFLAGS=`$PKG_CONFIG --cflags-only-other pango pangocairo`
- PANGO_CPPFLAGS=`$PKG_CONFIG --cflags-only-I pango pangocairo`
- PANGO_LIBS=`$PKG_CONFIG --libs pango pangocairo`
+dnl pango_font_metrics_get_height() requires Pango 1.44.
+ if "$PKG_CONFIG" --exists 'pango >= 1.44'; then
+ have_pango="yes"
+ AC_MSG_RESULT([yes])
+
+ PANGO_CFLAGS=`$PKG_CONFIG --cflags-only-other pango pangocairo`
+ PANGO_CPPFLAGS=`$PKG_CONFIG --cflags-only-I pango pangocairo`
+ PANGO_LIBS=`$PKG_CONFIG --libs pango pangocairo`
+ else
+ have_pango="old"
+ AC_MSG_RESULT([no, version 1.44 or later is required])
+ fi
else
AC_MSG_RESULT(no)
fi
@@ -3153,16 +3159,20 @@
AC_MSG_CHECKING(--enable-hardcopy-pango argument)
AC_ARG_ENABLE(hardcopy-pango,
- [ --enable-hardcopy-pango Use Pango and Cairo for improved hardcopy printing. [default=yes when GTK GUI enabled]],
+ [ --enable-hardcopy-pango Use Pango 1.44 or later and Cairo for improved hardcopy printing. [default=yes when GTK GUI enabled]],
[],
[enable_hardcopy_pango="auto"])
-if test "x$have_pango" = "xno" || test "x$have_cairo" = "xno"; then
+if test "x$have_pango" != "xyes" || test "x$have_cairo" = "xno"; then
if test "$fail_if_missing" = "yes" -a "$enable_hardcopy_pango" = "yes"; then
AC_MSG_ERROR([could not configure hardcopy-pango])
fi
enable_hardcopy_pango="no"
- AC_MSG_RESULT([no, Pango or Cairo not found])
+ if test "x$have_pango" = "xold"; then
+ AC_MSG_RESULT([no, Pango is older than 1.44])
+ else
+ AC_MSG_RESULT([no, Pango or Cairo not found])
+ fi
else
if test "x$enable_hardcopy_pango" = "xauto"; then
if test "x$GUITYPE" = "xGTK" || test "x$GUITYPE" = "xGTK4"; then
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -1553,7 +1553,7 @@
--disable-gtktest Do not try to compile and run a test GTK program
--disable-icon-cache-update update disabled
--disable-desktop-database-update update disabled
- --enable-hardcopy-pango Use Pango and Cairo for improved hardcopy printing. default=yes when GTK GUI enabled
+ --enable-hardcopy-pango Use Pango 1.44 or later and Cairo for improved hardcopy printing. default=yes when GTK GUI enabled
--disable-largefile omit support for large files
--disable-canberra Do not use libcanberra.
--disable-libsodium Do not use libsodium.
@@ -9274,13 +9274,19 @@
printf %s "checking for pango... " >&6; }
have_pango="no"
if "$PKG_CONFIG" --exists 'pango' && "$PKG_CONFIG" --exists 'pangocairo'; then
- have_pango="yes"
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ if "$PKG_CONFIG" --exists 'pango >= 1.44'; then
+ have_pango="yes"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
- PANGO_CFLAGS=`$PKG_CONFIG --cflags-only-other pango pangocairo`
- PANGO_CPPFLAGS=`$PKG_CONFIG --cflags-only-I pango pangocairo`
- PANGO_LIBS=`$PKG_CONFIG --libs pango pangocairo`
+ PANGO_CFLAGS=`$PKG_CONFIG --cflags-only-other pango pangocairo`
+ PANGO_CPPFLAGS=`$PKG_CONFIG --cflags-only-I pango pangocairo`
+ PANGO_LIBS=`$PKG_CONFIG --libs pango pangocairo`
+ else
+ have_pango="old"
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, version 1.44 or later is required" >&5
+printf "%s\n" "no, version 1.44 or later is required" >&6; }
+ fi
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
@@ -11551,13 +11557,18 @@
fi
-if test "x$have_pango" = "xno" || test "x$have_cairo" = "xno"; then
+if test "x$have_pango" != "xyes" || test "x$have_cairo" = "xno"; then
if test "$fail_if_missing" = "yes" -a "$enable_hardcopy_pango" = "yes"; then
as_fn_error $? "could not configure hardcopy-pango" "$LINENO" 5
fi
enable_hardcopy_pango="no"
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, Pango or Cairo not found" >&5
+ if test "x$have_pango" = "xold"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, Pango is older than 1.44" >&5
+printf "%s\n" "no, Pango is older than 1.44" >&6; }
+ else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, Pango or Cairo not found" >&5
printf "%s\n" "no, Pango or Cairo not found" >&6; }
+ fi
else
if test "x$enable_hardcopy_pango" = "xauto"; then
if test "x$GUITYPE" = "xGTK" || test "x$GUITYPE" = "xGTK4"; then
```
</details>
--
Reply to this email directly or view it on GitHub:
https://github.com/vim/vim/pull/20945#issuecomment-5195281124
You are receiving this because you are subscribed to this thread.
Message ID: <vim/vim/pull/20945/[email protected]>
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_dev/vim/vim/pull/20945/c5195281124%40github.com.