]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1561: configure: wayland test can be improved v9.1.1561
authorChristoffer Aasted <chr.aasted@gmail.com>
Thu, 17 Jul 2025 19:11:06 +0000 (21:11 +0200)
committerChristian Brabandt <cb@256bit.org>
Thu, 17 Jul 2025 19:11:06 +0000 (21:11 +0200)
Problem:  configure: wayland test can be improved
Solution: Define $WAYLAND_CFLAGS, simplify the wayland tests
          (Christoffer Aasted).

closes: #17772

Signed-off-by: Christoffer Aasted <chr.aasted@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/Makefile
src/auto/configure
src/config.mk.in
src/configure.ac
src/version.c

index 0cf9f8836a3153acaff4c0cf1981c6cb40b2ca49..175f659d6e45100208f4f15c19cac7385dc9c54c 100644 (file)
@@ -3646,19 +3646,19 @@ objects/window.o: window.c
        $(CCC) -o $@ window.c
 
 objects/wayland.o: wayland.c
-       $(CCC) -o $@ wayland.c
+       $(CCC) $(WAYLAND_CFLAGS) -o $@ wayland.c
 
 objects/wlr-data-control-unstable-v1.o: auto/wayland/wlr-data-control-unstable-v1.c
-       $(CCC) -o $@ auto/wayland/wlr-data-control-unstable-v1.c
+       $(CCC) $(WAYLAND_CFLAGS) -o $@ auto/wayland/wlr-data-control-unstable-v1.c
 
 objects/ext-data-control-v1.o: auto/wayland/ext-data-control-v1.c
-       $(CCC) -o $@ auto/wayland/ext-data-control-v1.c
+       $(CCC) $(WAYLAND_CFLAGS) -o $@ auto/wayland/ext-data-control-v1.c
 
 objects/xdg-shell.o: auto/wayland/xdg-shell.c
-       $(CCC) -o $@ auto/wayland/xdg-shell.c
+       $(CCC) $(WAYLAND_CFLAGS) -o $@ auto/wayland/xdg-shell.c
 
 objects/primary-selection-unstable-v1.o: auto/wayland/primary-selection-unstable-v1.c
-       $(CCC) -o $@ auto/wayland/primary-selection-unstable-v1.c
+       $(CCC) $(WAYLAND_CFLAGS) -o $@ auto/wayland/primary-selection-unstable-v1.c
 
 objects/netbeans.o: netbeans.c
        $(CCC) -o $@ netbeans.c
index a4123a3fdf23e658bf1d804e586730660a3456e8..d01f38c71439da19ea9f88c5209f42efcd30f4a2 100755 (executable)
@@ -678,6 +678,7 @@ xmkmfpath
 WAYLAND_OBJ
 WAYLAND_SRC
 WAYLAND_LIBS
+WAYLAND_CFLAGS
 TERM_TEST
 TERM_OBJ
 TERM_SRC
@@ -9213,120 +9214,49 @@ printf %s "checking --with-wayland argument... " >&6; }
 # Check whether --with-wayland was given.
 if test ${with_wayland+y}
 then :
-  withval=$with_wayland;
-fi
-
-
-test -z "$with_wayland" && with_wayland=yes
-if test "$with_wayland" = yes; then
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-printf "%s\n" "yes" >&6; }
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if Wayland client header files can be found" >&5
-printf %s "checking if Wayland client header files can be found... " >&6; }
-  cppflags_save=$CPPFLAGS
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <wayland-client.h>
-int
-main (void)
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"
-then :
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-printf "%s\n" "yes" >&6; }
+  withval=$with_wayland; with_wayland=$withval
 else case e in #(
-  e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }; no_wl=yes ;;
+  e) with_wayland=yes ;;
 esac
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
-  CPPFLAGS=$cppflags_save
 
-  if test "$no_wl" = yes; then
-    with_wayland=no
-  else
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wl_display_connect in -lwayland-client" >&5
-printf %s "checking for wl_display_connect in -lwayland-client... " >&6; }
-if test ${ac_cv_lib_wayland_client_wl_display_connect+y}
-then :
-  printf %s "(cached) " >&6
-else case e in #(
-  e) ac_check_lib_save_LIBS=$LIBS
-LIBS="-lwayland-client  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_wayland" >&5
+printf "%s\n" "$with_wayland" >&6; }
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.
-   The 'extern "C"' is for builds by C++ compilers;
-   although this is not generally supported in C code supporting it here
-   has little cost and some practical benefit (sr 110532).  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char wl_display_connect (void);
-int
-main (void)
-{
-return wl_display_connect ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"
-then :
-  ac_cv_lib_wayland_client_wl_display_connect=yes
-else case e in #(
-  e) ac_cv_lib_wayland_client_wl_display_connect=no ;;
-esac
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS ;;
-esac
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_wayland_client_wl_display_connect" >&5
-printf "%s\n" "$ac_cv_lib_wayland_client_wl_display_connect" >&6; }
-if test "x$ac_cv_lib_wayland_client_wl_display_connect" = xyes
-then :
-  no_wl=no
-fi
-
-
-    if test "$no_wl" = no; then
-      printf "%s\n" "#define HAVE_WAYLAND 1" >>confdefs.h
+if test "$with_wayland" = yes; then
+cflags_save=$CFLAGS
+  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wayland" >&5
+printf %s "checking for wayland... " >&6; }
+  if "$PKG_CONFIG" --exists 'wayland-client'; then
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+    printf "%s\n" "#define HAVE_WAYLAND 1" >>confdefs.h
 
