0
0
mirror of https://github.com/vim/vim.git synced 2025-10-24 08:54:47 -04:00

patch 9.1.1561: configure: wayland test can be improved

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>
This commit is contained in:
Christoffer Aasted
2025-07-17 21:11:06 +02:00
committed by Christian Brabandt
parent 861dade4e3
commit 138381bde0
5 changed files with 74 additions and 149 deletions

View 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

140
src/auto/configure vendored
View File

@@ -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;
withval=$with_wayland; with_wayland=$withval
else case e in #(
e) with_wayland=yes ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_wayland" >&5
printf "%s\n" "$with_wayland" >&6; }
test -z "$with_wayland" && with_wayland=yes
if test "$with_wayland" = yes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
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" "$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)
{
printf "%s\n" "#define HAVE_WAYLAND 1" >>confdefs.h
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"
;
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; }
else case e in #(
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }; no_wl=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. */
/* 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
WAYLAND_LIBS="-lwayland-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"
else
with_wayland=no
fi
fi
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
{ 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

View 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@

View 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

View File

@@ -719,6 +719,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1561,
/**/
1560,
/**/