1 #!/bin/sh |
1 #!/bin/sh |
|
2 |
|
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 } |
2 |
128 |
3 # create temporary directory |
129 # create temporary directory |
4 TEMP_DIR=".tmp-`uname -n`" |
130 TEMP_DIR=".tmp-`uname -n`" |
5 rm -Rf "$TEMP_DIR" |
131 rm -Rf "$TEMP_DIR" |
6 if mkdir -p "$TEMP_DIR"; then |
132 if mkdir -p "$TEMP_DIR"; then |
31 infodir= |
157 infodir= |
32 localedir= |
158 localedir= |
33 mandir= |
159 mandir= |
34 |
160 |
35 # custom variables |
161 # custom variables |
36 #foreach( $var in $vars ) |
162 #foreach( $cfg in $config ) |
37 #if( $var.exec ) |
163 if true \ |
38 ${var.varName}=`${var.value}` |
164 #if( $cfg.platform ) |
39 #else |
165 && isplatform "${cfg.platform}" \ |
40 ${var.varName}="${var.value}" |
166 #end |
41 #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 |
42 #end |
179 #end |
43 |
180 |
44 # features |
181 # features |
45 #foreach( $feature in $features ) |
182 #foreach( $feature in $features ) |
46 #if( ${feature.auto} ) |
183 #if( ${feature.auto} ) |
47 ${feature.varName}=auto |
184 ${feature.varName}=auto |
48 #end |
185 #end |
49 #end |
186 #end |
50 |
187 |
51 # clean abort |
|
52 abort_configure() |
|
53 { |
|
54 rm -Rf "$TEMP_DIR" |
|
55 exit 1 |
|
56 } |
|
57 |
|
58 # help text |
|
59 printhelp() |
|
60 { |
|
61 echo "Usage: $0 [OPTIONS]..." |
|
62 cat << __EOF__ |
|
63 Installation directories: |
|
64 --prefix=PREFIX path prefix for architecture-independent files |
|
65 [/usr] |
|
66 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
|
67 [PREFIX] |
|
68 |
|
69 --bindir=DIR user executables [EPREFIX/bin] |
|
70 --sbindir=DIR system admin executables [EPREFIX/sbin] |
|
71 --libexecdir=DIR program executables [EPREFIX/libexec] |
|
72 --sysconfdir=DIR system configuration files [PREFIX/etc] |
|
73 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
|
74 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
|
75 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
|
76 --libdir=DIR object code libraries [EPREFIX/lib] |
|
77 --includedir=DIR C header files [PREFIX/include] |
|
78 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
|
79 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
|
80 --infodir=DIR info documentation [DATAROOTDIR/info] |
|
81 --mandir=DIR man documentation [DATAROOTDIR/man] |
|
82 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
|
83 |
|
84 #if( $options.size() > 0 ) |
|
85 Options: |
|
86 --debug add extra compile flags for debug builds |
|
87 --release add extra compile flags for release builds |
|
88 #foreach( $opt in $options ) |
|
89 --${opt.argument}=${opt.valuesString} |
|
90 #end |
|
91 |
|
92 #end |
|
93 #if( $features.size() > 0 ) |
|
94 Optional Features: |
|
95 #foreach( $feature in $features ) |
|
96 ${feature.helpText} |
|
97 #end |
|
98 |
|
99 #end |
|
100 __EOF__ |
|
101 } |
|
102 |
|
103 # |
188 # |
104 # parse arguments |
189 # parse arguments |
105 # |
190 # |
106 BUILD_TYPE="default" |
191 BUILD_TYPE="default" |
107 #set( $D = '$' ) |
|
108 for ARG in "$@" |
192 for ARG in "$@" |
109 do |
193 do |
110 case "$ARG" in |
194 case "$ARG" in |
111 "--prefix="*) prefix=${D}{ARG#--prefix=} ;; |
195 "--prefix="*) prefix=${D}{ARG#--prefix=} ;; |
112 "--exec-prefix="*) exec_prefix=${D}{ARG#--exec-prefix=} ;; |
196 "--exec-prefix="*) exec_prefix=${D}{ARG#--exec-prefix=} ;; |
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__ |