]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0511: configure: when GTK4 is used also links in X11 libs v9.2.0511
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Fri, 22 May 2026 18:09:33 +0000 (18:09 +0000)
committerChristian Brabandt <cb@256bit.org>
Fri, 22 May 2026 18:09:33 +0000 (18:09 +0000)
Problem:  configure: when GTK4 is used also links in X11 libs
          (Reilly Brogan)
Solution: Disable linking against X11 libraries when GTK4 GUI is to be
          used (Yasuhiro Matsumoto)

GTK4 does not use any X11 APIs directly; the X11 backend is loaded by
GTK4 at runtime. Force with_x=no when --enable-gui=gtk4 so configure
does not probe for libICE/libSM/libX11/libXt/libXdmcp/libXpm, and so
packagers do not pull those into build dependencies. Also skip the
XSMP X11/SM/SMlib.h header check when X11 is disabled, since USE_XSMP
itself requires HAVE_X11.

fixes:  #20268
closes: #20289

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/auto/configure
src/configure.ac
src/version.c

index 69b1a39ef0ccb8606f37eb603c962bb84a05c13c..90110a812bc6384726d63407b98a73151e42d396 100755 (executable)
@@ -9296,8 +9296,11 @@ CPPFLAGS=$cppflags_save
 CFLAGS=$cflags_save
 fi
 
+if test "x$enable_gui" = "xgtk4"; then
+  with_x=no
+fi
 test -z "$with_x" && with_x=yes
-test "${enable_gui-yes}" != no -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
+test "${enable_gui-yes}" != no -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" -a "x$enable_gui" != "xgtk4" && with_x=yes
 if test "$with_x" = no; then
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: defaulting to: don't HAVE_X11" >&5
 printf "%s\n" "defaulting to: don't HAVE_X11" >&6; }
@@ -10465,7 +10468,7 @@ printf "%s\n" "#define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t" >>confdefs.h
   fi
 fi
 
-if test "x$with_x" = xno -a "x$with_x_arg" = xyes; then
+if test "x$with_x" = xno -a "x$with_x_arg" = xyes -a "x$enable_gui" != "xgtk4"; then
     as_fn_error $? "could not configure X" "$LINENO" 5
 fi
 
@@ -11921,7 +11924,7 @@ printf "%s\n" "$NARROW_PROTO" >&6; }
 
 fi
 
-if test "$enable_xsmp" = "yes"; then
+if test "$enable_xsmp" = "yes" -a "x$with_x" != "xno"; then
   cppflags_save=$CPPFLAGS
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_fn_c_check_header_compile "$LINENO" "X11/SM/SMlib.h" "ac_cv_header_X11_SM_SMlib_h" "$ac_includes_default"
index a49c6d26b9b9f992b6146a6b6b2298cb2290a3e9..6f6590f6daa9bbab6cb338543ea95cd3ba2e81f9 100644 (file)
@@ -2489,8 +2489,15 @@ CPPFLAGS=$cppflags_save
 CFLAGS=$cflags_save
 fi
 
+dnl GTK4 does not use X11 APIs directly, so skip X11 detection entirely.
+dnl This avoids pulling libICE/libSM/libX11/libXt into build dependencies
+dnl for GTK4-only builds, even when --with-x=yes is passed (e.g. by a
+dnl distro's default packaging script).
+if test "x$enable_gui" = "xgtk4"; then
+  with_x=no
+fi
 test -z "$with_x" && with_x=yes
-test "${enable_gui-yes}" != no -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" && with_x=yes
+test "${enable_gui-yes}" != no -a "x$MACOS_X" != "xyes" -a "x$QNX" != "xyes" -a "x$enable_gui" != "xgtk4" && with_x=yes
 if test "$with_x" = no; then
   AC_MSG_RESULT(defaulting to: don't HAVE_X11)
 else
@@ -2605,7 +2612,8 @@ else
 fi
 
 dnl Check if --with-x was given but it doesn't work.
-if test "x$with_x" = xno -a "x$with_x_arg" = xyes; then
+dnl GTK4 always forces with_x=no above, so don't treat that as a failure.
+if test "x$with_x" = xno -a "x$with_x_arg" = xyes -a "x$enable_gui" != "xgtk4"; then
     AC_MSG_ERROR([could not configure X])
 fi
 
@@ -3275,8 +3283,9 @@ EOF
 fi
 
 dnl Look for XSMP support - but don't necessarily restrict it to X11 GUIs
-dnl use the X11 include path
-if test "$enable_xsmp" = "yes"; then
+dnl use the X11 include path.  Skip when X11 is not in use; USE_XSMP itself
+dnl requires HAVE_X11, so the header check would be wasted otherwise.
+if test "$enable_xsmp" = "yes" -a "x$with_x" != "xno"; then
   cppflags_save=$CPPFLAGS
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   AC_CHECK_HEADERS(X11/SM/SMlib.h)
index 7b6e33045e95f73e7412f071e9756ce9378783c1..7be1f150baab787cbe9199f7f058445cb4f33884 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    511,
 /**/
     510,
 /**/