1 #!/bin/sh |
1 #!/bin/sh |
|
2 |
|
3 |
|
4 # some utility functions |
|
5 isplatform() |
|
6 { |
|
7 for p in $PLATFORM |
|
8 do |
|
9 if [ "$p" = "$1" ]; then |
|
10 return 0 |
|
11 fi |
|
12 done |
|
13 return 1 |
|
14 } |
|
15 notisplatform() |
|
16 { |
|
17 for p in $PLATFORM |
|
18 do |
|
19 if [ "$p" = "$1" ]; then |
|
20 return 1 |
|
21 fi |
|
22 done |
|
23 return 0 |
|
24 } |
|
25 istoolchain() |
|
26 { |
|
27 for t in $TOOLCHAIN |
|
28 do |
|
29 if [ "$t" = "$1" ]; then |
|
30 return 0 |
|
31 fi |
|
32 done |
|
33 return 1 |
|
34 } |
|
35 notistoolchain() |
|
36 { |
|
37 for t in $TOOLCHAIN |
|
38 do |
|
39 if [ "$t" = "$1" ]; then |
|
40 return 1 |
|
41 fi |
|
42 done |
|
43 return 0 |
|
44 } |
|
45 |
|
46 # clean abort |
|
47 abort_configure() |
|
48 { |
|
49 rm -Rf "$TEMP_DIR" |
|
50 exit 1 |
|
51 } |
|
52 |
|
53 # Test for availability of pkg-config |
|
54 PKG_CONFIG=`command -v pkg-config` |
|
55 : ${PKG_CONFIG:="false"} |
|
56 |
|
57 # Simple uname based platform detection |
|
58 # $PLATFORM is used for platform dependent dependency selection |
|
59 OS=`uname -s` |
|
60 OS_VERSION=`uname -r` |
|
61 printf "detect platform... " |
|
62 if [ "$OS" = "SunOS" ]; then |
|
63 PLATFORM="solaris sunos unix svr4" |
|
64 elif [ "$OS" = "Linux" ]; then |
|
65 PLATFORM="linux unix" |
|
66 elif [ "$OS" = "FreeBSD" ]; then |
|
67 PLATFORM="freebsd bsd unix" |
|
68 elif [ "$OS" = "OpenBSD" ]; then |
|
69 PLATFORM="openbsd bsd unix" |
|
70 elif [ "$OS" = "NetBSD" ]; then |
|
71 PLATFORM="netbsd bsd unix" |
|
72 elif [ "$OS" = "Darwin" ]; then |
|
73 PLATFORM="macos osx bsd unix" |
|
74 elif echo "$OS" | grep -i "MINGW" > /dev/null; then |
|
75 PLATFORM="windows mingw" |
|
76 fi |
|
77 : ${PLATFORM:="unix"} |
|
78 |
|
79 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` |
|
80 echo "$PLATFORM_NAME" |
|
81 |
|
82 |
|
83 # help text |
|
84 printhelp() |
|
85 { |
|
86 echo "Usage: $0 [OPTIONS]..." |
|
87 cat << __EOF__ |
|
88 Installation directories: |
|
89 --prefix=PREFIX path prefix for architecture-independent files |
|
90 [$prefix] |
|
91 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
|
92 [PREFIX] |
|
93 |
|
94 --bindir=DIR user executables [EPREFIX/bin] |
|
95 --sbindir=DIR system admin executables [EPREFIX/sbin] |
|
96 --libexecdir=DIR program executables [EPREFIX/libexec] |
|
97 --sysconfdir=DIR system configuration files [PREFIX/etc] |
|
98 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
|
99 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
|
100 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
|
101 --libdir=DIR object code libraries [EPREFIX/lib] |
|
102 --includedir=DIR C header files [PREFIX/include] |
|
103 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
|
104 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
|
105 --infodir=DIR info documentation [DATAROOTDIR/info] |
|
106 --mandir=DIR man documentation [DATAROOTDIR/man] |
|
107 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
|
108 |
|
109 Optional Features: |
|
110 --disable-pg |
|
111 |
|
112 __EOF__ |
|
113 } |
2 |
114 |
3 # create temporary directory |
115 # create temporary directory |
4 TEMP_DIR=".tmp-`uname -n`" |
116 TEMP_DIR=".tmp-`uname -n`" |
5 rm -Rf "$TEMP_DIR" |
117 rm -Rf "$TEMP_DIR" |
6 if mkdir -p "$TEMP_DIR"; then |
118 if mkdir -p "$TEMP_DIR"; then |
31 infodir= |
143 infodir= |
32 localedir= |
144 localedir= |
33 mandir= |
145 mandir= |
34 |
146 |
35 # custom variables |
147 # custom variables |
36 HOST=`uname -n` |
148 if true \ |
37 prefix="`pwd`/work" |
149 && notisplatform "mingw" \ |
38 install_dir="$prefix" |
150 ; then |
|
151 prefix="`pwd`/work" |
|
152 fi |
|
153 if true \ |
|
154 && isplatform "mingw" \ |
|
155 ; then |
|
156 prefix="`pwd -W`/work" |
|
157 fi |
|
158 if true \ |
|
159 ; then |
|
160 HOST=`uname -n` |
|
161 install_dir="$prefix" |
|
162 fi |
39 |
163 |
40 # features |
164 # features |
41 FEATURE_PG=auto |
165 FEATURE_PG=auto |
42 |
|
43 # clean abort |
|
44 abort_configure() |
|
45 { |
|
46 rm -Rf "$TEMP_DIR" |
|
47 exit 1 |
|
48 } |
|
49 |
|
50 # help text |
|
51 printhelp() |
|
52 { |
|
53 echo "Usage: $0 [OPTIONS]..." |
|
54 cat << __EOF__ |
|
55 Installation directories: |
|
56 --prefix=PREFIX path prefix for architecture-independent files |
|
57 [$prefix] |
|
58 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
|
59 [PREFIX] |
|
60 |
|
61 --bindir=DIR user executables [EPREFIX/bin] |
|
62 --sbindir=DIR system admin executables [EPREFIX/sbin] |
|
63 --libexecdir=DIR program executables [EPREFIX/libexec] |
|
64 --sysconfdir=DIR system configuration files [PREFIX/etc] |
|
65 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
|
66 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
|
67 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
|
68 --libdir=DIR object code libraries [EPREFIX/lib] |
|
69 --includedir=DIR C header files [PREFIX/include] |
|
70 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
|
71 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
|
72 --infodir=DIR info documentation [DATAROOTDIR/info] |
|
73 --mandir=DIR man documentation [DATAROOTDIR/man] |
|
74 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
|
75 |
|
76 Optional Features: |
|
77 --disable-pg |
|
78 |
|
79 __EOF__ |
|
80 } |
|
81 |
166 |
82 # |
167 # |
83 # parse arguments |
168 # parse arguments |
84 # |
169 # |
85 BUILD_TYPE="default" |
170 BUILD_TYPE="default" |
145 printf "loading site defaults... " |
230 printf "loading site defaults... " |
146 . "$prefix/etc/config.site" |
231 . "$prefix/etc/config.site" |
147 echo ok |
232 echo ok |
148 fi |
233 fi |
149 |
234 |
150 # Test for availability of pkg-config |
|
151 PKG_CONFIG=`command -v pkg-config` |
|
152 : ${PKG_CONFIG:="false"} |
|
153 |
|
154 # Simple uname based platform detection |
|
155 # $PLATFORM is used for platform dependent dependency selection |
|
156 OS=`uname -s` |
|
157 OS_VERSION=`uname -r` |
|
158 printf "detect platform... " |
|
159 if [ "$OS" = "SunOS" ]; then |
|
160 PLATFORM="solaris sunos unix svr4" |
|
161 elif [ "$OS" = "Linux" ]; then |
|
162 PLATFORM="linux unix" |
|
163 elif [ "$OS" = "FreeBSD" ]; then |
|
164 PLATFORM="freebsd bsd unix" |
|
165 elif [ "$OS" = "OpenBSD" ]; then |
|
166 PLATFORM="openbsd bsd unix" |
|
167 elif [ "$OS" = "NetBSD" ]; then |
|
168 PLATFORM="netbsd bsd unix" |
|
169 elif [ "$OS" = "Darwin" ]; then |
|
170 PLATFORM="macos osx bsd unix" |
|
171 elif echo "$OS" | grep -i "MINGW" > /dev/null; then |
|
172 PLATFORM="windows mingw" |
|
173 fi |
|
174 : ${PLATFORM:="unix"} |
|
175 |
|
176 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` |
|
177 echo "$PLATFORM_NAME" |
|
178 |
|
179 isplatform() |
|
180 { |
|
181 for p in $PLATFORM |
|
182 do |
|
183 if [ "$p" = "$1" ]; then |
|
184 return 0 |
|
185 fi |
|
186 done |
|
187 return 1 |
|
188 } |
|
189 notisplatform() |
|
190 { |
|
191 for p in $PLATFORM |
|
192 do |
|
193 if [ "$p" = "$1" ]; then |
|
194 return 1 |
|
195 fi |
|
196 done |
|
197 return 0 |
|
198 } |
|
199 istoolchain() |
|
200 { |
|
201 for t in $TOOLCHAIN |
|
202 do |
|
203 if [ "$t" = "$1" ]; then |
|
204 return 0 |
|
205 fi |
|
206 done |
|
207 return 1 |
|
208 } |
|
209 notistoolchain() |
|
210 { |
|
211 for t in $TOOLCHAIN |
|
212 do |
|
213 if [ "$t" = "$1" ]; then |
|
214 return 1 |
|
215 fi |
|
216 done |
|
217 return 0 |
|
218 } |
|
219 |
|
220 |
235 |
221 # generate vars.mk |
236 # generate vars.mk |
222 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
237 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
223 prefix=$prefix |
238 prefix=$prefix |
224 exec_prefix=$exec_prefix |
239 exec_prefix=$exec_prefix |