-      WAYLAND_LIBS="-lwayland-client";
+    WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client`
+    CFLAGS="$CFLAGS $WAYLAND_CFLAGS"
+    WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client`
+    WAYLAND_SRC=" \
+      auto/wayland/wlr-data-control-unstable-v1.c \
+      auto/wayland/ext-data-control-v1.c \
+      auto/wayland/xdg-shell.c \
+      auto/wayland/primary-selection-unstable-v1.c \
+      wayland.c"
+    WAYLAND_OBJ=" \
+      objects/wlr-data-control-unstable-v1.o \
+      objects/ext-data-control-v1.o \
+      objects/xdg-shell.o \
+      objects/primary-selection-unstable-v1.o \
+      objects/wayland.o"
 
-      WAYLAND_SRC=" \
-             auto/wayland/wlr-data-control-unstable-v1.c \
-             auto/wayland/ext-data-control-v1.c \
-             auto/wayland/xdg-shell.c \
-             auto/wayland/primary-selection-unstable-v1.c \
-             wayland.c"
 
-      WAYLAND_OBJ=" \
-             objects/wlr-data-control-unstable-v1.o \
-             objects/ext-data-control-v1.o \
-             objects/xdg-shell.o \
-             objects/primary-selection-unstable-v1.o \
-             objects/wayland.o"
 
 
-    else
-      with_wayland=no
-    fi
-  fi
-else
-  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+  else
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s\n" "no" >&6; }
+    with_wayland=no
+  fi
+CFLAGS=$cflags_save
 fi
 
 test -z "$with_x" && with_x=yes
index f893e8f0b1024f2622402b82a9dfc2a61af55587..78b207ef765e49c2bc2d94f1d0a6b331086bf9f6 100644 (file)
@@ -40,6 +40,7 @@ X_LIBS                = @X_LIB@
 WAYLAND_LIBS    = @WAYLAND_LIBS@
 WAYLAND_SRC    = @WAYLAND_SRC@
 WAYLAND_OBJ    = @WAYLAND_OBJ@
+WAYLAND_CFLAGS    = @WAYLAND_CFLAGS@
 
 XDIFF_OBJS_USED        = @XDIFF_OBJS_USED@
 
index 9db7d37bd00b98a3dfc62fcdacdab5140e195265..fc9590f75819c163b7941c6c7bfdbd05b155ac08 100644 (file)
@@ -2406,49 +2406,41 @@ CPPFLAGS=$cppflags_save
 
 AC_MSG_CHECKING(--with-wayland argument)
 AC_ARG_WITH(wayland,
-       [  --with-wayland         Include support for the Wayland protocol.])
+       [  --with-wayland         Include support for the Wayland protocol.],
+       [with_wayland=$withval],
+       [with_wayland=yes])
+AC_MSG_RESULT([$with_wayland])
 
-test -z "$with_wayland" && with_wayland=yes
 if test "$with_wayland" = yes; then
-  AC_MSG_RESULT(yes)
-  AC_MSG_CHECKING(if Wayland client header files can be found)
-  cppflags_save=$CPPFLAGS
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <wayland-client.h>], )],
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no); no_wl=yes)
-  CPPFLAGS=$cppflags_save
-
-  if test "$no_wl" = yes; then
-    with_wayland=no
+cflags_save=$CFLAGS
+  AC_MSG_CHECKING(for wayland)
+  if "$PKG_CONFIG" --exists 'wayland-client'; then
+    AC_MSG_RESULT([yes])
+    AC_DEFINE(HAVE_WAYLAND)
+    WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client`
+    CFLAGS="$CFLAGS $WAYLAND_CFLAGS"
+    WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client`
+    WAYLAND_SRC=" \
+      auto/wayland/wlr-data-control-unstable-v1.c \
+      auto/wayland/ext-data-control-v1.c \
+      auto/wayland/xdg-shell.c \
+      auto/wayland/primary-selection-unstable-v1.c \
+      wayland.c"
+    WAYLAND_OBJ=" \
+      objects/wlr-data-control-unstable-v1.o \
+      objects/ext-data-control-v1.o \
+      objects/xdg-shell.o \
+      objects/primary-selection-unstable-v1.o \
+      objects/wayland.o"
+    AC_SUBST(WAYLAND_CFLAGS)
+    AC_SUBST(WAYLAND_LIBS)
+    AC_SUBST(WAYLAND_SRC)
+    AC_SUBST(WAYLAND_OBJ)
   else
-    AC_CHECK_LIB(wayland-client, wl_display_connect,[no_wl=no])
-
-    if test "$no_wl" = no; then
-      AC_DEFINE(HAVE_WAYLAND)
-      WAYLAND_LIBS="-lwayland-client";
-      AC_SUBST(WAYLAND_LIBS)
-      WAYLAND_SRC=" \
-             auto/wayland/wlr-data-control-unstable-v1.c \
-             auto/wayland/ext-data-control-v1.c \
-             auto/wayland/xdg-shell.c \
-             auto/wayland/primary-selection-unstable-v1.c \
-             wayland.c"
-      AC_SUBST(WAYLAND_SRC)
-      WAYLAND_OBJ=" \
-             objects/wlr-data-control-unstable-v1.o \
-             objects/ext-data-control-v1.o \
-             objects/xdg-shell.o \
-             objects/primary-selection-unstable-v1.o \
-             objects/wayland.o"
-      AC_SUBST(WAYLAND_OBJ)
-
-    else
-      with_wayland=no
-    fi
+    AC_MSG_RESULT(no)
+    with_wayland=no
   fi
-else
-  AC_MSG_RESULT(no)
+CFLAGS=$cflags_save
 fi
 
 test -z "$with_x" && with_x=yes
index 31443f9168f702d323060637c4988382e43f0454..d7c183f07afacf17d5a8b46ae59bd2f9cff227b8 100644 (file)
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1561,
 /**/
     1560,
 /**/