Skip to content

Commit 138381b

Browse files
dezzachrisbra
authored andcommitted
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>
1 parent 861dade commit 138381b

5 files changed

Lines changed: 72 additions & 147 deletions

File tree

src/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3646,19 +3646,19 @@ objects/window.o: window.c
36463646
$(CCC) -o $@ window.c
36473647

36483648
objects/wayland.o: wayland.c
3649-
$(CCC) -o $@ wayland.c
3649+
$(CCC) $(WAYLAND_CFLAGS) -o $@ wayland.c
36503650

36513651
objects/wlr-data-control-unstable-v1.o: auto/wayland/wlr-data-control-unstable-v1.c
3652-
$(CCC) -o $@ auto/wayland/wlr-data-control-unstable-v1.c
3652+
$(CCC) $(WAYLAND_CFLAGS) -o $@ auto/wayland/wlr-data-control-unstable-v1.c
36533653

36543654
objects/ext-data-control-v1.o: auto/wayland/ext-data-control-v1.c
3655-
$(CCC) -o $@ auto/wayland/ext-data-control-v1.c
3655+
$(CCC) $(WAYLAND_CFLAGS) -o $@ auto/wayland/ext-data-control-v1.c
36563656

36573657
objects/xdg-shell.o: auto/wayland/xdg-shell.c
3658-
$(CCC) -o $@ auto/wayland/xdg-shell.c
3658+
$(CCC) $(WAYLAND_CFLAGS) -o $@ auto/wayland/xdg-shell.c
36593659

36603660
objects/primary-selection-unstable-v1.o: auto/wayland/primary-selection-unstable-v1.c
3661-
$(CCC) -o $@ auto/wayland/primary-selection-unstable-v1.c
3661+
$(CCC) $(WAYLAND_CFLAGS) -o $@ auto/wayland/primary-selection-unstable-v1.c
36623662

36633663
objects/netbeans.o: netbeans.c
36643664
$(CCC) -o $@ netbeans.c

src/auto/configure

Lines changed: 33 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ xmkmfpath
678678
WAYLAND_OBJ
679679
WAYLAND_SRC
680680
WAYLAND_LIBS
681+
WAYLAND_CFLAGS
681682
TERM_TEST
682683
TERM_OBJ
683684
TERM_SRC
@@ -9213,120 +9214,49 @@ printf %s "checking --with-wayland argument... " >&6; }
92139214
# Check whether --with-wayland was given.
92149215
if test ${with_wayland+y}
92159216
then :
9216-
withval=$with_wayland;
9217-
fi
9218-
9219-
9220-
test -z "$with_wayland" && with_wayland=yes
9221-
if test "$with_wayland" = yes; then
9222-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
9223-
printf "%s\n" "yes" >&6; }
9224-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if Wayland client header files can be found" >&5
9225-
printf %s "checking if Wayland client header files can be found... " >&6; }
9226-
cppflags_save=$CPPFLAGS
9227-
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9228-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9229-
/* end confdefs.h. */
9230-
#include <wayland-client.h>
9231-
int
9232-
main (void)
9233-
{
9234-
9235-
;
9236-
return 0;
9237-
}
9238-
_ACEOF
9239-
if ac_fn_c_try_compile "$LINENO"
9240-
then :
9241-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
9242-
printf "%s\n" "yes" >&6; }
9217+
withval=$with_wayland; with_wayland=$withval
92439218
else case e in #(
9244-
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
9245-
printf "%s\n" "no" >&6; }; no_wl=yes ;;
9219+
e) with_wayland=yes ;;
92469220
esac
92479221
fi
9248-
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
9249-
CPPFLAGS=$cppflags_save
92509222

9251-
if test "$no_wl" = yes; then
9252-
with_wayland=no
9253-
else
9254-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wl_display_connect in -lwayland-client" >&5
9255-
printf %s "checking for wl_display_connect in -lwayland-client... " >&6; }
9256-
if test ${ac_cv_lib_wayland_client_wl_display_connect+y}
9257-
then :
9258-
printf %s "(cached) " >&6
9259-
else case e in #(
9260-
e) ac_check_lib_save_LIBS=$LIBS
9261-
LIBS="-lwayland-client $LIBS"
9262-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9263-
/* end confdefs.h. */
9223+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_wayland" >&5
9224+
printf "%s\n" "$with_wayland" >&6; }
92649225

