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>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
diff --git a/configure b/configure
index c90517e..7611d78 100755
--- a/configure
+++ b/configure
@@ -673,6 +673,8 @@ X_CFLAGS
XMKMF
RPI_LIBS
RPI_CFLAGS
+DECOR_LIBS
+DECOR_CFLAGS
FUSIONSOUND_LIBS
FUSIONSOUND_CFLAGS
ARTSCONFIG
@@ -944,6 +946,8 @@ PULSEAUDIO_CFLAGS
PULSEAUDIO_LIBS
FUSIONSOUND_CFLAGS
FUSIONSOUND_LIBS
+DECOR_CFLAGS
+DECOR_LIBS
RPI_CFLAGS
RPI_LIBS
XMKMF
@@ -1779,6 +1783,9 @@ Some influential environment variables:
C compiler flags for FUSIONSOUND, overriding pkg-config
FUSIONSOUND_LIBS
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_LIBS linker flags for RPI, overriding pkg-config
XMKMF Path to xmkmf, Makefile generator for X Window System
@@ -20676,17 +20683,79 @@ else
fi
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; }
- if $PKG_CONFIG --exists libdecor-0; then :
- video_libdecor=yes
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdecor-0" >&5
+$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
- 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
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_libdecor" >&5
-$as_echo "$video_libdecor" >&6; }
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
@@ -20699,18 +20768,16 @@ else
fi
+ decor_lib=`find_lib "libdecor-0.so.*" "$DECOR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+
if test x$enable_wayland_shared != xyes; then
enable_libdecor_shared=no
fi
-
- decor_lib=`find_lib "libdecor-0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`
-
if test x$have_loadso != xyes && \
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: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&2;}
fi
-
if test x$have_loadso = xyes && \
test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then
echo "-- dynamic libdecor -> $decor_lib"
@@ -20720,7 +20787,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
else
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs libdecor-0`"
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS"
fi
fi
fi
diff --git a/configure.ac b/configure.ac
index 25b6e9e..1d96004 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1626,39 +1626,31 @@ dnl FIXME: Do BSD and OS X need special cases?
dnl See if libdecor is available
AC_ARG_ENABLE(libdecor,
-[AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])],
- , enable_libdecor=yes)
+[AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])],, enable_libdecor=yes)
if test x$enable_libdecor = xyes; then
- AC_MSG_CHECKING(for libdecor support)
- AS_IF([$PKG_CONFIG --exists libdecor-0],
- [video_libdecor=yes],
- [video_libdecor=no])
- AC_MSG_RESULT($video_libdecor)
+ PKG_CHECK_MODULES([DECOR], [libdecor-0], video_libdecor=yes, video_libdecor=no)
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_ARG_ENABLE(libdecor-shared,
-[AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=yes]])],
- , enable_libdecor_shared=yes)
+[AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=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
enable_libdecor_shared=no
fi
-
- decor_lib=[`find_lib "libdecor-0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
-
if test x$have_loadso != xyes && \
test x$enable_libdecor_shared = xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libdecor loading])
fi
-
if test x$have_loadso = xyes && \
test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then
echo "-- dynamic libdecor -> $decor_lib"
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR, "$decor_lib", [ ])
else
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs libdecor-0`"
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS"
fi
fi
fi