]> git.zerfleddert.de Git - micropolis/blob - src/sim/sdl_helper
add ugly sdl_helper to automagically find and enable SDL_mixer
[micropolis] / src / sim / sdl_helper
1 #!/bin/sh
2
3 SDLINCLUDE="`pkg-config --cflags sdl 2>/dev/null`"
4 SDLLIBS="`pkg-config --libs sdl 2>/dev/null`"
5
6 found=0
7
8 if echo '#include <SDL_mixer.h>'|(cpp ${SDLINCLUDE}) >/dev/null 2>&1; then
9 found=1
10 else
11 for flag in ${SDLINCLUDE}; do
12 if echo "${flag}" | grep '^-I' >/dev/null 2>&1; then
13 sdlpath="$(echo "${flag}"| sed -e 's/^-I//')"
14 if [ -f "${sdlpath}/SDL_mixer.h" ]; then
15 found=1
16 break
17 fi
18 fi
19 done
20 fi
21
22 if [ "${found}" = "1" ]; then
23 SDLINCLUDE="${SDLINCLUDE} -DWITH_SDL_MIXER"
24 SDLLIBS="${SDLLIBS} -lSDL_mixer"
25 else
26 found=0
27
28 for sdlpath in /usr /usr/local /opt/local /opt/csw /sw; do
29 if [ -f "${sdlpath}/include/SDL/SDL_mixer.h" ]; then
30 SDLINCLUDE="${SDLINCLUDE} -I${sdlpath}/include/SDL -DWITH_SDL_MIXER"
31 SDLLIBS="${SDLLIBS} -L${sdlpath}/lib -lSDL -lSDL_mixer"
32
33 found=1
34 break
35 fi
36 done
37
38 if [ "${found}" = "0" ]; then
39 SDLINCLUDE=""
40 SDLLIBS=""
41 fi
42 fi
43
44 if [ "${1}" = "cflags" ]; then
45 echo "${SDLINCLUDE}"
46 elif [ "${1}" = "libs" ]; then
47 echo "${SDLLIBS}"
48 fi
Impressum, Datenschutz