-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
185 lines (169 loc) · 6.15 KB
/
configure
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
#!/bin/sh
##
# configure
# Copyright (C) 2011 - 2013 Peter Belkner <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
configure="${0}"
srcdir=`dirname "${0}"|sed -e 's,/$,,g'`
pfx=/usr/local
tooldir='$(PWD)/tools'
unpackdir='$(PWD)/unpack'
reldir='$(PWD)/release'
msvs='C:/Program Files (x86)/Microsoft Visual Studio 12.0'
mssdk='C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A'
#wasdk='D:/Programme/Winamp SDK'
wasdk='C:/Program Files (x86)/Winamp SDK'
nsis='C:/Program Files (x86)/NSIS'
#winamp='C:/Program Files (x86)/Winamp'
enable_static='yes'
enable_shared='yes'
enable_examples='no'
cflags='-MT -WX -O2'
cppflags='-D_USING_V110_SDK71_'
###############################################################################
help() {
echo "usage: ${configure} <options>"
echo
echo "options (selection):"
echo " --help: display this message"
echo " '--with-msvs=<path to ms visual studio installation>'"
echo " default: \"${msvs}\""
echo " '--with-mssdk=<path to ms windows sdk installation>'"
echo " default: \"${mssdk}\""
echo " '--with-wasdk=<path to winamp sdk installation>'"
echo " default: \"${wasdk}\""
echo " '--with-nsis=<path to nsis installation>'"
echo " default: \"${nsis}\""
echo " CPPFLAGS=<CPPFLAGS> flags passed to the C pre-processor"
echo " (and the resource compiler)"
echo " default: \"${cppflags}\""
echo " CFLAGS=<CFLAGS> flags passed to the C compiler"
echo " default: \"${cflags}\""
}
###############################################################################
oss="linux mingw"
for i in $oss; do
if test 1 -eq `uname|grep -i $i|wc -l`; then os=$i; fi
done
if [ 'x' = "x${os}" ]; then "Error: OS not supported."; exit 1; fi
###############################################################################
helpx() {
echo "Usage: $0 [OPTION]... [VAR=VALUE]..."
exit $1
}
extract() {
echo "$1"|sed -e "s/$2=//g"
}
extract_enable() {
case `echo "$1"|sed -e "s/--enable-$2//g"` in
'') echo "yes" ;;
=yes) echo "yes" ;;
=no) echo "no" ;;
*) help 1 ;;
esac
}
extract_disable() {
case `echo "$1"|sed -e "s/--disable-$2//g"` in
'') echo "no" ;;
=yes) echo "no" ;;
=no) echo "yes" ;;
*) help 1 ;;
esac
}
while test "$1" != ''; do
case $1 in
--help) help 0 ;;
--prefix=*) pfx=`extract "$1" '--prefix'` ;;
--bindir=*) bindir=`extract "$1" '--bindir'` ;;
--libdir=*) libdir=`extract "$1" '--libdir'` ;;
--includedir=*) includedir=`extract "$1" '--includedir'` ;;
--reldir=*) reldir=`extract "$1" '--reldir'` ;;
--host=*) host=`extract "$1" '--host'` ;;
--tooldir=*) tooldir=`extract "$1" '--tooldir'` ;;
--unpackdir=*) unpackdir=`extract "$1" '--unpackdir'` ;;
--enable-static*) enable_static=`extract_enable "$1" 'static'` ;;
--disable-static*) enable_static=`extract_disable "$1" 'static'` ;;
--enable-shared*) enable_shared=`extract_enable "$1" 'shared'` ;;
--disable-shared*) enable_shared=`extract_disable "$1" 'shared'` ;;
--enable-examples*) enable_examples=`extract_enable "$1" 'examples'` ;;
--disable-examples*) enable_examples=`extract_disable "$1" 'examples'` ;;
--with-msvs=*) msvs=`extract "$1" '--with-msvs'` ;;
--with-mssdk=*) mssdk=`extract "$1" '--with-mssdk'` ;;
--with-wasdk=*) wasdk=`extract "$1" '--with-wasdk'` ;;
--with-nsis=*) nsis=`extract "$1" '--with-nsis'` ;;
# --with-winamp=*) winamp=`extract "$1" '--with-winamp'` ;;
CFLAGS=*) cflags=`extract "$1" 'CFLAGS'` ;;
CPPFLAGS=*) cppflags=`extract "$1" 'CPPFLAGS'` ;;
LDFLAGS=*) ldflags=`extract "$1" 'LDFLAGS'` ;;
LIBS=*) libs=`extract "$1" 'LIBS'` ;;
NSIS_HOME=*) nsis_home=`extract "$1" 'NSIS_HOME'` ;;
*) echo "Error: Unknow option: $1."; help 1 ;;
esac
shift
done
###############################################################################
normpath() {
if test 'x' = "x$1" -o "." = "$1"; then
echo "$PWD"
else
echo "$1"|sed -e "s,^\([^/]\),$PWD/\1,g"
fi
}
pfx=`normpath "$pfx"`
srcdir=`normpath "$srcdir"`
reldir=`normpath "$reldir"`
bits=`"$srcdir"/bits`
###############################################################################
pfxpath() {
if test 'x' = "x$1" -o "." = "$1"; then
echo "$pfx/$2"
else
normpath "$1"
fi
}
bindir=`pfxpath "$bindir" bin`
libdir=`pfxpath "$libdir" lib`
includedir=`pfxpath "$includedir" include`
###############################################################################
rm -f config.mak
touch config.mak
echo "OS=$os" >> config.mak
echo "PREFIX=$pfx" >> config.mak
echo "SRCDIR=$srcdir" >> config.mak
echo "BINDIR=$bindir" >> config.mak
echo "LIBDIR=$libdir" >> config.mak
echo "INCLUDEDIR=$includedir" >> config.mak
echo "TOOLDIR=$tooldir" >> config.mak
echo "UNPACKDIR=$unpackdir" >> config.mak
echo "RELDIR=$reldir" >> config.mak
echo "MSVS=$msvs" >> config.mak
echo "MSSDK=$mssdk" >> config.mak
echo "WASDK=$wasdk" >> config.mak
echo "NSIS=$nsis" >> config.mak
#echo "WINAMP=$winamp" >> config.mak
echo "HOST=$host" >> config.mak
echo "BITS=$bits" >> config.mak
echo "ENABLE_STATIC=$enable_static" >> config.mak
echo "ENABLE_SHARED=$enable_shared" >> config.mak
echo "ENABLE_EXAMPLES=$enable_examples" >> config.mak
if [ 'x' != "x$cflags" ]; then echo "CFLAGS+=$cflags" >> config.mak; fi
if [ 'x' != "x$cppflags" ]; then echo "CPPFLAGS+=$cppflags" >> config.mak; fi
if [ 'x' != "x$ldflags" ]; then echo "LDFLAGS+=$ldflags" >> config.mak; fi
if [ 'x' != "x$libs" ]; then echo "LIBS+=$libs" >> config.mak; fi
if test ! . -ef $srcdir; then
cp $srcdir/Makefile .
fi