summaryrefslogtreecommitdiff
path: root/src/contrib/SDL-2.30.2/cmake/test/test_sdlconfig.sh
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2024-05-04 16:51:29 -0700
committer3gg <3gg@shellblade.net>2024-05-04 16:51:29 -0700
commit8222bfe56d4dabe8d92fc4b25ea1b0163b16f3e1 (patch)
tree763389e42276035ac134d94eb1dc32293b88d807 /src/contrib/SDL-2.30.2/cmake/test/test_sdlconfig.sh
Initial commit.
Diffstat (limited to 'src/contrib/SDL-2.30.2/cmake/test/test_sdlconfig.sh')
-rwxr-xr-xsrc/contrib/SDL-2.30.2/cmake/test/test_sdlconfig.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/contrib/SDL-2.30.2/cmake/test/test_sdlconfig.sh b/src/contrib/SDL-2.30.2/cmake/test/test_sdlconfig.sh
new file mode 100755
index 0000000..fa41dbb
--- /dev/null
+++ b/src/contrib/SDL-2.30.2/cmake/test/test_sdlconfig.sh
@@ -0,0 +1,51 @@
1#!/bin/sh
2
3if test "x$CC" = "x"; then
4 CC=cc
5fi
6
7machine="$($CC -dumpmachine)"
8case "$machine" in
9 *mingw* )
10 EXEPREFIX=""
11 EXESUFFIX=".exe"
12 ;;
13 *android* )
14 EXEPREFIX="lib"
15 EXESUFFIX=".so"
16 LDFLAGS="$LDFLAGS -shared"
17 ;;
18 * )
19 EXEPREFIX=""
20 EXESUFFIX=""
21 ;;
22esac
23
24set -e
25
26# Get the canonical path of the folder containing this script
27testdir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
28SDL_CFLAGS="$( sdl2-config --cflags )"
29SDL_LDFLAGS="$( sdl2-config --libs )"
30SDL_STATIC_LDFLAGS="$( sdl2-config --static-libs )"
31
32compile_cmd="$CC -c "$testdir/main_gui.c" -o main_gui_sdlconfig.c.o $CFLAGS $SDL_CFLAGS"
33link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig${EXESUFFIX} $SDL_LDFLAGS $LDFLAGS"
34static_link_cmd="$CC main_gui_sdlconfig.c.o -o ${EXEPREFIX}main_gui_sdlconfig_static${EXESUFFIX} $SDL_STATIC_LDFLAGS $LDFLAGS"
35
36echo "-- CC: $CC"
37echo "-- CFLAGS: $CFLAGS"
38echo "-- LDFLAGS: $LDFLAGS"
39echo "-- SDL_CFLAGS: $SDL_CFLAGS"
40echo "-- SDL_LDFLAGS: $SDL_LDFLAGS"
41echo "-- SDL_STATIC_LDFLAGS: $SDL_STATIC_LDFLAGS"
42
43echo "-- COMPILE: $compile_cmd"
44echo "-- LINK: $link_cmd"
45echo "-- STATIC_LINK: $static_link_cmd"
46
47set -x
48
49$compile_cmd
50$link_cmd
51$static_link_cmd