|
1 #!/bin/sh |
|
2 |
|
3 # create temporary directory |
|
4 TEMP_DIR=".tmp-`uname -n`" |
|
5 rm -Rf "$TEMP_DIR" |
|
6 if mkdir -p "$TEMP_DIR"; then |
|
7 : |
|
8 else |
|
9 echo "Cannot create tmp dir $TEMP_DIR" |
|
10 echo "Abort" |
|
11 exit 1 |
|
12 fi |
|
13 touch "$TEMP_DIR/options" |
|
14 touch "$TEMP_DIR/features" |
|
15 |
|
16 # define standard variables |
|
17 # also define standard prefix (this is where we will search for config.site) |
|
18 prefix=/usr |
|
19 exec_prefix= |
|
20 bindir= |
|
21 sbindir= |
|
22 libdir= |
|
23 libexecdir= |
|
24 datarootdir= |
|
25 datadir= |
|
26 sysconfdir= |
|
27 sharedstatedir= |
|
28 localstatedir= |
|
29 runstatedir= |
|
30 includedir= |
|
31 infodir= |
|
32 localedir= |
|
33 mandir= |
|
34 |
|
35 # custom variables |
|
36 |
|
37 # features |
|
38 FEATURE_DB=auto |
|
39 |
|
40 # clean abort |
|
41 abort_configure() |
|
42 { |
|
43 rm -Rf "$TEMP_DIR" |
|
44 exit 1 |
|
45 } |
|
46 |
|
47 # help text |
|
48 printhelp() |
|
49 { |
|
50 echo "Usage: $0 [OPTIONS]..." |
|
51 cat << __EOF__ |
|
52 Installation directories: |
|
53 --prefix=PREFIX path prefix for architecture-independent files |
|
54 [/usr] |
|
55 --exec-prefix=EPREFIX path prefix for architecture-dependent files |
|
56 [PREFIX] |
|
57 |
|
58 --bindir=DIR user executables [EPREFIX/bin] |
|
59 --sbindir=DIR system admin executables [EPREFIX/sbin] |
|
60 --libexecdir=DIR program executables [EPREFIX/libexec] |
|
61 --sysconfdir=DIR system configuration files [PREFIX/etc] |
|
62 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] |
|
63 --localstatedir=DIR modifiable single-machine data [PREFIX/var] |
|
64 --runstatedir=DIR run-time variable data [LOCALSTATEDIR/run] |
|
65 --libdir=DIR object code libraries [EPREFIX/lib] |
|
66 --includedir=DIR C header files [PREFIX/include] |
|
67 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] |
|
68 --datadir=DIR read-only architecture-independent data [DATAROOTDIR] |
|
69 --infodir=DIR info documentation [DATAROOTDIR/info] |
|
70 --mandir=DIR man documentation [DATAROOTDIR/man] |
|
71 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] |
|
72 |
|
73 Options: |
|
74 --debug add extra compile flags for debug builds |
|
75 --release add extra compile flags for release builds |
|
76 --toolkit=(gtk3|cli|gtk2|wpf) |
|
77 |
|
78 Optional Features: |
|
79 --disable-db Needlessly adds a completely useless SQLite |
|
80 database. |
|
81 --enable-gui |
|
82 |
|
83 __EOF__ |
|
84 } |
|
85 |
|
86 # |
|
87 # parse arguments |
|
88 # |
|
89 BUILD_TYPE="default" |
|
90 for ARG in "$@" |
|
91 do |
|
92 case "$ARG" in |
|
93 "--prefix="*) prefix=${ARG#--prefix=} ;; |
|
94 "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;; |
|
95 "--bindir="*) bindir=${ARG#----bindir=} ;; |
|
96 "--sbindir="*) sbindir=${ARG#--sbindir=} ;; |
|
97 "--libdir="*) libdir=${ARG#--libdir=} ;; |
|
98 "--libexecdir="*) libexecdir=${ARG#--libexecdir=} ;; |
|
99 "--datarootdir="*) datarootdir=${ARG#--datarootdir=} ;; |
|
100 "--datadir="*) datadir=${ARG#--datadir=} ;; |
|
101 "--sysconfdir="*) sysconfdir=${ARG#--sysconfdir=} ;; |
|
102 "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;; |
|
103 "--localstatedir="*) localstatedir=${ARG#--localstatedir=} ;; |
|
104 "--includedir="*) includedir=${ARG#--includedir=} ;; |
|
105 "--infodir="*) infodir=${ARG#--infodir=} ;; |
|
106 "--mandir"*) mandir=${ARG#--mandir} ;; |
|
107 "--localedir"*) localedir=${ARG#--localedir} ;; |
|
108 "--help"*) printhelp; abort_configure ;; |
|
109 "--debug") BUILD_TYPE="debug" ;; |
|
110 "--release") BUILD_TYPE="release" ;; |
|
111 "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;; |
|
112 "--enable-db") FEATURE_DB=on ;; |
|
113 "--disable-db") unset FEATURE_DB ;; |
|
114 "--enable-gui") FEATURE_GUI=on ;; |
|
115 "--disable-gui") unset FEATURE_GUI ;; |
|
116 "-"*) echo "unknown option: $ARG"; abort_configure ;; |
|
117 esac |
|
118 done |
|
119 |
|
120 |
|
121 |
|
122 # set defaults for dir variables |
|
123 : ${exec_prefix:="$prefix"} |
|
124 : ${bindir:='${exec_prefix}/bin'} |
|
125 : ${sbindir:='${exec_prefix}/sbin'} |
|
126 : ${libdir:='${exec_prefix}/lib'} |
|
127 : ${libexecdir:='${exec_prefix}/libexec'} |
|
128 : ${datarootdir:='${prefix}/share'} |
|
129 : ${datadir:='${datarootdir}'} |
|
130 : ${sysconfdir:='${prefix}/etc'} |
|
131 : ${sharedstatedir:='${prefix}/com'} |
|
132 : ${localstatedir:='${prefix}/var'} |
|
133 : ${runstatedir:='${localstatedir}/run'} |
|
134 : ${includedir:='${prefix}/include'} |
|
135 : ${infodir:='${datarootdir}/info'} |
|
136 : ${mandir:='${datarootdir}/man'} |
|
137 : ${localedir:='${datarootdir}/locale'} |
|
138 |
|
139 # check if a config.site exists and load it |
|
140 if [ -n "$CONFIG_SITE" ]; then |
|
141 # CONFIG_SITE may contain space separated file names |
|
142 for cs in $CONFIG_SITE; do |
|
143 printf "loading defaults from $cs... " |
|
144 . "$cs" |
|
145 echo ok |
|
146 done |
|
147 elif [ -f "$prefix/share/config.site" ]; then |
|
148 printf "loading site defaults... " |
|
149 . "$prefix/share/config.site" |
|
150 echo ok |
|
151 elif [ -f "$prefix/etc/config.site" ]; then |
|
152 printf "loading site defaults... " |
|
153 . "$prefix/etc/config.site" |
|
154 echo ok |
|
155 fi |
|
156 |
|
157 # Test for availability of pkg-config |
|
158 PKG_CONFIG=`command -v pkg-config` |
|
159 : ${PKG_CONFIG:="false"} |
|
160 |
|
161 # Simple uname based platform detection |
|
162 # $PLATFORM is used for platform dependent dependency selection |
|
163 OS=`uname -s` |
|
164 OS_VERSION=`uname -r` |
|
165 printf "detect platform... " |
|
166 if [ "$OS" = "SunOS" ]; then |
|
167 PLATFORM="solaris sunos unix svr4" |
|
168 fi |
|
169 if [ "$OS" = "Linux" ]; then |
|
170 PLATFORM="linux unix" |
|
171 fi |
|
172 if [ "$OS" = "FreeBSD" ]; then |
|
173 PLATFORM="freebsd bsd unix" |
|
174 fi |
|
175 if [ "$OS" = "Darwin" ]; then |
|
176 PLATFORM="macos osx bsd unix" |
|
177 fi |
|
178 if echo "$OS" | grep -i "MINGW" > /dev/null; then |
|
179 PLATFORM="windows mingw" |
|
180 fi |
|
181 : ${PLATFORM:="unix"} |
|
182 |
|
183 PLATFORM_NAME=`echo "$PLATFORM" | cut -f1 -d' ' -` |
|
184 echo "$PLATFORM_NAME" |
|
185 |
|
186 isplatform() |
|
187 { |
|
188 for p in $PLATFORM |
|
189 do |
|
190 if [ "$p" = "$1" ]; then |
|
191 return 0 |
|
192 fi |
|
193 done |
|
194 return 1 |
|
195 } |
|
196 notisplatform() |
|
197 { |
|
198 for p in $PLATFORM |
|
199 do |
|
200 if [ "$p" = "$1" ]; then |
|
201 return 1 |
|
202 fi |
|
203 done |
|
204 return 0 |
|
205 } |
|
206 |
|
207 |
|
208 # generate vars.mk |
|
209 cat > "$TEMP_DIR/vars.mk" << __EOF__ |
|
210 prefix="$prefix" |
|
211 exec_prefix="$exec_prefix" |
|
212 bindir="$bindir" |
|
213 sbindir="$sbindir" |
|
214 libdir="$libdir" |
|
215 libexecdir="$libexecdir" |
|
216 datarootdir="$datarootdir" |
|
217 datadir="$datadir" |
|
218 sysconfdir="$sysconfdir" |
|
219 sharedstatedir="$sharedstatedir" |
|
220 localstatedir="$localstatedir" |
|
221 runstatedir="$runstatedir" |
|
222 includedir="$includedir" |
|
223 infodir="$infodir" |
|
224 mandir="$mandir" |
|
225 localedir="$localedir" |
|
226 __EOF__ |
|
227 |
|
228 # toolchain detection utilities |
|
229 . make/toolchain.sh |
|
230 |
|
231 # |
|
232 # DEPENDENCIES |
|
233 # |
|
234 |
|
235 # check languages |
|
236 lang_c= |
|
237 lang_cpp= |
|
238 if detect_c_compiler ; then |
|
239 lang_c=1 |
|
240 fi |
|
241 |
|
242 # create buffer for make variables required by dependencies |
|
243 echo > "$TEMP_DIR/make.mk" |
|
244 |
|
245 test_pkg_config() |
|
246 { |
|
247 if "$PKG_CONFIG" --exists "$1" ; then : |
|
248 else return 1 ; fi |
|
249 if [ -z "$2" ] || "$PKG_CONFIG" --atleast-version="$2" "$1" ; then : |
|
250 else return 1 ; fi |
|
251 if [ -z "$3" ] || "$PKG_CONFIG" --exact-version="$3" "$1" ; then : |
|
252 else return 1 ; fi |
|
253 if [ -z "$4" ] || "$PKG_CONFIG" --max-version="$4" "$1" ; then : |
|
254 else return 1 ; fi |
|
255 return 0 |
|
256 } |
|
257 |
|
258 print_check_msg() |
|
259 { |
|
260 if [ -z "$1" ]; then |
|
261 shift |
|
262 printf "$@" |
|
263 fi |
|
264 } |
|
265 |
|
266 dependency_error_qt4() |
|
267 { |
|
268 print_check_msg "$dep_checked_qt4" "checking for qt4... " |
|
269 # dependency qt4 |
|
270 while true |
|
271 do |
|
272 if which qmake-qt4 > /dev/null ; then |
|
273 : |
|
274 else |
|
275 break |
|
276 fi |
|
277 print_check_msg "$dep_checked_qt4" "yes\n" |
|
278 dep_checked_qt4=1 |
|
279 return 1 |
|
280 done |
|
281 |
|
282 print_check_msg "$dep_checked_qt4" "no\n" |
|
283 dep_checked_qt4=1 |
|
284 return 0 |
|
285 } |
|
286 dependency_error_curl() |
|
287 { |
|
288 print_check_msg "$dep_checked_curl" "checking for curl... " |
|
289 # dependency curl platform="windows" |
|
290 while true |
|
291 do |
|
292 if notisplatform "windows"; then |
|
293 break |
|
294 fi |
|
295 TEMP_CFLAGS="$TEMP_CFLAGS -I/mingw/include" |
|
296 TEMP_LDFLAGS="$TEMP_LDFLAGS -lcurl" |
|
297 print_check_msg "$dep_checked_curl" "yes\n" |
|
298 dep_checked_curl=1 |
|
299 return 1 |
|
300 done |
|
301 |
|
302 # dependency curl platform="macos" |
|
303 while true |
|
304 do |
|
305 if notisplatform "macos"; then |
|
306 break |
|
307 fi |
|
308 if tmp_flags=`curl-config --cflags` ; then |
|
309 TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags" |
|
310 else |
|
311 break |
|
312 fi |
|
313 if tmp_flags=`curl-config --ldflags` ; then |
|
314 TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags" |
|
315 else |
|
316 break |
|
317 fi |
|
318 print_check_msg "$dep_checked_curl" "yes\n" |
|
319 dep_checked_curl=1 |
|
320 return 1 |
|
321 done |
|
322 |
|
323 # dependency curl |
|
324 while true |
|
325 do |
|
326 if [ -z "$PKG_CONFIG" ]; then |
|
327 break |
|
328 fi |
|
329 if test_pkg_config "libcurl" "" "" "" ; then |
|
330 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libcurl`" |
|
331 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libcurl`" |
|
332 else |
|
333 break |
|
334 fi |
|
335 print_check_msg "$dep_checked_curl" "yes\n" |
|
336 dep_checked_curl=1 |
|
337 return 1 |
|
338 done |
|
339 |
|
340 print_check_msg "$dep_checked_curl" "no\n" |
|
341 dep_checked_curl=1 |
|
342 return 0 |
|
343 } |
|
344 dependency_error_gtk2() |
|
345 { |
|
346 print_check_msg "$dep_checked_gtk2" "checking for gtk2... " |
|
347 # dependency gtk2 |
|
348 while true |
|
349 do |
|
350 if [ -z "$PKG_CONFIG" ]; then |
|
351 break |
|
352 fi |
|
353 if test_pkg_config "gtk+-2.0" "" "" "" ; then |
|
354 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-2.0`" |
|
355 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-2.0`" |
|
356 else |
|
357 break |
|
358 fi |
|
359 print_check_msg "$dep_checked_gtk2" "yes\n" |
|
360 dep_checked_gtk2=1 |
|
361 return 1 |
|
362 done |
|
363 |
|
364 print_check_msg "$dep_checked_gtk2" "no\n" |
|
365 dep_checked_gtk2=1 |
|
366 return 0 |
|
367 } |
|
368 dependency_error_sqlite() |
|
369 { |
|
370 print_check_msg "$dep_checked_sqlite" "checking for sqlite... " |
|
371 # dependency sqlite |
|
372 while true |
|
373 do |
|
374 if [ -z "$PKG_CONFIG" ]; then |
|
375 break |
|
376 fi |
|
377 if test_pkg_config "sqlite3" "" "" "" ; then |
|
378 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags sqlite3`" |
|
379 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs sqlite3`" |
|
380 else |
|
381 break |
|
382 fi |
|
383 print_check_msg "$dep_checked_sqlite" "yes\n" |
|
384 dep_checked_sqlite=1 |
|
385 return 1 |
|
386 done |
|
387 |
|
388 print_check_msg "$dep_checked_sqlite" "no\n" |
|
389 dep_checked_sqlite=1 |
|
390 return 0 |
|
391 } |
|
392 dependency_error_test() |
|
393 { |
|
394 print_check_msg "$dep_checked_test" "checking for test... " |
|
395 # dependency test platform="bsd" |
|
396 while true |
|
397 do |
|
398 if notisplatform "bsd"; then |
|
399 break |
|
400 fi |
|
401 if isplatform "macos"; then |
|
402 break |
|
403 fi |
|
404 TEMP_CFLAGS="$TEMP_CFLAGS -DBSD" |
|
405 print_check_msg "$dep_checked_test" "yes\n" |
|
406 dep_checked_test=1 |
|
407 return 1 |
|
408 done |
|
409 |
|
410 # dependency test |
|
411 while true |
|
412 do |
|
413 TEMP_CFLAGS="$TEMP_CFLAGS -DTEST" |
|
414 print_check_msg "$dep_checked_test" "yes\n" |
|
415 dep_checked_test=1 |
|
416 return 1 |
|
417 done |
|
418 |
|
419 print_check_msg "$dep_checked_test" "no\n" |
|
420 dep_checked_test=1 |
|
421 return 0 |
|
422 } |
|
423 dependency_error_gtk3() |
|
424 { |
|
425 print_check_msg "$dep_checked_gtk3" "checking for gtk3... " |
|
426 # dependency gtk3 |
|
427 while true |
|
428 do |
|
429 if [ -z "$PKG_CONFIG" ]; then |
|
430 break |
|
431 fi |
|
432 if test_pkg_config "gtk+-5.0" "" "" "" ; then |
|
433 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-5.0`" |
|
434 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-5.0`" |
|
435 else |
|
436 break |
|
437 fi |
|
438 print_check_msg "$dep_checked_gtk3" "yes\n" |
|
439 dep_checked_gtk3=1 |
|
440 return 1 |
|
441 done |
|
442 |
|
443 print_check_msg "$dep_checked_gtk3" "no\n" |
|
444 dep_checked_gtk3=1 |
|
445 return 0 |
|
446 } |
|
447 dependency_error_deptest() |
|
448 { |
|
449 print_check_msg "$dep_checked_deptest" "checking for deptest... " |
|
450 # dependency deptest |
|
451 while true |
|
452 do |
|
453 TEMP_CFLAGS="$TEMP_CFLAGS -DDEPTEST" |
|
454 print_check_msg "$dep_checked_deptest" "yes\n" |
|
455 dep_checked_deptest=1 |
|
456 return 1 |
|
457 done |
|
458 |
|
459 print_check_msg "$dep_checked_deptest" "no\n" |
|
460 dep_checked_deptest=1 |
|
461 return 0 |
|
462 } |
|
463 dependency_error_libxml2() |
|
464 { |
|
465 print_check_msg "$dep_checked_libxml2" "checking for libxml2... " |
|
466 # dependency libxml2 |
|
467 while true |
|
468 do |
|
469 if [ -z "$PKG_CONFIG" ]; then |
|
470 break |
|
471 fi |
|
472 if test_pkg_config "libxml-2.0" "2.8" "" "" ; then |
|
473 TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`" |
|
474 TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`" |
|
475 else |
|
476 break |
|
477 fi |
|
478 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
479 # Dependency: libxml2 |
|
480 xml = libxml2 |
|
481 |
|
482 __EOF__ |
|
483 print_check_msg "$dep_checked_libxml2" "yes\n" |
|
484 dep_checked_libxml2=1 |
|
485 return 1 |
|
486 done |
|
487 |
|
488 print_check_msg "$dep_checked_libxml2" "no\n" |
|
489 dep_checked_libxml2=1 |
|
490 return 0 |
|
491 } |
|
492 |
|
493 # start collecting dependency information |
|
494 echo > "$TEMP_DIR/flags.mk" |
|
495 |
|
496 DEPENDENCIES_FAILED= |
|
497 ERROR=0 |
|
498 # unnamed dependencies |
|
499 TEMP_CFLAGS= |
|
500 TEMP_CXXFLAGS= |
|
501 TEMP_LDFLAGS= |
|
502 while true |
|
503 do |
|
504 while true |
|
505 do |
|
506 if [ -z "$lang_c" ] ; then |
|
507 ERROR=1 |
|
508 break |
|
509 fi |
|
510 |
|
511 cat >> "$TEMP_DIR/make.mk" << __EOF__ |
|
512 MVAR = 123 |
|
513 MVAR += 123 |
|
514 |
|
515 __EOF__ |
|
516 break |
|
517 done |
|
518 break |
|
519 done |
|
520 |
|
521 # add general dependency flags to flags.mk |
|
522 echo "# general flags" >> "$TEMP_DIR/flags.mk" |
|
523 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
|
524 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
|
525 fi |
|
526 if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
|
527 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
|
528 fi |
|
529 if [ -n "${TEMP_LDFLAGS}" ]; then |
|
530 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
|
531 fi |
|
532 |
|
533 # |
|
534 # OPTION VALUES |
|
535 # |
|
536 checkopt_toolkit_gtk3() |
|
537 { |
|
538 VERR=0 |
|
539 if dependency_error_gtk3 ; then |
|
540 VERR=1 |
|
541 fi |
|
542 if [ $VERR -ne 0 ]; then |
|
543 return 1 |
|
544 fi |
|
545 TEMP_CFLAGS="$TEMP_CFLAGS -Da=b" |
|
546 TEMP_CXXFLAGS="$TEMP_CXXFLAGS -Da=b" |
|
547 cat >> "$TEMP_DIR/make.mk" << __EOF__ |
|
548 UIOBJ += graphics_cairo.o |
|
549 |
|
550 __EOF__ |
|
551 return 0 |
|
552 } |
|
553 checkopt_toolkit_cli() |
|
554 { |
|
555 VERR=0 |
|
556 if dependency_error_curl ; then |
|
557 VERR=1 |
|
558 fi |
|
559 if dependency_error_test ; then |
|
560 VERR=1 |
|
561 fi |
|
562 if [ $VERR -ne 0 ]; then |
|
563 return 1 |
|
564 fi |
|
565 return 0 |
|
566 } |
|
567 checkopt_toolkit_gtk2() |
|
568 { |
|
569 VERR=0 |
|
570 if dependency_error_gtk2 ; then |
|
571 VERR=1 |
|
572 fi |
|
573 if [ $VERR -ne 0 ]; then |
|
574 return 1 |
|
575 fi |
|
576 return 0 |
|
577 } |
|
578 checkopt_toolkit_wpf() |
|
579 { |
|
580 VERR=0 |
|
581 if dependency_error_test ; then |
|
582 VERR=1 |
|
583 fi |
|
584 if [ $VERR -ne 0 ]; then |
|
585 return 1 |
|
586 fi |
|
587 return 0 |
|
588 } |
|
589 |
|
590 # |
|
591 # TARGETS |
|
592 # |
|
593 |
|
594 echo >> "$TEMP_DIR/flags.mk" |
|
595 echo "configuring target: dav" |
|
596 echo "# flags for target dav" >> "$TEMP_DIR/flags.mk" |
|
597 TEMP_CFLAGS= |
|
598 TEMP_CXXFLAGS= |
|
599 TEMP_LDFLAGS= |
|
600 |
|
601 if dependency_error_curl; then |
|
602 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl " |
|
603 ERROR=1 |
|
604 fi |
|
605 if dependency_error_libxml2; then |
|
606 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 " |
|
607 ERROR=1 |
|
608 fi |
|
609 if dependency_error_test; then |
|
610 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED test " |
|
611 ERROR=1 |
|
612 fi |
|
613 |
|
614 # Features |
|
615 if [ -n "$FEATURE_DB" ]; then |
|
616 # check dependency |
|
617 if dependency_error_sqlite ; then |
|
618 # "auto" features can fail and are just disabled in this case |
|
619 if [ "$FEATURE_DB" = "auto" ]; then |
|
620 DISABLE_FEATURE_DB=1 |
|
621 else |
|
622 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sqlite " |
|
623 ERROR=1 |
|
624 fi |
|
625 fi |
|
626 if [ -n "$DISABLE_FEATURE_DB" ]; then |
|
627 unset FEATURE_DB |
|
628 fi |
|
629 fi |
|
630 if [ -n "$FEATURE_GUI" ]; then |
|
631 # check dependency |
|
632 if dependency_error_gtk3 ; then |
|
633 # "auto" features can fail and are just disabled in this case |
|
634 if [ "$FEATURE_GUI" = "auto" ]; then |
|
635 DISABLE_FEATURE_GUI=1 |
|
636 else |
|
637 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED gtk3 " |
|
638 ERROR=1 |
|
639 fi |
|
640 fi |
|
641 if [ -n "$DISABLE_FEATURE_GUI" ]; then |
|
642 unset FEATURE_GUI |
|
643 fi |
|
644 fi |
|
645 |
|
646 # Option: --toolkit |
|
647 if [ -z "$OPT_TOOLKIT" ]; then |
|
648 echo "auto-detecting option 'toolkit'" |
|
649 SAVED_ERROR="$ERROR" |
|
650 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" |
|
651 ERROR=1 |
|
652 while true |
|
653 do |
|
654 if isplatform "windows"; then |
|
655 if checkopt_toolkit_wpf ; then |
|
656 echo " toolkit: wpf" >> "$TEMP_DIR/options" |
|
657 ERROR=0 |
|
658 break |
|
659 fi |
|
660 fi |
|
661 if checkopt_toolkit_gtk3 ; then |
|
662 echo " toolkit: gtk3" >> "$TEMP_DIR/options" |
|
663 ERROR=0 |
|
664 break |
|
665 fi |
|
666 if checkopt_toolkit_gtk2 ; then |
|
667 echo " toolkit: gtk2" >> "$TEMP_DIR/options" |
|
668 ERROR=0 |
|
669 break |
|
670 fi |
|
671 break |
|
672 done |
|
673 if [ $ERROR -ne 0 ]; then |
|
674 SAVED_ERROR=1 |
|
675 SAVED_DEPENDENCIES_FAILED="option 'toolkit' $SAVED_DEPENDENCIES_FAILED" |
|
676 fi |
|
677 ERROR="$SAVED_ERROR" |
|
678 DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED" |
|
679 else |
|
680 echo "checking option toolkit = $OPT_TOOLKIT" |
|
681 if false; then |
|
682 false |
|
683 elif [ "$OPT_TOOLKIT" = "gtk3" ]; then |
|
684 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
685 if checkopt_toolkit_gtk3 ; then |
|
686 : |
|
687 else |
|
688 ERROR=1 |
|
689 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" |
|
690 fi |
|
691 elif [ "$OPT_TOOLKIT" = "cli" ]; then |
|
692 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
693 if checkopt_toolkit_cli ; then |
|
694 : |
|
695 else |
|
696 ERROR=1 |
|
697 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" |
|
698 fi |
|
699 elif [ "$OPT_TOOLKIT" = "gtk2" ]; then |
|
700 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
701 if checkopt_toolkit_gtk2 ; then |
|
702 : |
|
703 else |
|
704 ERROR=1 |
|
705 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" |
|
706 fi |
|
707 elif [ "$OPT_TOOLKIT" = "wpf" ]; then |
|
708 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
709 if checkopt_toolkit_wpf ; then |
|
710 : |
|
711 else |
|
712 ERROR=1 |
|
713 DEPENDENCIES_FAILED="option 'toolkit' $DEPENDENCIES_FAILED" |
|
714 fi |
|
715 fi |
|
716 fi |
|
717 |
|
718 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
|
719 echo "DAV_CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
|
720 fi |
|
721 if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
|
722 echo "DAV_CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
|
723 fi |
|
724 if [ "$BUILD_TYPE" = "debug" ]; then |
|
725 if [ -n "$lang_c" ]; then |
|
726 echo 'DAV_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
727 fi |
|
728 if [ -n "$lang_cpp" ]; then |
|
729 echo 'DAV_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
730 fi |
|
731 fi |
|
732 if [ "$BUILD_TYPE" = "release" ]; then |
|
733 if [ -n "$lang_c" ]; then |
|
734 echo 'DAV_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
735 fi |
|
736 if [ -n "$lang_cpp" ]; then |
|
737 echo 'DAV_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
738 fi |
|
739 fi |
|
740 if [ -n "${TEMP_LDFLAGS}" ]; then |
|
741 echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
|
742 fi |
|
743 |
|
744 echo >> "$TEMP_DIR/flags.mk" |
|
745 echo "configuring global target" |
|
746 echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk" |
|
747 TEMP_CFLAGS= |
|
748 TEMP_CXXFLAGS= |
|
749 TEMP_LDFLAGS= |
|
750 |
|
751 if dependency_error_deptest; then |
|
752 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED deptest " |
|
753 ERROR=1 |
|
754 fi |
|
755 |
|
756 # Features |
|
757 |
|
758 |
|
759 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then |
|
760 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" |
|
761 fi |
|
762 if [ -n "${TEMP_CXXFLAGS}" ] && [ -n "$lang_cpp" ]; then |
|
763 echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk" |
|
764 fi |
|
765 if [ "$BUILD_TYPE" = "debug" ]; then |
|
766 if [ -n "$lang_c" ]; then |
|
767 echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
768 fi |
|
769 if [ -n "$lang_cpp" ]; then |
|
770 echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
771 fi |
|
772 fi |
|
773 if [ "$BUILD_TYPE" = "release" ]; then |
|
774 if [ -n "$lang_c" ]; then |
|
775 echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
776 fi |
|
777 if [ -n "$lang_cpp" ]; then |
|
778 echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk" |
|
779 fi |
|
780 fi |
|
781 if [ -n "${TEMP_LDFLAGS}" ]; then |
|
782 echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk" |
|
783 fi |
|
784 |
|
785 |
|
786 # final result |
|
787 if [ $ERROR -ne 0 ]; then |
|
788 echo |
|
789 echo "Error: Unresolved dependencies" |
|
790 echo "$DEPENDENCIES_FAILED" |
|
791 abort_configure |
|
792 fi |
|
793 |
|
794 echo "configure finished" |
|
795 echo |
|
796 echo "Build Config:" |
|
797 echo " PREFIX: $prefix" |
|
798 echo " TOOLCHAIN: $TOOLCHAIN_NAME" |
|
799 echo "Options:" |
|
800 cat "$TEMP_DIR/options" |
|
801 echo "Features:" |
|
802 if [ -n "$FEATURE_DB" ]; then |
|
803 echo " db: on" |
|
804 else |
|
805 echo " db: off" |
|
806 fi |
|
807 if [ -n "$FEATURE_GUI" ]; then |
|
808 echo " gui: on" |
|
809 else |
|
810 echo " gui: off" |
|
811 fi |
|
812 echo |
|
813 |
|
814 # generate the config.mk file |
|
815 cat > "$TEMP_DIR/config.mk" << __EOF__ |
|
816 # |
|
817 # config.mk generated by configure |
|
818 # |
|
819 |
|
820 __EOF__ |
|
821 write_toolchain_defaults "$TEMP_DIR/toolchain.mk" |
|
822 cat "$TEMP_DIR/vars.mk" "$TEMP_DIR/toolchain.mk" "$TEMP_DIR/flags.mk" "$TEMP_DIR/make.mk" > config.mk |
|
823 rm -Rf "$TEMP_DIR" |