9265-
/* Override any GCC internal prototype to avoid an error.
9266-
Use char because int might match the return type of a GCC
9267-
builtin and then its argument prototype would still apply.
9268-
The 'extern "C"' is for builds by C++ compilers;
9269-
although this is not generally supported in C code supporting it here
9270-
has little cost and some practical benefit (sr 110532). */
9271-
#ifdef __cplusplus
9272-
extern "C"
9273-
#endif
9274-
char wl_display_connect (void);
9275-
int
9276-
main (void)
9277-
{
9278-
return wl_display_connect ();
9279-
;
9280-
return 0;
9281-
}
9282-
_ACEOF
9283-
if ac_fn_c_try_link "$LINENO"
9284-
then :
9285-
ac_cv_lib_wayland_client_wl_display_connect=yes
9286-
else case e in #(
9287-
e) ac_cv_lib_wayland_client_wl_display_connect=no ;;
9288-
esac
9289-
fi
9290-
rm -f core conftest.err conftest.$ac_objext conftest.beam \
9291-
conftest$ac_exeext conftest.$ac_ext
9292-
LIBS=$ac_check_lib_save_LIBS ;;
9293-
esac
9294-
fi
9295-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_wayland_client_wl_display_connect" >&5
9296-
printf "%s\n" "$ac_cv_lib_wayland_client_wl_display_connect" >&6; }
9297-
if test "x$ac_cv_lib_wayland_client_wl_display_connect" = xyes
9298-
then :
9299-
no_wl=no
9300-
fi
9301-
9302-
9303-
if test "$no_wl" = no; then
9304-
printf "%s\n" "#define HAVE_WAYLAND 1" >>confdefs.h
9226+
if test "$with_wayland" = yes; then
9227+
cflags_save=$CFLAGS
9228+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wayland" >&5
9229+
printf %s "checking for wayland... " >&6; }
9230+
if "$PKG_CONFIG" --exists 'wayland-client'; then
9231+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
9232+
printf "%s\n" "yes" >&6; }
9233+
printf "%s\n" "#define HAVE_WAYLAND 1" >>confdefs.h
93059234

9306-
WAYLAND_LIBS="-lwayland-client";
9235+
WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client`
9236+
CFLAGS="$CFLAGS $WAYLAND_CFLAGS"
9237+
WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client`
9238+
WAYLAND_SRC=" \
9239+
auto/wayland/wlr-data-control-unstable-v1.c \
9240+
auto/wayland/ext-data-control-v1.c \
9241+
auto/wayland/xdg-shell.c \
9242+
auto/wayland/primary-selection-unstable-v1.c \
9243+
wayland.c"
9244+
WAYLAND_OBJ=" \
9245+
objects/wlr-data-control-unstable-v1.o \
9246+
objects/ext-data-control-v1.o \
9247+
objects/xdg-shell.o \
9248+
objects/primary-selection-unstable-v1.o \
9249+
objects/wayland.o"
93079250

9308-
WAYLAND_SRC=" \
9309-
auto/wayland/wlr-data-control-unstable-v1.c \
9310-
auto/wayland/ext-data-control-v1.c \
9311-
auto/wayland/xdg-shell.c \
9312-
auto/wayland/primary-selection-unstable-v1.c \
9313-
wayland.c"
93149251

9315-
WAYLAND_OBJ=" \
9316-
objects/wlr-data-control-unstable-v1.o \
9317-
objects/ext-data-control-v1.o \
9318-
objects/xdg-shell.o \
9319-
objects/primary-selection-unstable-v1.o \
9320-
objects/wayland.o"
93219252

93229253

9323-
else
9324-
with_wayland=no
9325-
fi
9326-
fi
9327-
else
9328-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
9254+
else
9255+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
93299256
printf "%s\n" "no" >&6; }
9257+
with_wayland=no
9258+
fi
9259+
CFLAGS=$cflags_save
93309260
fi
93319261

93329262
test -z "$with_x" && with_x=yes

src/config.mk.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ X_LIBS = @X_LIB@
4040
WAYLAND_LIBS = @WAYLAND_LIBS@
4141
WAYLAND_SRC = @WAYLAND_SRC@
4242
WAYLAND_OBJ = @WAYLAND_OBJ@
43+
WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
4344

