Skip to content

Commit ffc6b35

Browse files
committed
SDL: fall back to non-static libs when not available smallbasic#176
1 parent c3d0c17 commit ffc6b35

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

configure.ac

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,23 @@ function buildSDL() {
212212

213213
(cd images && xxd -i sb-desktop-128x128.png > ../src/platform/sdl/icon.h)
214214

215+
HAVE_SDL2_STATIC=yes
216+
AC_MSG_CHECKING([if installed SDL2 supports static libs])
217+
AC_PATH_PROGS_FEATURE_CHECK([SDL2_STATIC_TMP], [sdl2-config],
218+
AS_IF([`"$ac_path_SDL2_STATIC_TMP" --static-libs 2>&1 | sed '/Usage/!{q1};' > /dev/null`], [HAVE_SDL2_STATIC=no]))
219+
AC_MSG_RESULT([$HAVE_SDL2_STATIC])
220+
221+
if test "x$HAVE_SDL2_STATIC" = "xno"; then
222+
SDL_LIBS=`sdl2-config --libs`
223+
else
224+
SDL_LIBS=`sdl2-config --static-libs`
225+
fi
226+
215227
dnl backlinking support for modules
216228
PACKAGE_LIBS="${PACKAGE_LIBS} -ldl -no-pie"
217229
PACKAGE_LIBS="${PACKAGE_LIBS} ${FONTCONFIG_LIBS}"
218-
PACKAGE_LIBS="-static-libgcc ${PACKAGE_LIBS} `sdl2-config --static-libs` `pkg-config freetype2 --libs`"
230+
231+
PACKAGE_LIBS="-static-libgcc ${PACKAGE_LIBS} ${SDL_LIBS} `pkg-config freetype2 --libs`"
219232
esac
220233

221234
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} `sdl2-config --cflags` `pkg-config freetype2 --cflags` -fno-exceptions"

src/platform/sdl/runtime.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,10 +714,13 @@ void Runtime::saveWindowRect() {
714714
//
715715
// System platform methods
716716
//
717+
#pragma GCC diagnostic push
718+
#pragma GCC diagnostic ignored "-Wint-in-bool-context"
717719
bool System::getPen3() {
718720
SDL_PumpEvents();
719721
return (SDL_BUTTON(SDL_BUTTON_LEFT) && SDL_GetMouseState(&_touchCurX, &_touchCurY));
720722
}
723+
#pragma GCC diagnostic pop
721724

722725
void System::completeKeyword(int index) const {
723726
if (get_focus_edit() && isEditing()) {

0 commit comments

Comments
 (0)