100 esac |
102 esac |
101 done |
103 done |
102 |
104 |
103 |
105 |
104 # set dir variables |
106 # set dir variables |
105 BINDIR=${BINDIR:-"$EPREFIX/bin"} |
107 : ${BINDIR:="$EPREFIX/bin"} |
106 SBINDIR=${SBINDIR:-"$EPREFIX/sbin"} |
108 : ${SBINDIR:="$EPREFIX/sbin"} |
107 LIBDIR=${LIBDIR:-"$EPREFIX/lib"} |
109 : ${LIBDIR:="$EPREFIX/lib"} |
108 LIBEXECDIR=${LIBEXECDIR:-"$EPREFIX/libexec"} |
110 : ${LIBEXECDIR:="$EPREFIX/libexec"} |
109 DATADIR=${DATADIR:-"$PREFIX/share"} |
111 : ${DATADIR:="$PREFIX/share"} |
110 SYSCONFDIR=${SYSCONFDIR:-"$PREFIX/etc"} |
112 : ${SYSCONFDIR:="$PREFIX/etc"} |
111 SHAREDSTATEDIR=${SHAREDSTATEDIR:-"$PREFIX/com"} |
113 : ${SHAREDSTATEDIR:="$PREFIX/com"} |
112 LOCALSTATEDIR=${LOCALSTATEDIR:-"$PREFIX/var"} |
114 : ${LOCALSTATEDIR:="$PREFIX/var"} |
113 INCLUDEDIR=${INCLUDEDIR:-"$PREFIX/include"} |
115 : ${INCLUDEDIR:="$PREFIX/include"} |
114 INFODIR=${INFODIR:-"$PREFIX/info"} |
116 : ${INFODIR:="$PREFIX/info"} |
115 MANDIR=${MANDIR:-"$PREFIX/man"} |
117 : ${MANDIR:="$PREFIX/man"} |
116 |
118 |
117 # Test for availability of pkg-config |
119 # Test for availability of pkg-config |
118 PKG_CONFIG=$(command -v pkg-config) |
120 PKG_CONFIG=`command -v pkg-config` |
119 PKG_CONFIG=${PKG_CONFIG:-"false"} |
121 : ${PKG_CONFIG:="false"} |
120 |
122 |
121 # Simple uname based platform detection |
123 # Simple uname based platform detection |
122 # $PLATFORM is used for platform dependent dependency selection |
124 # $PLATFORM is used for platform dependent dependency selection |
123 OS=$(uname -s) |
125 OS=`uname -s` |
124 OS_VERSION=$(uname -r) |
126 OS_VERSION=`uname -r` |
125 printf "detect platform... " |
127 printf "detect platform... " |
126 if [ "$OS" = "SunOS" ]; then |
128 if [ "$OS" = "SunOS" ]; then |
127 PLATFORM="solaris sunos unix svr4" |
129 PLATFORM="solaris sunos unix svr4" |
128 fi |
130 fi |
129 if [ "$OS" = "Linux" ]; then |
131 if [ "$OS" = "Linux" ]; then |
136 PLATFORM="macos osx bsd unix" |
138 PLATFORM="macos osx bsd unix" |
137 fi |
139 fi |
138 if echo "$OS" | grep -i "MINGW" > /dev/null; then |
140 if echo "$OS" | grep -i "MINGW" > /dev/null; then |
139 PLATFORM="windows mingw" |
141 PLATFORM="windows mingw" |
140 fi |
142 fi |
141 PLATFORM=${PLATFORM:-"unix"} |
143 : ${PLATFORM:="unix"} |
142 |
144 |
143 PLATFORM_NAME=$(echo "$PLATFORM" | cut -f1 -d' ' -) |
145 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` |
144 echo "$PLATFORM_NAME" |
146 echo "$PLATFORM_NAME" |
145 |
147 |
146 isplatform() |
148 isplatform() |
147 { |
149 { |
148 for p in $PLATFORM |
150 for p in $PLATFORM |
196 # |
208 # |
197 |
209 |
198 # create buffer for make variables required by dependencies |
210 # create buffer for make variables required by dependencies |
199 echo > "$TEMP_DIR/make.mk" |
211 echo > "$TEMP_DIR/make.mk" |
200 |
212 |
201 dependency_libpq() |
213 dependency_error_libpq() |
202 { |
214 { |
203 printf "checking for libpq... " |
215 printf "checking for libpq... " |
204 # dependency libpq |
216 # dependency libpq |
205 while true |
217 while true |
206 do |
218 do |
207 if [ -z "$PKG_CONFIG" ]; then |
219 if [ -z "$PKG_CONFIG" ]; then |
208 break |
220 break |
209 fi |
221 fi |
210 if ! $PKG_CONFIG libpq ; then |
222 if $PKG_CONFIG libpq ; then |
211 break |
223 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libpq`" |
212 fi |
224 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libpq`" |
213 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags libpq)" |
225 else |
214 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs libpq)" |
226 break |
|
227 fi |
215 echo yes |
228 echo yes |
216 return 0 |
229 return 1 |
217 done |
230 done |
218 |
231 |
219 echo no |
232 echo no |
220 return 1 |
233 return 0 |
221 } |
234 } |
222 dependency_openssl() |
235 dependency_error_openssl() |
223 { |
236 { |
224 printf "checking for openssl... " |
237 printf "checking for openssl... " |
225 # dependency openssl |
238 # dependency openssl |
226 while true |
239 while true |
227 do |
240 do |
228 if [ -z "$PKG_CONFIG" ]; then |
241 if [ -z "$PKG_CONFIG" ]; then |
229 break |
242 break |
230 fi |
243 fi |
231 if ! $PKG_CONFIG openssl ; then |
244 if $PKG_CONFIG openssl ; then |
232 break |
245 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags openssl`" |
233 fi |
246 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs openssl`" |
234 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags openssl)" |
247 else |
235 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs openssl)" |
248 break |
|
249 fi |
236 echo yes |
250 echo yes |
237 return 0 |
251 return 1 |
238 done |
252 done |
239 |
253 |
240 # dependency openssl platform="bsd" |
254 # dependency openssl platform="bsd" |
241 while true |
255 while true |
242 do |
256 do |
243 if ! isplatform "bsd"; then |
257 if notisplatform "bsd"; then |
244 break |
258 break |
245 fi |
259 fi |
246 TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto" |
260 TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto" |
247 echo yes |
261 echo yes |
248 return 0 |
262 return 1 |
249 done |
263 done |
250 |
264 |
251 echo no |
265 echo no |
252 return 1 |
266 return 0 |
253 } |
267 } |
254 dependency_libxml2() |
268 dependency_error_libxml2() |
255 { |
269 { |
256 printf "checking for libxml2... " |
270 printf "checking for libxml2... " |
257 # dependency libxml2 platform="macos" |
271 # dependency libxml2 platform="macos" |
258 while true |
272 while true |
259 do |
273 do |
260 if ! isplatform "macos"; then |
274 if notisplatform "macos"; then |
261 break |
275 break |
262 fi |
276 fi |
263 if tmp_flags=$(xml2-config --cflags) ; then |
277 if tmp_flags=`xml2-config --cflags` ; then |
264 TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" |
278 TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" |
265 else |
279 else |
266 break |
280 break |
267 fi |
281 fi |
268 if tmp_flags=$(xml2-config --libs) ; then |
282 if tmp_flags=`xml2-config --libs` ; then |
269 TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" |
283 TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" |
270 else |
284 else |
271 break |
285 break |
272 fi |
286 fi |
273 echo yes |
287 echo yes |
274 return 0 |
288 return 1 |
275 done |
289 done |
276 |
290 |
277 # dependency libxml2 |
291 # dependency libxml2 |
278 while true |
292 while true |
279 do |
293 do |
280 if [ -z "$PKG_CONFIG" ]; then |
294 if [ -z "$PKG_CONFIG" ]; then |
281 break |
295 break |
282 fi |
296 fi |
283 if ! $PKG_CONFIG libxml-2.0 ; then |
297 if $PKG_CONFIG libxml-2.0 ; then |
284 break |
298 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`" |
285 fi |
299 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`" |
286 TEMP_CFLAGS="$TEMP_CFLAGS $("$PKG_CONFIG" --cflags libxml-2.0)" |
300 else |
287 TEMP_LDFLAGS="$TEMP_LDFLAGS $("$PKG_CONFIG" --libs libxml-2.0)" |
301 break |
|
302 fi |
288 echo yes |
303 echo yes |
289 return 0 |
304 return 1 |
290 done |
305 done |
291 |
306 |
292 echo no |
307 echo no |
293 return 1 |
308 return 0 |
294 } |
309 } |
295 |
310 |
296 DEPENDENCIES_FAILED= |
311 DEPENDENCIES_FAILED= |
297 ERROR=0 |
312 ERROR=0 |
298 # unnamed dependencies |
313 # unnamed dependencies |
327 |
342 |
328 # Target |
343 # Target |
329 TEMP_CFLAGS= |
344 TEMP_CFLAGS= |
330 TEMP_LDFLAGS= |
345 TEMP_LDFLAGS= |
331 |
346 |
332 if ! dependency_libxml2; then |
347 if dependency_error_libxml2; then |
333 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " |
348 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " |
334 ERROR=1 |
349 ERROR=1 |
335 fi |
350 fi |
336 if ! dependency_openssl; then |
351 if dependency_error_openssl; then |
337 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " |
352 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " |
338 ERROR=1 |
353 ERROR=1 |
339 fi |
354 fi |
340 |
355 |
341 # Features |
356 # Features |
342 if [ -n "$FEATURE_PG" ]; then |
357 if [ -n "$FEATURE_PG" ]; then |
343 # check dependency |
358 # check dependency |
344 if ! dependency_libpq ; then |
359 if dependency_error_libpq ; then |
345 # "auto" features can fail and are just disabled in this case |
360 # "auto" features can fail and are just disabled in this case |
346 if [ "$FEATURE_PG" = "auto" ]; then |
361 if [ "$FEATURE_PG" = "auto" ]; then |
347 unset FEATURE_PG |
362 unset FEATURE_PG |
348 else |
363 else |
349 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq " |
364 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq " |