Commit: patch 9.2.0916: configure: honor `--disable-hardcopy-pango` with GTK UI

Christian Brabandt <[email protected]> Thu, 6 Aug 2026 21:00:04 +0200
Newsgroups gmane.editors.vim.devel
Message-ID <[email protected]>
patch 9.2.0916: configure: honor `--disable-hardcopy-pango` with GTK UI

Commit: https://github.com/vim/vim/commit/c6350f0e28a0ca9b4afffb22d0cd88a363b7816c
Author: Wei Tang <[email protected]>
Date:   Thu Aug 6 18:32:38 2026 +0000

    patch 9.2.0916: configure: honor `--disable-hardcopy-pango` with GTK UI
    
    Problem:  The configure script enables Pango hardcopy automatically
              when the GTK GUI is selected, even when the user explicitly
              specified `--disable-hardcopy-pango` (after v9.2.0898).
    Solution: Only enable Pango hardcopy by default when the option was not
              explicitly specified, verify that pango library is at least v1.44
              (Wei Tang, Hirohito Higashi)
    
    fixes:  #20952
    closes: #20945
    
    Co-Authored-by: Hirohito Higashi <[email protected]>
    Signed-off-by: Wei Tang <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index 4db123621..330b552db 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -1,4 +1,4 @@
-*version9.txt*	For Vim version 9.2.  Last change: 2026 Aug 02
+*version9.txt*	For Vim version 9.2.  Last change: 2026 Aug 06
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -52741,6 +52741,10 @@ Highlighting: ~
 |hl-PopupBorder|	Popup window border.
 |hl-PopupTitle|		Popup window title.
 
+Configure Switches: ~
+
+--enable-hardcopy-pango	Enable the pango |:hardcopy| backend |pango-printing|
+
 ==============================================================================
 PATCHES						*patches-9.3* *bug-fixes-9.3*
 						*patches-after-9.2*
diff --git a/src/auto/configure b/src/auto/configure
index a47cb58d2..312ab6f6c 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -1553,7 +1553,7 @@ Optional Features:
   --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 @@ fi
 printf %s "checking for pango... " >&6; }
 have_pango="no"
 if "$PKG_CONFIG" --exists 'pango' && "$PKG_CONFIG" --exists 'pangocairo'; then
-  have_pango="yes"
-  { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+  if "$PKG_CONFIG" --exists 'pango >= 1.44'; then
+    have_pango="yes"
+    { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s
" "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
" "$as_me:${as_lineno-$LINENO}: result: no, version 1.44 or later is required" >&5
+printf "%s
" "no, version 1.44 or later is required" >&6; }
+  fi
 else
   { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s
" "no" >&6; }
@@ -11545,25 +11551,41 @@ printf %s "checking --enable-hardcopy-pango argument... " >&6; }
 if test ${enable_hardcopy_pango+y}
 then :
   enableval=$enable_hardcopy_pango;
+else case e in #(
+  e) enable_hardcopy_pango="auto" ;;
+esac
 fi
 
 
-if test "x$have_pango" = "xno" || test "x$have_cairo" = "xno"; then
-  { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: no, Pango or Cairo not found" >&5
+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"
+  if test "x$have_pango" = "xold"; then
+    { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: no, Pango is older than 1.44" >&5
+printf "%s
" "no, Pango is older than 1.44" >&6; }
+  else
+    { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: no, Pango or Cairo not found" >&5
 printf "%s
" "no, Pango or Cairo not found" >&6; }
+  fi
 else
-  if test "x$GUITYPE" = "xGTK" || test "x$GUITYPE" = "xGTK4"; then
-    enable_hardcopy_pango="yes"
-    { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: yes, GTK GUI enabled" >&5
+  if test "x$enable_hardcopy_pango" = "xauto"; then
+    if test "x$GUITYPE" = "xGTK" || test "x$GUITYPE" = "xGTK4"; then
+      enable_hardcopy_pango="yes"
+      { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: yes, GTK GUI enabled" >&5
 printf "%s
" "yes, GTK GUI enabled" >&6; }
-  else
-    if test "$enable_hardcopy_pango" = "yes"; then
-      { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-printf "%s
" "yes" >&6; }
     else
+      enable_hardcopy_pango="no"
       { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s
" "no" >&6; }
     fi
+  elif test "$enable_hardcopy_pango" = "yes"; then
+    { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s
" "yes" >&6; }
+  else
+    { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s
" "no" >&6; }
   fi
 fi
 
diff --git a/src/configure.ac b/src/configure.ac
index 2fdc51637..75035d754 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -2493,12 +2493,18 @@ fi
 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])
+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`
+    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,21 +3159,33 @@ AC_SUBST(UPDATE_DESKTOP_DATABASE)
 
 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="no")
+	[  --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
-  AC_MSG_RESULT([no, Pango or Cairo not found])
-else
-  if test "x$GUITYPE" = "xGTK" || test "x$GUITYPE" = "xGTK4"; then
-    enable_hardcopy_pango="yes"
-    AC_MSG_RESULT([yes, GTK GUI enabled])
+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"
+  if test "x$have_pango" = "xold"; then
+    AC_MSG_RESULT([no, Pango is older than 1.44])
   else
-    if test "$enable_hardcopy_pango" = "yes"; then
-      AC_MSG_RESULT([yes])
+    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
+      enable_hardcopy_pango="yes"
+      AC_MSG_RESULT([yes, GTK GUI enabled])
     else
+      enable_hardcopy_pango="no"
       AC_MSG_RESULT([no])
     fi
+  elif test "$enable_hardcopy_pango" = "yes"; then
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_RESULT([no])
   fi
 fi
 
diff --git a/src/version.c b/src/version.c
index cca2e3afa..78b210fdb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    916,
 /**/
     915,
 /**/

-- 
-- 
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/E1ws3K0-00GTT0-Ev%40256bit.org.