configure: improvements to libdecor discovery :

use PKG_CHECK_MODULES, and use DECOR_LIB with find_lib.
Closes: https://github.com/libsdl-org/SDL/pull/5460

Co-authored-by: Trigan2025 <trigan2025@hotmail.fr>
This commit is contained in:
Ozkan Sezer 2022-03-27 11:56:40 +03:00
parent 713a675401
commit a630b02938
2 changed files with 87 additions and 28 deletions

93
configure vendored
View File

@ -673,6 +673,8 @@ X_CFLAGS
XMKMF XMKMF
RPI_LIBS RPI_LIBS
RPI_CFLAGS RPI_CFLAGS
DECOR_LIBS
DECOR_CFLAGS
FUSIONSOUND_LIBS FUSIONSOUND_LIBS
FUSIONSOUND_CFLAGS FUSIONSOUND_CFLAGS
ARTSCONFIG ARTSCONFIG
@ -944,6 +946,8 @@ PULSEAUDIO_CFLAGS
PULSEAUDIO_LIBS PULSEAUDIO_LIBS
FUSIONSOUND_CFLAGS FUSIONSOUND_CFLAGS
FUSIONSOUND_LIBS FUSIONSOUND_LIBS
DECOR_CFLAGS
DECOR_LIBS
RPI_CFLAGS RPI_CFLAGS
RPI_LIBS RPI_LIBS
XMKMF XMKMF
@ -1779,6 +1783,9 @@ Some influential environment variables:
C compiler flags for FUSIONSOUND, overriding pkg-config C compiler flags for FUSIONSOUND, overriding pkg-config
FUSIONSOUND_LIBS FUSIONSOUND_LIBS
linker flags for FUSIONSOUND, overriding pkg-config linker flags for FUSIONSOUND, overriding pkg-config
DECOR_CFLAGS
C compiler flags for DECOR, overriding pkg-config
DECOR_LIBS linker flags for DECOR, overriding pkg-config
RPI_CFLAGS C compiler flags for RPI, overriding pkg-config RPI_CFLAGS C compiler flags for RPI, overriding pkg-config
RPI_LIBS linker flags for RPI, overriding pkg-config RPI_LIBS linker flags for RPI, overriding pkg-config
XMKMF Path to xmkmf, Makefile generator for X Window System XMKMF Path to xmkmf, Makefile generator for X Window System
@ -20676,17 +20683,79 @@ else
fi fi
if test x$enable_libdecor = xyes; then if test x$enable_libdecor = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdecor support" >&5
$as_echo_n "checking for libdecor support... " >&6; } pkg_failed=no
if $PKG_CONFIG --exists libdecor-0; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdecor-0" >&5
video_libdecor=yes $as_echo_n "checking for libdecor-0... " >&6; }
if test -n "$DECOR_CFLAGS"; then
pkg_cv_DECOR_CFLAGS="$DECOR_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdecor-0\""; } >&5
($PKG_CONFIG --exists --print-errors "libdecor-0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_DECOR_CFLAGS=`$PKG_CONFIG --cflags "libdecor-0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else else
video_libdecor=no pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$DECOR_LIBS"; then
pkg_cv_DECOR_LIBS="$DECOR_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdecor-0\""; } >&5
($PKG_CONFIG --exists --print-errors "libdecor-0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_DECOR_LIBS=`$PKG_CONFIG --libs "libdecor-0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
DECOR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdecor-0" 2>&1`
else
DECOR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdecor-0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$DECOR_PKG_ERRORS" >&5
video_libdecor=no
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
video_libdecor=no
else
DECOR_CFLAGS=$pkg_cv_DECOR_CFLAGS
DECOR_LIBS=$pkg_cv_DECOR_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
video_libdecor=yes
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_libdecor" >&5
$as_echo "$video_libdecor" >&6; }
if test x$video_libdecor = xyes; then if test x$video_libdecor = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags libdecor-0`" EXTRA_CFLAGS="$EXTRA_CFLAGS $DECOR_CFLAGS"
$as_echo "#define HAVE_LIBDECOR_H 1" >>confdefs.h $as_echo "#define HAVE_LIBDECOR_H 1" >>confdefs.h
@ -20699,18 +20768,16 @@ else
fi fi
decor_lib=`find_lib "libdecor-0.so.*" "$DECOR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
if test x$enable_wayland_shared != xyes; then if test x$enable_wayland_shared != xyes; then
enable_libdecor_shared=no enable_libdecor_shared=no
fi fi
decor_lib=`find_lib "libdecor-0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`
if test x$have_loadso != xyes && \ if test x$have_loadso != xyes && \
test x$enable_libdecor_shared = xyes; then test x$enable_libdecor_shared = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&5
$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&2;} $as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&2;}
fi fi
if test x$have_loadso = xyes && \ if test x$have_loadso = xyes && \
test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then
echo "-- dynamic libdecor -> $decor_lib" echo "-- dynamic libdecor -> $decor_lib"
@ -20720,7 +20787,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
else else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs libdecor-0`" EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS"
fi fi
fi fi
fi fi

View File

@ -1626,39 +1626,31 @@ dnl FIXME: Do BSD and OS X need special cases?
dnl See if libdecor is available dnl See if libdecor is available
AC_ARG_ENABLE(libdecor, AC_ARG_ENABLE(libdecor,
[AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])], [AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])],, enable_libdecor=yes)
, enable_libdecor=yes)
if test x$enable_libdecor = xyes; then if test x$enable_libdecor = xyes; then
AC_MSG_CHECKING(for libdecor support) PKG_CHECK_MODULES([DECOR], [libdecor-0], video_libdecor=yes, video_libdecor=no)
AS_IF([$PKG_CONFIG --exists libdecor-0],
[video_libdecor=yes],
[video_libdecor=no])
AC_MSG_RESULT($video_libdecor)
if test x$video_libdecor = xyes; then if test x$video_libdecor = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags libdecor-0`" EXTRA_CFLAGS="$EXTRA_CFLAGS $DECOR_CFLAGS"
AC_DEFINE(HAVE_LIBDECOR_H, 1, [ ]) AC_DEFINE(HAVE_LIBDECOR_H, 1, [ ])
AC_ARG_ENABLE(libdecor-shared, AC_ARG_ENABLE(libdecor-shared,
[AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=yes]])], [AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=yes]])],, enable_libdecor_shared=yes)
, enable_libdecor_shared=yes)
decor_lib=[`find_lib "libdecor-0.so.*" "$DECOR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
if test x$enable_wayland_shared != xyes; then if test x$enable_wayland_shared != xyes; then
enable_libdecor_shared=no enable_libdecor_shared=no
fi fi
decor_lib=[`find_lib "libdecor-0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
if test x$have_loadso != xyes && \ if test x$have_loadso != xyes && \
test x$enable_libdecor_shared = xyes; then test x$enable_libdecor_shared = xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libdecor loading]) AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libdecor loading])
fi fi
if test x$have_loadso = xyes && \ if test x$have_loadso = xyes && \
test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then
echo "-- dynamic libdecor -> $decor_lib" echo "-- dynamic libdecor -> $decor_lib"
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR, "$decor_lib", [ ]) AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR, "$decor_lib", [ ])
else else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs libdecor-0`" EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS"
fi fi
fi fi
fi fi