-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.sh
executable file
·112 lines (92 loc) · 2.1 KB
/
config.sh
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
#!/bin/sh
id='$Id: config.sh,v 1.11 2005/12/05 01:08:39 sec Exp $'
echo '*** Welcome to the configuration checker for brillion (V0.1)'
echo ''
if [ "$1" = "rerun" ] ; then
shift
if [ -r .config ] ; then
echo -n
fi
fi
### Read commandline options
while [ $# -gt 0 ] ; do
case $1 in
profile) PROFILE=yes;;
sound) SOUND=yes;;
nosound) SOUND=no;;
optimize) OPTIMIZE=yes;;
pedantic) PEDANTIC=yes;;
devel) DEVEL=yes;;
save) SAVE=yes;;
windows) WINDOWS=yes;;
nowindows) WINDOWS=no;;
--help|help|-h)
echo "Usage: ./config.sh [options]"
echo " profile Compiles a binary with profiling support"
echo " optimize Compiles a more optimized binary"
echo " pedantic Turns on a lot of Warnings"
echo ""
echo " [no]sound Forces sound support on or off"
echo " devel devel support (semi-cheats)"
echo " [no]windows add windows icon/resources"
echo ""
exit 1;;
*) echo "Error: Unknown option $1";exit 1;;
esac
echo "Option $1 enabled"
shift
done
### Check for sdl-config
echo -n "looking for sdl-config ... "
[ -z "$SDL_CONFIG" ] && {
sdl11-config --version && SDL_CONFIG=sdl11-config
sdl-config --version && SDL_CONFIG=sdl-config
} >/dev/null 2>&1
if [ -z "$SDL_CONFIG" ] ; then
echo Not found
exit 1
else
echo $SDL_CONFIG
fi
### Check for windows
if [ -z "$WINDOWS" ] ; then
echo -n "checking for windows extras ... "
WINDOWS=NO
case `uname` in
CYGWIN*) WINDOWS=YES;;
esac
echo $WINDOWS
fi
### Check for sound
if [ -z "$SOUND" ] ; then
echo -n "checking for sound lib ... "
set -- `$SDL_CONFIG --libs`
for a in $* ; do
case $a in
-L*) libpath=${a#-L};;
esac
done
if [ -z "$libpath" ] ; then
SOUND=NO
else
if [ ! -f "$libpath/libSDL_mixer.a" ] ; then
SOUND=NO
else
SOUND=YES
fi
fi
echo $SOUND
fi
### End of checks, write .config
[ "$SOUND" = "NO" ] && unset SOUND
[ "$WINDOWS" = "NO" ] && unset WINDOWS
:>.config
for a in SDL_CONFIG PROFILE SOUND OPTIMIZE PEDANTIC WINDOWS DEVEL; do
eval "[ -z "\$$a" ] || echo \"$a=\$$a\"" >>.config
done
for a in SAVE; do
eval "[ -z "\$$a" ] || echo \"CFLAGS+=-D$a\"" >>.config
done
echo ''
echo '*** Configuration sucessfully created'
echo ''