src/main/resources/make/configure.vm

changeset 116
41981a23aff8
parent 115
36e4aedd5663
equal deleted inserted replaced
115:36e4aedd5663 116:41981a23aff8
1 #!/bin/sh 1 #!/bin/sh
2 2
3 #set( $D = '$' ) 3 #set( $D = '$' )
4 #[[
5 # some utility functions
6 isplatform()
7 {
8 for p in $PLATFORM
9 do
10 if [ "$p" = "$1" ]; then
11 return 0
12 fi
13 done
14 return 1
15 }
16 notisplatform()
17 {
18 for p in $PLATFORM
19 do
20 if [ "$p" = "$1" ]; then
21 return 1
22 fi
23 done
24 return 0
25 }
26 istoolchain()
27 {
28 for t in $TOOLCHAIN
29 do
30 if [ "$t" = "$1" ]; then
31 return 0
32 fi
33 done
34 return 1
35 }
36 notistoolchain()
37 {
38 for t in $TOOLCHAIN
39 do
40 if [ "$t" = "$1" ]; then
41 return 1
42 fi
43 done
44 return 0
45 }
46
47 # clean abort
48 abort_configure()
49 {
50 rm -Rf "$TEMP_DIR"
51 exit 1
52 }
53
54 # Test for availability of pkg-config
55 PKG_CONFIG=`command -v pkg-config`
56 : ${PKG_CONFIG:="false"}
57
58 # Simple uname based platform detection
59 # $PLATFORM is used for platform dependent dependency selection
60 OS=`uname -s`
61 OS_VERSION=`uname -r`
62 printf "detect platform... "
63 if [ "$OS" = "SunOS" ]; then
64 PLATFORM="solaris sunos unix svr4"
65 elif [ "$OS" = "Linux" ]; then
66 PLATFORM="linux unix"
67 elif [ "$OS" = "FreeBSD" ]; then
68 PLATFORM="freebsd bsd unix"
69 elif [ "$OS" = "OpenBSD" ]; then
70 PLATFORM="openbsd bsd unix"
71 elif [ "$OS" = "NetBSD" ]; then
72 PLATFORM="netbsd bsd unix"
73 elif [ "$OS" = "Darwin" ]; then
74 PLATFORM="macos osx bsd unix"
75 elif echo "$OS" | grep -i "MINGW" > /dev/null; then
76 PLATFORM="windows mingw"
77 fi
78 : ${PLATFORM:="unix"}
79
80 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
81 echo "$PLATFORM_NAME"
82 ]]#
83
84 # help text
85 printhelp()
86 {
87 echo "Usage: $0 [OPTIONS]..."
88 cat << __EOF__
89 Installation directories:
90 --prefix=PREFIX path prefix for architecture-independent files
91 [${D}prefix]
92 --exec-prefix=EPREFIX path prefix for architecture-dependent files
93 [PREFIX]
94
95 --bindir=DIR user executables [EPREFIX/bin]
96 --sbindir=DIR system admin executables [EPREFIX/sbin]
97 --libexecdir=DIR program executables [EPREFIX/libexec]
98 --sysconfdir=DIR system configuration files [PREFIX/etc]
99 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
100 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
101 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run]
102 --libdir=DIR object code libraries [EPREFIX/lib]
103 --includedir=DIR C header files [PREFIX/include]
104 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
105 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
106 --infodir=DIR info documentation [DATAROOTDIR/info]
107 --mandir=DIR man documentation [DATAROOTDIR/man]
108 --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
109
110 #if( $options.size() > 0 )
111 Options:
112 --debug add extra compile flags for debug builds
113 --release add extra compile flags for release builds
114 #foreach( $opt in $options )
115 --${opt.argument}=${opt.valuesString}
116 #end
117
118 #end
119 #if( $features.size() > 0 )
120 Optional Features:
121 #foreach( $feature in $features )
122 ${feature.helpText}
123 #end
124
125 #end
126 __EOF__
127 }
128
4 # create temporary directory 129 # create temporary directory
5 TEMP_DIR=".tmp-`uname -n`" 130 TEMP_DIR=".tmp-`uname -n`"
6 rm -Rf "$TEMP_DIR" 131 rm -Rf "$TEMP_DIR"
7 if mkdir -p "$TEMP_DIR"; then 132 if mkdir -p "$TEMP_DIR"; then
8 : 133 :
32 infodir= 157 infodir=
33 localedir= 158 localedir=
34 mandir= 159 mandir=
35 160
36 # custom variables 161 # custom variables
37 #foreach( $var in $vars ) 162 #foreach( $cfg in $config )
38 #if( $var.exec ) 163 if true \
39 ${var.varName}=`${var.value}` 164 #if( $cfg.platform )
40 #else 165 && isplatform "${cfg.platform}" \
41 ${var.varName}="${var.value}" 166 #end
42 #end 167 #foreach( $np in $cfg.notList )
168 && notisplatform "${np}" \
169 #end
170 ; then
171 #foreach( $var in $cfg.vars )
172 #if( $var.exec )
173 ${var.varName}=`${var.value}`
174 #else
175 ${var.varName}="${var.value}"
176 #end
177 #end
178 fi
43 #end 179 #end
44 180
45 # features 181 # features
46 #foreach( $feature in $features ) 182 #foreach( $feature in $features )
47 #if( ${feature.auto} ) 183 #if( ${feature.auto} )
48 ${feature.varName}=auto 184 ${feature.varName}=auto
49 #end 185 #end
50 #end 186 #end
51
52 # clean abort
53 abort_configure()
54 {
55 rm -Rf "$TEMP_DIR"
56 exit 1
57 }
58
59 # help text
60 printhelp()
61 {
62 echo "Usage: $0 [OPTIONS]..."
63 cat << __EOF__
64 Installation directories:
65 --prefix=PREFIX path prefix for architecture-independent files
66 [${D}prefix]
67 --exec-prefix=EPREFIX path prefix for architecture-dependent files
68 [PREFIX]
69
70 --bindir=DIR user executables [EPREFIX/bin]
71 --sbindir=DIR system admin executables [EPREFIX/sbin]
72 --libexecdir=DIR program executables [EPREFIX/libexec]
73 --sysconfdir=DIR system configuration files [PREFIX/etc]
74 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
75 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
76 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run]
77 --libdir=DIR object code libraries [EPREFIX/lib]
78 --includedir=DIR C header files [PREFIX/include]
79 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
80 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
81 --infodir=DIR info documentation [DATAROOTDIR/info]
82 --mandir=DIR man documentation [DATAROOTDIR/man]
83 --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
84
85 #if( $options.size() > 0 )
86 Options:
87 --debug add extra compile flags for debug builds
88 --release add extra compile flags for release builds
89 #foreach( $opt in $options )
90 --${opt.argument}=${opt.valuesString}
91 #end
92
93 #end
94 #if( $features.size() > 0 )
95 Optional Features:
96 #foreach( $feature in $features )
97 ${feature.helpText}
98 #end
99
100 #end
101 __EOF__
102 }
103 187
104 # 188 #
105 # parse arguments 189 # parse arguments
106 # 190 #
107 BUILD_TYPE="default" 191 BUILD_TYPE="default"
172 elif [ -f "$prefix/etc/config.site" ]; then 256 elif [ -f "$prefix/etc/config.site" ]; then
173 printf "loading site defaults... " 257 printf "loading site defaults... "
174 . "$prefix/etc/config.site" 258 . "$prefix/etc/config.site"
175 echo ok 259 echo ok
176 fi 260 fi
177
178 # Test for availability of pkg-config
179 PKG_CONFIG=`command -v pkg-config`
180 : ${PKG_CONFIG:="false"}
181
182 # Simple uname based platform detection
183 # $PLATFORM is used for platform dependent dependency selection
184 OS=`uname -s`
185 OS_VERSION=`uname -r`
186 printf "detect platform... "
187 if [ "$OS" = "SunOS" ]; then
188 PLATFORM="solaris sunos unix svr4"
189 elif [ "$OS" = "Linux" ]; then
190 PLATFORM="linux unix"
191 elif [ "$OS" = "FreeBSD" ]; then
192 PLATFORM="freebsd bsd unix"
193 elif [ "$OS" = "OpenBSD" ]; then
194 PLATFORM="openbsd bsd unix"
195 elif [ "$OS" = "NetBSD" ]; then
196 PLATFORM="netbsd bsd unix"
197 elif [ "$OS" = "Darwin" ]; then
198 PLATFORM="macos osx bsd unix"
199 elif echo "$OS" | grep -i "MINGW" > /dev/null; then
200 PLATFORM="windows mingw"
201 fi
202 : ${PLATFORM:="unix"}
203
204 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -`
205 echo "$PLATFORM_NAME"
206
207 isplatform()
208 {
209 for p in $PLATFORM
210 do
211 if [ "$p" = "$1" ]; then
212 return 0
213 fi
214 done
215 return 1
216 }
217 notisplatform()
218 {
219 for p in $PLATFORM
220 do
221 if [ "$p" = "$1" ]; then
222 return 1
223 fi
224 done
225 return 0
226 }
227 istoolchain()
228 {
229 for t in $TOOLCHAIN
230 do
231 if [ "$t" = "$1" ]; then
232 return 0
233 fi
234 done
235 return 1
236 }
237 notistoolchain()
238 {
239 for t in $TOOLCHAIN
240 do
241 if [ "$t" = "$1" ]; then
242 return 1
243 fi
244 done
245 return 0
246 }
247 ]]# 261 ]]#
248 ## End of unparsed content ** 262 ## End of unparsed content **
249 263
250 # generate vars.mk 264 # generate vars.mk
251 cat > "$TEMP_DIR/vars.mk" << __EOF__ 265 cat > "$TEMP_DIR/vars.mk" << __EOF__

mercurial