configure

changeset 138
2ceb0368b02d
parent 128
c36170c76a2b
equal deleted inserted replaced
137:f8e6e0ae61a8 138:2ceb0368b02d
107 --localedir=DIR locale-dependent data [DATAROOTDIR/locale] 107 --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
108 108
109 Build Types: 109 Build Types:
110 --debug add extra compile flags for debug builds 110 --debug add extra compile flags for debug builds
111 --release add extra compile flags for release builds 111 --release add extra compile flags for release builds
112
113 Optional Features:
114 --enable-asan Enable address sanitization.
112 115
113 __EOF__ 116 __EOF__
114 } 117 }
115 118
116 # create temporary directory 119 # create temporary directory
176 "--mandir"*) mandir=${ARG#--mandir} ;; 179 "--mandir"*) mandir=${ARG#--mandir} ;;
177 "--localedir"*) localedir=${ARG#--localedir} ;; 180 "--localedir"*) localedir=${ARG#--localedir} ;;
178 "--help"*) printhelp; abort_configure ;; 181 "--help"*) printhelp; abort_configure ;;
179 "--debug") BUILD_TYPE="debug" ;; 182 "--debug") BUILD_TYPE="debug" ;;
180 "--release") BUILD_TYPE="release" ;; 183 "--release") BUILD_TYPE="release" ;;
184 "--enable-asan") FEATURE_ASAN=on ;;
185 "--disable-asan") unset FEATURE_ASAN ;;
181 "-"*) echo "unknown option: $ARG"; abort_configure ;; 186 "-"*) echo "unknown option: $ARG"; abort_configure ;;
182 esac 187 esac
183 done 188 done
184 189
185 190
316 321
317 print_check_msg "$dep_checked_sdl2_ttf" "no\n" 322 print_check_msg "$dep_checked_sdl2_ttf" "no\n"
318 dep_checked_sdl2_ttf=1 323 dep_checked_sdl2_ttf=1
319 return 0 324 return 0
320 } 325 }
326 dependency_error_asan()
327 {
328 print_check_msg "$dep_checked_asan" "checking for asan... "
329 # dependency asan toolchain="gnuc"
330 while true
331 do
332 if notistoolchain "gnuc"; then
333 break
334 fi
335 TEMP_CFLAGS="$TEMP_CFLAGS -fsanitize=address"
336 TEMP_LDFLAGS="$TEMP_LDFLAGS -fsanitize=address"
337 print_check_msg "$dep_checked_asan" "yes\n"
338 dep_checked_asan=1
339 return 1
340 done
341
342 print_check_msg "$dep_checked_asan" "no\n"
343 dep_checked_asan=1
344 return 0
345 }
321 dependency_error_sdl2() 346 dependency_error_sdl2()
322 { 347 {
323 print_check_msg "$dep_checked_sdl2" "checking for sdl2... " 348 print_check_msg "$dep_checked_sdl2" "checking for sdl2... "
324 # dependency sdl2 349 # dependency sdl2
325 while true 350 while true
468 # 493 #
469 # TARGETS 494 # TARGETS
470 # 495 #
471 496
472 echo >> "$TEMP_DIR/flags.mk" 497 echo >> "$TEMP_DIR/flags.mk"
473 echo "configuring target: default" 498 echo "configuring global target"
474 echo "# flags for target default" >> "$TEMP_DIR/flags.mk" 499 echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk"
475 TEMP_CFLAGS= 500 TEMP_CFLAGS=
476 TEMP_CXXFLAGS= 501 TEMP_CXXFLAGS=
477 TEMP_LDFLAGS= 502 TEMP_LDFLAGS=
478 503
504 if dependency_error_ucx; then
505 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ucx "
506 ERROR=1
507 fi
508 if dependency_error_sdl2; then
509 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sdl2 "
510 ERROR=1
511 fi
479 if dependency_error_sdl2_ttf; then 512 if dependency_error_sdl2_ttf; then
480 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sdl2_ttf " 513 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sdl2_ttf "
481 ERROR=1 514 ERROR=1
482 fi 515 fi
483 if dependency_error_sdl2; then
484 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sdl2 "
485 ERROR=1
486 fi
487 if dependency_error_sdl2_image; then 516 if dependency_error_sdl2_image; then
488 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sdl2_image " 517 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sdl2_image "
489 ERROR=1 518 ERROR=1
490 fi 519 fi
491 if dependency_error_glew; then 520 if dependency_error_glew; then
492 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED glew " 521 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED glew "
493 ERROR=1 522 ERROR=1
494 fi 523 fi
495 if dependency_error_ucx; then
496 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ucx "
497 ERROR=1
498 fi
499 524
500 # Features 525 # Features
526 if [ -n "$FEATURE_ASAN" ]; then
527 # check dependency
528 if dependency_error_asan ; then
529 # "auto" features can fail and are just disabled in this case
530 if [ "$FEATURE_ASAN" = "auto" ]; then
531 DISABLE_FEATURE_ASAN=1
532 else
533 DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED asan "
534 ERROR=1
535 fi
536 fi
537 if [ -n "$DISABLE_FEATURE_ASAN" ]; then
538 unset FEATURE_ASAN
539 fi
540 fi
541 if [ -n "$FEATURE_ASAN" ]; then
542 :
543 else
544 :
545 fi
501 546
502 547
503 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then 548 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then
504 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk" 549 echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
505 fi 550 fi
580 fi 625 fi
581 if [ "$orig_localedir" != "$localedir" ]; then 626 if [ "$orig_localedir" != "$localedir" ]; then
582 echo " localedir: $localedir" 627 echo " localedir: $localedir"
583 fi 628 fi
584 echo 629 echo
630 echo "Features:"
631 if [ -n "$FEATURE_ASAN" ]; then
632 echo " asan: on"
633 else
634 echo " asan: off"
635 fi
636 echo
585 637
586 # generate the config.mk file 638 # generate the config.mk file
587 pwd=`pwd` 639 pwd=`pwd`
588 cat > "$TEMP_DIR/config.mk" << __EOF__ 640 cat > "$TEMP_DIR/config.mk" << __EOF__
589 # 641 #

mercurial