4445
XDIFF_OBJS_USED = @XDIFF_OBJS_USED@
4546

src/configure.ac

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,49 +2406,41 @@ CPPFLAGS=$cppflags_save
24062406

24072407
AC_MSG_CHECKING(--with-wayland argument)
24082408
AC_ARG_WITH(wayland,
2409-
[ --with-wayland Include support for the Wayland protocol.])
2409+
[ --with-wayland Include support for the Wayland protocol.],
2410+
[with_wayland=$withval],
2411+
[with_wayland=yes])
2412+
AC_MSG_RESULT([$with_wayland])
24102413

2411-
test -z "$with_wayland" && with_wayland=yes
24122414
if test "$with_wayland" = yes; then
2413-
AC_MSG_RESULT(yes)
2414-
AC_MSG_CHECKING(if Wayland client header files can be found)
2415-
cppflags_save=$CPPFLAGS
2416-
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
2417-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <wayland-client.h>], )],
2418-
AC_MSG_RESULT(yes),
2419-
AC_MSG_RESULT(no); no_wl=yes)
2420-
CPPFLAGS=$cppflags_save
2421-
2422-
if test "$no_wl" = yes; then
2423-
with_wayland=no
2415+
cflags_save=$CFLAGS
2416+
AC_MSG_CHECKING(for wayland)
2417+
if "$PKG_CONFIG" --exists 'wayland-client'; then
2418+
AC_MSG_RESULT([yes])
2419+
AC_DEFINE(HAVE_WAYLAND)
2420+
WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client`
2421+
CFLAGS="$CFLAGS $WAYLAND_CFLAGS"
2422+
WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client`
2423+
WAYLAND_SRC=" \
2424+
auto/wayland/wlr-data-control-unstable-v1.c \
2425+
auto/wayland/ext-data-control-v1.c \
2426+
auto/wayland/xdg-shell.c \
2427+
auto/wayland/primary-selection-unstable-v1.c \
2428+
wayland.c"
2429+
WAYLAND_OBJ=" \
2430+
objects/wlr-data-control-unstable-v1.o \
2431+
objects/ext-data-control-v1.o \
2432+
objects/xdg-shell.o \
2433+
objects/primary-selection-unstable-v1.o \
2434+
objects/wayland.o"
2435+
AC_SUBST(WAYLAND_CFLAGS)
2436+
AC_SUBST(WAYLAND_LIBS)
2437+
AC_SUBST(WAYLAND_SRC)
2438+
AC_SUBST(WAYLAND_OBJ)
24242439
else
2425-
AC_CHECK_LIB(wayland-client, wl_display_connect,[no_wl=no])
2426-
2427-
if test "$no_wl" = no; then
2428-
AC_DEFINE(HAVE_WAYLAND)
2429-
WAYLAND_LIBS="-lwayland-client";
2430-
AC_SUBST(WAYLAND_LIBS)
2431-
WAYLAND_SRC=" \
2432-
auto/wayland/wlr-data-control-unstable-v1.c \
2433-
auto/wayland/ext-data-control-v1.c \
2434-
auto/wayland/xdg-shell.c \
2435-
auto/wayland/primary-selection-unstable-v1.c \
2436-
wayland.c"
2437-
AC_SUBST(WAYLAND_SRC)
2438-
WAYLAND_OBJ=" \
2439-
objects/wlr-data-control-unstable-v1.o \
2440-
objects/ext-data-control-v1.o \
2441-
objects/xdg-shell.o \
2442-
objects/primary-selection-unstable-v1.o \
2443-
objects/wayland.o"
2444-
AC_SUBST(WAYLAND_OBJ)
2445-
2446-
else
2447-
with_wayland=no
2448-
fi
2440+
AC_MSG_RESULT(no)
2441+
with_wayland=no
24492442
fi
2450-
else
2451-
AC_MSG_RESULT(no)
2443+
CFLAGS=$cflags_save
24522444
fi
24532445

24542446
test -z "$with_x" && with_x=yes

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ static char *(features[]) =
719719

720720
static int included_patches[] =
721721
{ /* Add new patch number below this line */
722+
/**/
723+
1561,
722724
/**/
723725
1560,
724726
/**/

0 commit comments

Comments
 (0)