configure

changeset 787
bd96cbb0e205
parent 758
606519b4a867
child 802
16e5b9d32754
equal deleted inserted replaced
786:f9d6e4cbcb62 787:bd96cbb0e205
18 18
19 OS=`uname -s` 19 OS=`uname -s`
20 OS_VERSION=`uname -r` 20 OS_VERSION=`uname -r`
21 21
22 TEMP_DIR=".tmp-`uname -n`" 22 TEMP_DIR=".tmp-`uname -n`"
23 mkdir -p $TEMP_DIR 23 mkdir -p "$TEMP_DIR"
24 if [ $? -ne 0 ]; then 24 if [ $? -ne 0 ]; then
25 echo "Cannot create tmp dir" 25 echo "Cannot create tmp dir"
26 echo "Abort" 26 echo "Abort"
27 fi 27 fi
28 touch $TEMP_DIR/options 28 touch "$TEMP_DIR/options"
29 touch $TEMP_DIR/features 29 touch "$TEMP_DIR/features"
30 30
31 # features 31 # features
32 32
33 # help text 33 # help text
34 printhelp() 34 printhelp()
35 { 35 {
36 echo "Usage: $0 [OPTIONS]..." 36 echo "Usage: $0 [OPTIONS]..."
37 cat << __EOF__ 37 cat << __EOF__
38 Installation directories: 38 Installation directories:
39 --prefix=PREFIX path prefix for architecture-independent files 39 --prefix=PREFIX path prefix for architecture-independent files
40 [/usr] 40 [/usr]
41 --exec-prefix=EPREFIX path prefix for architecture-dependent files 41 --exec-prefix=EPREFIX path prefix for architecture-dependent files
42 [PREFIX] 42 [PREFIX]
56 56
57 __EOF__ 57 __EOF__
58 } 58 }
59 59
60 # 60 #
61 # parse arguments 61 # parse arguments
62 # 62 #
63 for ARG in $@ 63 for ARG in "$@"
64 do 64 do
65 case "$ARG" in 65 case "$ARG" in
66 "--prefix="*) PREFIX=${ARG#--prefix=} ;; 66 "--prefix="*) PREFIX=${ARG#--prefix=} ;;
67 "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;; 67 "--exec-prefix="*) EPREFIX=${ARG#--exec-prefix=} ;;
68 "--bindir="*) BINDIR=${ARG#----bindir=} ;; 68 "--bindir="*) BINDIR=${ARG#----bindir=} ;;
69 "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;; 69 "--sbindir="*) SBINDIR=${ARG#--sbindir=} ;;
70 "--libdir="*) LIBDIR=${ARG#--libdir=} ;; 70 "--libdir="*) LIBDIR=${ARG#--libdir=} ;;
71 "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;; 71 "--libexecdir="*) LIBEXECDIR=${ARG#--libexecdir=} ;;
72 "--datadir="*) DATADIR=${ARG#--datadir=} ;; 72 "--datadir="*) DATADIR=${ARG#--datadir=} ;;
73 "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;; 73 "--sysconfdir="*) SYSCONFDIR=${ARG#--sysconfdir=} ;;
74 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;; 74 "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;;
75 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;; 75 "--localstatedir="*) LOCALSTATEDIR=${ARG#--localstatedir=} ;;
76 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;; 76 "--includedir="*) INCLUDEDIR=${ARG#--includedir=} ;;
77 "--infodir="*) INFODIR=${ARG#--infodir=} ;; 77 "--infodir="*) INFODIR=${ARG#--infodir=} ;;
78 "--mandir"*) MANDIR=${ARG#--mandir} ;; 78 "--mandir"*) MANDIR=${ARG#--mandir} ;;
79 "--help"*) printhelp; exit 1 ;; 79 "--help"*) printhelp; rm -Rf "$TEMP_DIR"; exit 1 ;;
80 "-"*) echo "unknown option: $ARG"; exit 1 ;; 80 "-"*) echo "unknown option: $ARG"; rm -Rf "$TEMP_DIR"; exit 1 ;;
81 esac 81 esac
82 done 82 done
83 83
84 # set dir variables 84 # set dir variables
85 if [ -z "$BINDIR" ]; then 85 if [ -z "$BINDIR" ]; then
86 BINDIR=$EPREFIX/bin 86 BINDIR=$EPREFIX/bin
87 fi 87 fi
88 if [ -z "$SBINDIR" ]; then 88 if [ -z "$SBINDIR" ]; then
89 SBINDIR=$EPREFIX/sbin 89 SBINDIR=$EPREFIX/sbin
90 fi 90 fi
91 if [ -z "$LIBDIR" ]; then 91 if [ -z "$LIBDIR" ]; then
92 LIBDIR=$EPREFIX/lib 92 LIBDIR=$EPREFIX/lib
93 fi 93 fi
94 if [ -z "$LIBEXEC" ]; then 94 if [ -z "$LIBEXEC" ]; then
95 LIBEXECDIR=$EPREFIX/libexec 95 LIBEXECDIR=$EPREFIX/libexec
96 fi 96 fi
97 if [ -z "$DATADIR" ]; then 97 if [ -z "$DATADIR" ]; then
98 DATADIR=$PREFIX/share 98 DATADIR=$PREFIX/share
99 fi 99 fi
100 if [ -z "$SYSCONFDIR" ]; then 100 if [ -z "$SYSCONFDIR" ]; then
101 SYSCONFDIR=$PREFIX/etc 101 SYSCONFDIR=$PREFIX/etc
102 fi 102 fi
103 if [ -z "$SHAREDSTATEDIR" ]; then 103 if [ -z "$SHAREDSTATEDIR" ]; then
104 SHAREDSTATEDIR=$PREFIX/com 104 SHAREDSTATEDIR=$PREFIX/com
105 fi 105 fi
106 if [ -z "$LOCALSTATEDIR" ]; then 106 if [ -z "$LOCALSTATEDIR" ]; then
107 LOCALSTATEDIR=$PREFIX/var 107 LOCALSTATEDIR=$PREFIX/var
108 fi 108 fi
109 if [ -z "$INCLUDEDIR" ]; then 109 if [ -z "$INCLUDEDIR" ]; then
110 INCLUDEDIR=$PREFIX/include 110 INCLUDEDIR=$PREFIX/include
111 fi 111 fi
112 if [ -z "$INFODIR" ]; then 112 if [ -z "$INFODIR" ]; then
113 INFODIR=$PREFIX/info 113 INFODIR=$PREFIX/info
114 fi 114 fi
115 if [ -z "$MANDIR" ]; then 115 if [ -z "$MANDIR" ]; then
116 MANDIR=$PREFIX/man 116 MANDIR=$PREFIX/man
117 fi 117 fi
118 118
119 which pkg-config > /dev/null 119 which pkg-config > /dev/null
120 if [ $? -eq 0 ]; then 120 if [ $? -eq 0 ]; then
121 PKG_CONFIG=pkg-config 121 PKG_CONFIG=pkg-config
124 fi 124 fi
125 125
126 # Simple uname based platform detection 126 # Simple uname based platform detection
127 # $PLATFORM is used for platform dependent dependency selection 127 # $PLATFORM is used for platform dependent dependency selection
128 printf "detect platform... " 128 printf "detect platform... "
129 if [ $OS = SunOS ]; then 129 if [ "$OS" = "SunOS" ]; then
130 PLATFORM="solaris sunos unix svr4" 130 PLATFORM="solaris sunos unix svr4"
131 fi 131 fi
132 if [ $OS = Linux ]; then 132 if [ "$OS" = "Linux" ]; then
133 PLATFORM="linux unix" 133 PLATFORM="linux unix"
134 fi 134 fi
135 if [ $OS = FreeBSD ]; then 135 if [ "$OS" = "FreeBSD" ]; then
136 PLATFORM="freebsd bsd unix" 136 PLATFORM="freebsd bsd unix"
137 fi 137 fi
138 if [ $OS = Darwin ]; then 138 if [ "$OS" = "Darwin" ]; then
139 PLATFORM="macos osx bsd unix" 139 PLATFORM="macos osx bsd unix"
140 fi 140 fi
141 echo $OS | grep "MINGW" > /dev/null 141 echo "$OS" | grep -i "MINGW" > /dev/null
142 if [ $? -eq 0 ]; then 142 if [ $? -eq 0 ]; then
143 PLATFORM="windows mingw" 143 PLATFORM="windows mingw"
144 fi 144 fi
145 145
146 if [ -z "$PLATFORM" ]; then 146 if [ -z "$PLATFORM" ]; then
147 PLATFORM="unix" 147 PLATFORM="unix"
148 fi 148 fi
149 149
150 for p in $PLATFORM 150 for p in $PLATFORM
151 do 151 do
152 PLATFORM_NAME=$p 152 PLATFORM_NAME=$p
153 break 153 break
154 done 154 done
155 echo $PLATFORM_NAME 155 echo $PLATFORM_NAME
156 156
157 isplatform() 157 isplatform()
158 { 158 {
159 for p in $PLATFORM 159 for p in $PLATFORM
160 do 160 do
161 if [ $p = $1 ]; then 161 if [ "$p" = "$1" ]; then
162 return 0 162 return 0
163 fi 163 fi
164 done 164 done
165 return 1 165 return 1
166 } 166 }
167 isnotplatform() 167 isnotplatform()
168 { 168 {
169 for p in $PLATFORM 169 for p in $PLATFORM
170 do 170 do
171 if [ $p = $1 ]; then 171 if [ "$p" = "$1" ]; then
172 return 1 172 return 1
173 fi 173 fi
174 done 174 done
175 return 0 175 return 0
176 } 176 }
177 177
178 # generate config.mk and config.h 178 # generate config.mk and config.h
179 cat > $TEMP_DIR/config.mk << __EOF__ 179 cat > "$TEMP_DIR/config.mk" << __EOF__
180 # 180 #
181 # config.mk generated by configure 181 # config.mk generated by configure
182 # 182 #
183 183
184 # general vars 184 # general vars
198 INFODIR=$INFODIR 198 INFODIR=$INFODIR
199 MANDIR=$MANDIR 199 MANDIR=$MANDIR
200 200
201 __EOF__ 201 __EOF__
202 202
203 echo > $TEMP_DIR/make.mk 203 echo > "$TEMP_DIR/make.mk"
204 204
205 ENV_CFLAGS=$CFLAGS 205 ENV_CFLAGS=$CFLAGS
206 ENV_LDFLAGS=$LDFLAGS 206 ENV_LDFLAGS=$LDFLAGS
207 ENV_CXXFLAGS=$CXXFLAGS 207 ENV_CXXFLAGS=$CXXFLAGS
208 208
209 # Toolchain detection 209 # Toolchain detection
210 # this will insert make vars to config.mk 210 # this will insert make vars to config.mk
211 . make/toolchain.sh 211 . make/toolchain.sh
212 212
213 # add user specified flags to config.mk 213 # add user specified flags to config.mk
214 echo >> $TEMP_DIR/config.mk 214 echo "# project specific flags" >> "$TEMP_DIR/config.mk"
215 if [ ! -z "${ENV_CFLAGS}" ]; then 215 if [ -n "${ENV_CFLAGS}" ]; then
216 echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk 216 echo "CFLAGS += $ENV_CFLAGS" >> "$TEMP_DIR/config.mk"
217 fi 217 fi
218 if [ ! -z "${ENV_CXXFLAGS}" ]; then 218 if [ -n "${ENV_CXXFLAGS}" ]; then
219 echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk 219 echo "CXXFLAGS += $ENV_CXXFLAGS" >> "$TEMP_DIR/config.mk"
220 fi 220 fi
221 if [ ! -z "${ENV_LDFLAGS}" ]; then 221 if [ -n "${ENV_LDFLAGS}" ]; then
222 echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk 222 echo "LDFLAGS += $ENV_LDFLAGS" >> "$TEMP_DIR/config.mk"
223 fi 223 fi
224 224
225 # 225 #
226 # DEPENDENCIES 226 # DEPENDENCIES
227 # 227 #
230 { 230 {
231 printf "checking for curl... " 231 printf "checking for curl... "
232 # dependency curl platform="windows" 232 # dependency curl platform="windows"
233 while true 233 while true
234 do 234 do
235 if isnotplatform "windows"; then 235 if isnotplatform "windows"; then
236 break 236 break
237 fi 237 fi
238 CFLAGS="$CFLAGS -I/mingw/include" 238 TEMP_CFLAGS="$TEMP_CFLAGS -I/mingw/include"
239 LDFLAGS="$LDFLAGS -lcurl" 239 TEMP_LDFLAGS="$TEMP_LDFLAGS -lcurl"
240 echo yes 240 echo yes
241 return 0 241 return 0
242 done 242 done
243 243
244 # dependency curl platform="macos" 244 # dependency curl platform="macos"
245 while true 245 while true
246 do 246 do
247 if isnotplatform "macos"; then 247 if isnotplatform "macos"; then
248 break 248 break
249 fi 249 fi
250 curl-config --cflags > /dev/null 250 curl-config --cflags > /dev/null
251 if [ $? -eq 0 ]; then 251 if [ $? -eq 0 ]; then
252 CFLAGS="$CFLAGS `curl-config --cflags`" 252 TEMP_CFLAGS="$TEMP_CFLAGS `curl-config --cflags`"
253 else 253 else
254 break 254 break
255 fi 255 fi
256 curl-config --ldflags > /dev/null 256 curl-config --ldflags > /dev/null
257 if [ $? -eq 0 ]; then 257 if [ $? -eq 0 ]; then
258 LDFLAGS="$LDFLAGS `curl-config --ldflags`" 258 TEMP_LDFLAGS="$TEMP_LDFLAGS `curl-config --ldflags`"
259 else 259 else
260 break 260 break
261 fi 261 fi
262 echo yes 262 echo yes
263 return 0 263 return 0
264 done 264 done
265 265
266 # dependency curl 266 # dependency curl
267 while true 267 while true
268 do 268 do
269 if [ -z "$PKG_CONFIG" ]; then 269 if [ -z "$PKG_CONFIG" ]; then
270 break 270 break
271 fi 271 fi
272 $PKG_CONFIG libcurl 272 $PKG_CONFIG libcurl
273 if [ $? -ne 0 ] ; then 273 if [ $? -ne 0 ] ; then
274 break 274 break
275 fi 275 fi
276 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags libcurl`" 276 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libcurl`"
277 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs libcurl`" 277 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libcurl`"
278 echo yes 278 echo yes
279 return 0 279 return 0
280 done 280 done
281 281
282 # dependency curl 282 # dependency curl
283 while true 283 while true
284 do 284 do
285 curl-config --cflags > /dev/null 285 curl-config --cflags > /dev/null
286 if [ $? -eq 0 ]; then 286 if [ $? -eq 0 ]; then
287 CFLAGS="$CFLAGS `curl-config --cflags`" 287 TEMP_CFLAGS="$TEMP_CFLAGS `curl-config --cflags`"
288 else 288 else
289 break 289 break
290 fi 290 fi
291 curl-config --libs > /dev/null 291 curl-config --libs > /dev/null
292 if [ $? -eq 0 ]; then 292 if [ $? -eq 0 ]; then
293 LDFLAGS="$LDFLAGS `curl-config --libs`" 293 TEMP_LDFLAGS="$TEMP_LDFLAGS `curl-config --libs`"
294 else 294 else
295 break 295 break
296 fi 296 fi
297 echo yes 297 echo yes
298 return 0 298 return 0
299 done 299 done
300 300
301 echo no 301 echo no
302 return 1 302 return 1
303 } 303 }
304 dependency_openssl() 304 dependency_openssl()
305 { 305 {
306 printf "checking for openssl... " 306 printf "checking for openssl... "
307 # dependency openssl platform="windows" 307 # dependency openssl platform="windows"
308 while true 308 while true
309 do 309 do
310 if isnotplatform "windows"; then 310 if isnotplatform "windows"; then
311 break 311 break
312 fi 312 fi
313 LDFLAGS="$LDFLAGS -lssl -lcrypto" 313 TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto"
314 echo yes 314 echo yes
315 return 0 315 return 0
316 done 316 done
317 317
318 # dependency openssl platform="macos" 318 # dependency openssl platform="macos"
319 while true 319 while true
320 do 320 do
321 if isnotplatform "macos"; then 321 if isnotplatform "macos"; then
322 break 322 break
323 fi 323 fi
324 LDFLAGS="$LDFLAGS -framework CoreFoundation" 324 TEMP_LDFLAGS="$TEMP_LDFLAGS -framework CoreFoundation"
325 echo yes 325 echo yes
326 return 0 326 return 0
327 done 327 done
328 328
329 # dependency openssl platform="bsd" 329 # dependency openssl platform="bsd"
330 while true 330 while true
331 do 331 do
332 if isnotplatform "bsd"; then 332 if isnotplatform "bsd"; then
333 break 333 break
334 fi 334 fi
335 if isplatform "macos"; then 335 if isplatform "macos"; then
336 break 336 break
337 fi 337 fi
338 LDFLAGS="$LDFLAGS -lssl -lcrypto" 338 TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto"
339 echo yes 339 echo yes
340 return 0 340 return 0
341 done 341 done
342 342
343 # dependency openssl 343 # dependency openssl
344 while true 344 while true
345 do 345 do
346 if [ -z "$PKG_CONFIG" ]; then 346 if [ -z "$PKG_CONFIG" ]; then
347 break 347 break
348 fi 348 fi
349 $PKG_CONFIG openssl 349 $PKG_CONFIG openssl
350 if [ $? -ne 0 ] ; then 350 if [ $? -ne 0 ] ; then
351 break 351 break
352 fi 352 fi
353 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags openssl`" 353 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags openssl`"
354 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs openssl`" 354 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs openssl`"
355 echo yes 355 echo yes
356 return 0 356 return 0
357 done 357 done
358 358
359 echo no 359 echo no
360 return 1 360 return 1
361 } 361 }
362 dependency_libxml2() 362 dependency_libxml2()
363 { 363 {
364 printf "checking for libxml2... " 364 printf "checking for libxml2... "
365 # dependency libxml2 platform="windows" 365 # dependency libxml2 platform="windows"
366 while true 366 while true
367 do 367 do
368 if isnotplatform "windows"; then 368 if isnotplatform "windows"; then
369 break 369 break
370 fi 370 fi
371 xml2-config --cflags > /dev/null 371 xml2-config --cflags > /dev/null
372 if [ $? -eq 0 ]; then 372 if [ $? -eq 0 ]; then
373 CFLAGS="$CFLAGS `xml2-config --cflags`" 373 TEMP_CFLAGS="$TEMP_CFLAGS `xml2-config --cflags`"
374 else 374 else
375 break 375 break
376 fi 376 fi
377 xml2-config --libs > /dev/null 377 xml2-config --libs > /dev/null
378 if [ $? -eq 0 ]; then 378 if [ $? -eq 0 ]; then
379 LDFLAGS="$LDFLAGS `xml2-config --libs`" 379 TEMP_LDFLAGS="$TEMP_LDFLAGS `xml2-config --libs`"
380 else 380 else
381 break 381 break
382 fi 382 fi
383 echo yes 383 echo yes
384 return 0 384 return 0
385 done 385 done
386 386
387 # dependency libxml2 platform="macos" 387 # dependency libxml2 platform="macos"
388 while true 388 while true
389 do 389 do
390 if isnotplatform "macos"; then 390 if isnotplatform "macos"; then
391 break 391 break
392 fi 392 fi
393 xml2-config --cflags > /dev/null 393 xml2-config --cflags > /dev/null
394 if [ $? -eq 0 ]; then 394 if [ $? -eq 0 ]; then
395 CFLAGS="$CFLAGS `xml2-config --cflags`" 395 TEMP_CFLAGS="$TEMP_CFLAGS `xml2-config --cflags`"
396 else 396 else
397 break 397 break
398 fi 398 fi
399 xml2-config --libs > /dev/null 399 xml2-config --libs > /dev/null
400 if [ $? -eq 0 ]; then 400 if [ $? -eq 0 ]; then
401 LDFLAGS="$LDFLAGS `xml2-config --libs`" 401 TEMP_LDFLAGS="$TEMP_LDFLAGS `xml2-config --libs`"
402 else 402 else
403 break 403 break
404 fi 404 fi
405 echo yes 405 echo yes
406 return 0 406 return 0
407 done 407 done
408 408
409 # dependency libxml2 409 # dependency libxml2
410 while true 410 while true
411 do 411 do
412 if [ -z "$PKG_CONFIG" ]; then 412 if [ -z "$PKG_CONFIG" ]; then
413 break 413 break
414 fi 414 fi
415 $PKG_CONFIG libxml-2.0 415 $PKG_CONFIG libxml-2.0
416 if [ $? -ne 0 ] ; then 416 if [ $? -ne 0 ] ; then
417 break 417 break
418 fi 418 fi
419 CFLAGS="$CFLAGS `$PKG_CONFIG --cflags libxml-2.0`" 419 TEMP_CFLAGS="$TEMP_CFLAGS `$PKG_CONFIG --cflags libxml-2.0`"
420 LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs libxml-2.0`" 420 TEMP_LDFLAGS="$TEMP_LDFLAGS `$PKG_CONFIG --libs libxml-2.0`"
421 echo yes 421 echo yes
422 return 0 422 return 0
423 done 423 done
424 424
425 # dependency libxml2 425 # dependency libxml2
426 while true 426 while true
427 do 427 do
428 xml2-config --cflags > /dev/null 428 xml2-config --cflags > /dev/null
429 if [ $? -eq 0 ]; then 429 if [ $? -eq 0 ]; then
430 CFLAGS="$CFLAGS `xml2-config --cflags`" 430 TEMP_CFLAGS="$TEMP_CFLAGS `xml2-config --cflags`"
431 else 431 else
432 break 432 break
433 fi 433 fi
434 xml2-config --libs > /dev/null 434 xml2-config --libs > /dev/null
435 if [ $? -eq 0 ]; then 435 if [ $? -eq 0 ]; then
436 LDFLAGS="$LDFLAGS `xml2-config --libs`" 436 TEMP_LDFLAGS="$TEMP_LDFLAGS `xml2-config --libs`"
437 else 437 else
438 break 438 break
439 fi 439 fi
440 echo yes 440 echo yes
441 return 0 441 return 0
442 done 442 done
443 443
444 echo no 444 echo no
445 return 1 445 return 1
446 } 446 }
447 447
448 DEPENDENCIES_FAILED= 448 DEPENDENCIES_FAILED=
449 ERROR=0 449 ERROR=0
450 # general dependencies 450 # general dependencies
451 CFLAGS= 451 TEMP_CFLAGS=
452 LDFLAGS= 452 TEMP_LDFLAGS=
453 while true 453 while true
454 do 454 do
455 while true 455 while true
456 do 456 do
457 457
458 LDFLAGS="$LDFLAGS -lm -lpthread" 458 TEMP_LDFLAGS="$TEMP_LDFLAGS -lm -lpthread"
459 459
460 break 460 break
461 done 461 done
462 462
463 break 463 break
464 done 464 done
465 while true 465 while true
466 do 466 do
467 if isnotplatform "bsd"; then 467 if isnotplatform "bsd"; then
470 if isplatform "macos"; then 470 if isplatform "macos"; then
471 break 471 break
472 fi 472 fi
473 while true 473 while true
474 do 474 do
475 475
476 CFLAGS="$CFLAGS -I/usr/local/include" 476 TEMP_CFLAGS="$TEMP_CFLAGS -I/usr/local/include"
477 LDFLAGS="$LDFLAGS -L/usr/local/lib" 477 TEMP_LDFLAGS="$TEMP_LDFLAGS -L/usr/local/lib"
478 478
479 break 479 break
480 done 480 done
481 481
482 break 482 break
483 done 483 done
484 while true 484 while true
485 do 485 do
486 if isnotplatform "macos"; then 486 if isnotplatform "macos"; then
487 break 487 break
488 fi 488 fi
489 while true 489 while true
490 do 490 do
491 491
492 cat >> $TEMP_DIR/make.mk << __EOF__ 492 cat >> "$TEMP_DIR/make.mk" << __EOF__
493 OBJ_EXT = .o 493 OBJ_EXT = .o
494 LIB_EXT = .a 494 LIB_EXT = .a
495 495
496 __EOF__ 496 __EOF__
497 497
498 break 498 break
499 done 499 done
500 500
501 break 501 break
502 done 502 done
503 while true 503 while true
504 do 504 do
505 if isnotplatform "unix"; then 505 if isnotplatform "unix"; then
508 if isplatform "macos"; then 508 if isplatform "macos"; then
509 break 509 break
510 fi 510 fi
511 while true 511 while true
512 do 512 do
513 513
514 cat >> $TEMP_DIR/make.mk << __EOF__ 514 cat >> "$TEMP_DIR/make.mk" << __EOF__
515 OBJ_EXT = .o 515 OBJ_EXT = .o
516 LIB_EXT = .a 516 LIB_EXT = .a
517 517
518 __EOF__ 518 __EOF__
519 519
520 break 520 break
521 done 521 done
522 522
523 break 523 break
524 done 524 done
525 525
526 # add general dependency flags to config.mk 526 # add general dependency flags to config.mk
527 echo >> $TEMP_DIR/config.mk 527 echo >> "$TEMP_DIR/config.mk"
528 if [ ! -z "${CFLAGS}" ]; then 528 if [ -n "${TEMP_CFLAGS}" ]; then
529 echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk 529 echo "CFLAGS += $TEMP_CFLAGS" >> $TEMP_DIR/config.mk
530 fi 530 fi
531 if [ ! -z "${CXXFLAGS}" ]; then 531 if [ -n "${TEMP_CXXFLAGS}" ]; then
532 echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk 532 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> $TEMP_DIR/config.mk
533 fi 533 fi
534 if [ ! -z "${LDFLAGS}" ]; then 534 if [ -n "${TEMP_LDFLAGS}" ]; then
535 echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk 535 echo "LDFLAGS += $TEMP_LDFLAGS" >> $TEMP_DIR/config.mk
536 fi 536 fi
537 537
538 # 538 #
539 # OPTION VALUES 539 # OPTION VALUES
540 # 540 #
541 541
542 # 542 #
543 # TARGETS 543 # TARGETS
544 # 544 #
545 CFLAGS= 545 TEMP_CFLAGS=
546 CXXFLAGS= 546 TEMP_CXXFLAGS=
547 LDFLAGS= 547 TEMP_LDFLAGS=
548 548
549 # Target: dav 549 # Target: dav
550 CFLAGS= 550 TEMP_CFLAGS=
551 LDFLAGS= 551 TEMP_LDFLAGS=
552 CXXFLAGS= 552 TEMP_CXXFLAGS=
553 553
554 dependency_curl 554 dependency_curl
555 if [ $? -ne 0 ]; then 555 if [ $? -ne 0 ]; then
556 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl " 556 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl "
557 ERROR=1 557 ERROR=1
558 fi 558 fi
559 dependency_libxml2 559 dependency_libxml2
560 if [ $? -ne 0 ]; then 560 if [ $? -ne 0 ]; then
561 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " 561 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
562 ERROR=1 562 ERROR=1
563 fi 563 fi
564 dependency_openssl 564 dependency_openssl
565 if [ $? -ne 0 ]; then 565 if [ $? -ne 0 ]; then
566 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl " 566 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
567 ERROR=1 567 ERROR=1
568 fi 568 fi
569 569
570 # Features 570 # Features
571 571
572 572
573 echo >> $TEMP_DIR/config.mk 573 echo >> "$TEMP_DIR/config.mk"
574 if [ ! -z "${CFLAGS}" ]; then 574 if [ -n "${TEMP_CFLAGS}" ]; then
575 echo "DAV_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk 575 echo "DAV_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/config.mk"
576 fi 576 fi
577 if [ ! -z "${CXXFLAGS}" ]; then 577 if [ -n "${TEMP_CXXFLAGS}" ]; then
578 echo "DAV_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk 578 echo "DAV_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/config.mk"
579 fi 579 fi
580 if [ ! -z "${LDFLAGS}" ]; then 580 if [ -n "${TEMP_LDFLAGS}" ]; then
581 echo "DAV_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk 581 echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/config.mk"
582 fi 582 fi
583 583
584 if [ $ERROR -ne 0 ]; then 584 if [ $ERROR -ne 0 ]; then
585 echo 585 echo
586 echo "Error: Unresolved dependencies" 586 echo "Error: Unresolved dependencies"
587 echo $DEPENDENCIES_FAILED 587 echo "$DEPENDENCIES_FAILED"
588 rm -Rf $TEMP_DIR 588 rm -Rf "$TEMP_DIR"
589 exit 1 589 exit 1
590 fi 590 fi
591 591
592 echo "configure finished" 592 echo "configure finished"
593 echo 593 echo
594 echo "Build Config:" 594 echo "Build Config:"
595 echo " PREFIX: $PREFIX" 595 echo " PREFIX: $PREFIX"
596 echo " TOOLCHAIN: $TOOLCHAIN_NAME" 596 echo " TOOLCHAIN: $TOOLCHAIN_NAME"
597 echo 597 echo
598 cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk 598 cat "$TEMP_DIR/config.mk" "$TEMP_DIR/make.mk" > config.mk
599 rm -Rf $TEMP_DIR 599 rm -Rf "$TEMP_DIR"
600 600
601 601

mercurial