configure

changeset 766
e59b76889f00
parent 759
475335643af4
child 772
4586a84c0c0b
equal deleted inserted replaced
765:b5128bb44459 766:e59b76889f00
34 34
35 # custom variables 35 # custom variables
36 src_dir=`pwd` 36 src_dir=`pwd`
37 DOXYGEN=`command -v doxygen` 37 DOXYGEN=`command -v doxygen`
38 PANDOC=`command -v pandoc` 38 PANDOC=`command -v pandoc`
39 CMAKE=`command -v cmake`
40 39
41 # features 40 # features
42 41
43 # clean abort 42 # clean abort
44 abort_configure() 43 abort_configure()
74 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] 73 --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
75 74
76 Options: 75 Options:
77 --debug add extra compile flags for debug builds 76 --debug add extra compile flags for debug builds
78 --release add extra compile flags for release builds 77 --release add extra compile flags for release builds
79 --with-tests=(yes|no)
80 --with-docs=(all|html|api|none) 78 --with-docs=(all|html|api|none)
81 79
82 __EOF__ 80 __EOF__
83 } 81 }
84 82
105 "--mandir"*) mandir=${ARG#--mandir} ;; 103 "--mandir"*) mandir=${ARG#--mandir} ;;
106 "--localedir"*) localedir=${ARG#--localedir} ;; 104 "--localedir"*) localedir=${ARG#--localedir} ;;
107 "--help"*) printhelp; abort_configure ;; 105 "--help"*) printhelp; abort_configure ;;
108 "--debug") BUILD_TYPE="debug" ;; 106 "--debug") BUILD_TYPE="debug" ;;
109 "--release") BUILD_TYPE="release" ;; 107 "--release") BUILD_TYPE="release" ;;
110 "--with-tests="*) OPT_WITH_TESTS=${ARG#--with-tests=} ;;
111 "--with-docs="*) OPT_WITH_DOCS=${ARG#--with-docs=} ;; 108 "--with-docs="*) OPT_WITH_DOCS=${ARG#--with-docs=} ;;
112 "-"*) echo "unknown option: $ARG"; abort_configure ;; 109 "-"*) echo "unknown option: $ARG"; abort_configure ;;
113 esac 110 esac
114 done 111 done
115 112
220 mandir="$mandir" 217 mandir="$mandir"
221 localedir="$localedir" 218 localedir="$localedir"
222 src_dir="$src_dir" 219 src_dir="$src_dir"
223 DOXYGEN="$DOXYGEN" 220 DOXYGEN="$DOXYGEN"
224 PANDOC="$PANDOC" 221 PANDOC="$PANDOC"
225 CMAKE="$CMAKE"
226 __EOF__ 222 __EOF__
227 223
228 # toolchain detection utilities 224 # toolchain detection utilities
229 . make/toolchain.sh 225 . make/toolchain.sh
230 226
233 # 229 #
234 230
235 # check languages 231 # check languages
236 lang_c= 232 lang_c=
237 lang_cpp= 233 lang_cpp=
238 if detect_cpp_compiler ; then
239 lang_cpp=1
240 fi
241 if detect_c_compiler ; then 234 if detect_c_compiler ; then
242 lang_c=1 235 lang_c=1
243 fi 236 fi
244 237
245 # create buffer for make variables required by dependencies 238 # create buffer for make variables required by dependencies
274 done 267 done
275 268
276 echo no 269 echo no
277 return 0 270 return 0
278 } 271 }
279 dependency_error_cpp()
280 {
281 printf "checking for cpp... "
282 # dependency cpp
283 while true
284 do
285 if [ -z "$lang_cpp" ] ; then
286 break
287 fi
288 echo yes
289 return 1
290 done
291
292 echo no
293 return 0
294 }
295 dependency_error_c() 272 dependency_error_c()
296 { 273 {
297 printf "checking for c... " 274 printf "checking for c... "
298 # dependency c platform="mingw" 275 # dependency c platform="mingw"
299 while true 276 while true
382 done 359 done
383 360
384 echo no 361 echo no
385 return 0 362 return 0
386 } 363 }
387 dependency_error_cmake()
388 {
389 printf "checking for cmake... "
390 # dependency cmake
391 while true
392 do
393 if test -n "$CMAKE" > /dev/null ; then
394 :
395 else
396 break
397 fi
398 echo yes
399 return 1
400 done
401
402 echo no
403 return 0
404 }
405 dependency_error_doxygen() 364 dependency_error_doxygen()
406 { 365 {
407 printf "checking for doxygen... " 366 printf "checking for doxygen... "
408 # dependency doxygen 367 # dependency doxygen
409 while true 368 while true
468 fi 427 fi
469 428
470 # 429 #
471 # OPTION VALUES 430 # OPTION VALUES
472 # 431 #
473 checkopt_with_tests_yes()
474 {
475 VERR=0
476 if dependency_error_cpp ; then
477 VERR=1
478 fi
479 if dependency_error_cmake ; then
480 VERR=1
481 fi
482 if [ $VERR -ne 0 ]; then
483 return 1
484 fi
485 cat >> "$TEMP_DIR/make.mk" << __EOF__
486 WITH_TESTS=yes
487
488 __EOF__
489 return 0
490 }
491 checkopt_with_tests_no()
492 {
493 VERR=0
494 if [ $VERR -ne 0 ]; then
495 return 1
496 fi
497 return 0
498 }
499 checkopt_with_docs_all() 432 checkopt_with_docs_all()
500 { 433 {
501 VERR=0 434 VERR=0
502 if dependency_error_pandoc ; then 435 if dependency_error_pandoc ; then
503 VERR=1 436 VERR=1
577 ERROR=1 510 ERROR=1
578 fi 511 fi
579 512
580 # Features 513 # Features
581 514
582 # Option: --with-tests
583 if [ -z "$OPT_WITH_TESTS" ]; then
584 echo "auto-detecting option 'with-tests'"
585 SAVED_ERROR="$ERROR"
586 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
587 ERROR=1
588 while true
589 do
590 if checkopt_with_tests_yes ; then
591 echo " with-tests: yes" >> "$TEMP_DIR/options"
592 ERROR=0
593 break
594 fi
595 if checkopt_with_tests_no ; then
596 echo " with-tests: no" >> "$TEMP_DIR/options"
597 ERROR=0
598 break
599 fi
600 break
601 done
602 if [ $ERROR -ne 0 ]; then
603 SAVED_ERROR=1
604 SAVED_DEPENDENCIES_FAILED="option 'with-tests' $SAVED_DEPENDENCIES_FAILED"
605 fi
606 ERROR="$SAVED_ERROR"
607 DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
608 else
609 echo "checking option with-tests = $OPT_WITH_TESTS"
610 if false; then
611 false
612 elif [ "$OPT_WITH_TESTS" = "yes" ]; then
613 echo " with-tests: $OPT_WITH_TESTS" >> $TEMP_DIR/options
614 if checkopt_with_tests_yes ; then
615 :
616 else
617 ERROR=1
618 DEPENDENCIES_FAILED="option 'with-tests' $DEPENDENCIES_FAILED"
619 fi
620 elif [ "$OPT_WITH_TESTS" = "no" ]; then
621 echo " with-tests: $OPT_WITH_TESTS" >> $TEMP_DIR/options
622 if checkopt_with_tests_no ; then
623 :
624 else
625 ERROR=1
626 DEPENDENCIES_FAILED="option 'with-tests' $DEPENDENCIES_FAILED"
627 fi
628 fi
629 fi
630 # Option: --with-docs 515 # Option: --with-docs
631 if [ -z "$OPT_WITH_DOCS" ]; then 516 if [ -z "$OPT_WITH_DOCS" ]; then
632 echo "auto-detecting option 'with-docs'" 517 echo "auto-detecting option 'with-docs'"
633 SAVED_ERROR="$ERROR" 518 SAVED_ERROR="$ERROR"
634 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED" 519 SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"

mercurial