1#!/bin/sh 2# 3# configure -- custom configure script for ScummVM. 4# 5# ScummVM is the legal property of its developers, whose names 6# are too numerous to list here. Please refer to the COPYRIGHT 7# file distributed with this source distribution. 8# 9# This program is free software; you can redistribute it and/or 10# modify it under the terms of the GNU General Public License 11# as published by the Free Software Foundation; either version 2 12# of the License, or (at your option) any later version. 13# 14# This program is distributed in the hope that it will be useful, 15# but WITHOUT ANY WARRANTY; without even the implied warranty of 16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17# GNU General Public License for more details. 18# 19# You should have received a copy of the GNU General Public License 20# along with this program; if not, write to the Free Software 21# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 22# 23 24# NLS nuisances. 25LC_ALL=C 26export LC_ALL 27LANGUAGE=C 28export LANGUAGE 29 30# Save the current environment variables for next runs 31SAVED_CONFIGFLAGS=$@ 32SAVED_AR=$AR 33SAVED_AS=$AS 34SAVED_ASFLAGS=$ASFLAGS 35SAVED_CPPFLAGS=$CPPFLAGS 36SAVED_CXX=$CXX 37SAVED_CXXFLAGS=$CXXFLAGS 38SAVED_DWP=$DWP 39SAVED_LD=$LD 40SAVED_LDFLAGS=$LDFLAGS 41SAVED_PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-unset} 42SAVED_RANLIB=$RANLIB 43SAVED_SDL_CONFIG=$SDL_CONFIG 44SAVED_STRIP=$STRIP 45SAVED_WINDRES=$WINDRES 46SAVED_WINDRESFLAGS=$WINDRESFLAGS 47 48# Use environment vars if set 49CXXFLAGS="$CXXFLAGS $CPPFLAGS" 50 51# Backslashes into forward slashes: 52# The following OS/2 specific code is performed to deal with handling of backslashes by ksh. 53# Borrowed from the Sane configure script 54 55if test "$ac_emxsupport" != "no" -a "$ac_emxsupport" != "NO"; then 56 ac_save_IFS="$IFS" 57 IFS="\\" 58 ac_TEMP_PATH= 59 for ac_dir in $PATH; do 60 IFS=$ac_save_IFS 61 if test -z "$ac_TEMP_PATH"; then 62 ac_TEMP_PATH="$ac_dir" 63 else 64 ac_TEMP_PATH="$ac_TEMP_PATH/$ac_dir" 65 fi 66 done 67 PATH="$ac_TEMP_PATH" 68 export PATH 69 unset ac_TEMP_PATH 70fi 71 72set_var() { 73 eval ${1}='${2}' 74} 75 76get_var() { 77 eval echo \$${1} 78} 79 80append_var() { 81 VAR=${1} 82 shift 83 if eval test -z \"\$${VAR}\" ; then 84 eval ${VAR}='$@' 85 else 86 eval ${VAR}=\"\$${VAR} \"'$@' 87 fi 88} 89 90prepend_var() { 91 VAR=${1} 92 shift 93 if eval test -z \"\$${VAR}\" ; then 94 eval ${VAR}='$@' 95 else 96 eval ${VAR}='$@'\" \$${VAR}\" 97 fi 98} 99 100# Add an engine: id name build subengines base-games dependencies 101add_engine() { 102 _engines="${_engines} ${1}" 103 if test "${3}" = "no" ; then 104 set_var _wip_engines "${_wip_engines} ${1}" 105 fi 106 set_var _engine_${1}_name "${2}" 107 set_var _engine_${1}_build "${3}" 108 set_var _engine_${1}_build_default "${3}" 109 set_var _engine_${1}_subengines "${4}" 110 set_var _engine_${1}_base "${5}" 111 set_var _engine_${1}_deps "${6}" 112 for sub in ${4}; do 113 set_var _engine_${sub}_sub "yes" 114 set_var _engine_${sub}_parent "${1}" 115 done 116} 117 118# Add a feature: id name settings-list 119add_feature() { 120 set_var _feature_${1}_name "${2}" 121 # This is a list of settings, where one must be "yes" for the feature to 122 # be enabled 123 set_var _feature_${1}_settings "${3}" 124} 125 126_srcdir=`dirname $0` 127 128# Read list of engines 129for i in $_srcdir/engines/*/configure.engine; do 130 . "$i" 131done 132 133# 134# Default settings 135# 136# Default lib behavior yes/no/auto 137_sdl=no 138_ogg=auto 139_vorbis=auto 140_sdlnet=auto 141_libcurl=auto 142_tremor=auto 143_tremolo=no 144_flac=auto 145_mad=auto 146_opl2lpt=no 147_alsa=auto 148_seq_midi=auto 149_sndio=auto 150_timidity=auto 151_zlib=auto 152_mpeg2=auto 153_a52=auto 154_sparkle=auto 155_osxdockplugin=auto 156_jpeg=auto 157_png=auto 158_theoradec=auto 159_faad=auto 160_fluidsynth=auto 161_opengl_mode=auto 162_readline=auto 163_freetype2=auto 164_taskbar=auto 165_updates=no 166_libunity=auto 167_dialogs=auto 168_iconv=auto 169_tts=auto 170# Default option behavior yes/no 171_debug_build=auto 172_release_build=auto 173_optimizations=auto 174_use_cxx11=no 175_verbose_build=no 176_text_console=no 177_mt32emu=yes 178_lua=yes 179_build_scalers=yes 180_build_hq_scalers=yes 181_enable_prof=no 182_global_constructors=no 183_no_undefined_var_template=no 184_no_pragma_pack=no 185_bink=yes 186_cloud=auto 187_pandoc=no 188# Default vkeybd/keymapper/eventrec options 189_vkeybd=no 190_keymapper=no 191_eventrec=auto 192# GUI translation options 193_translation=yes 194# Default platform settings 195_backend=sdl 196_16bit=auto 197_highres=auto 198_savegame_timestamp=auto 199_dynamic_modules=no 200_elf_loader=no 201_plugins_default=static 202_plugin_prefix= 203_plugin_suffix= 204_nasm=auto 205_optimization_level= 206_default_optimization_level=-O2 207_nuked_opl=yes 208# Default commands 209_ranlib=ranlib 210_strip=strip 211_ar="ar cru" 212_as="as" 213_dwp=dwp 214_windres=windres 215_stagingpath="staging" 216_win32path="c:/scummvm" 217_amigaospath="Games:ScummVM" 218_staticlibpath= 219_xcodetoolspath= 220_sparklepath= 221_pkgconfig=pkg-config 222_sdlconfig=sdl2-config 223_libcurlconfig=curl-config 224_freetypeconfig=freetype-config 225_freetype_found="false" 226_sdlpath="$PATH" 227_freetypepath="$PATH" 228_libcurlpath="$PATH" 229_nasmpath="$PATH" 230NASMFLAGS="" 231NASM="" 232_tainted_build=no 233PANDOC="" 234_pandocpath="$PATH" 235_pandocformat="default" 236_pandocext="default" 237# The following variables are automatically detected, and should not 238# be modified otherwise. Consider them read-only. 239_posix=no 240_has_posix_spawn=no 241_endian=unknown 242_need_memalign=yes 243_have_x86=no 244 245# Add (virtual) features 246add_feature 16bit "16bit color" "_16bit" 247add_feature bink "Bink" "_bink" 248add_feature cloud "cloud" "_cloud" 249add_feature faad "libfaad" "_faad" 250add_feature flac "FLAC" "_flac" 251add_feature freetype2 "FreeType2" "_freetype2" 252add_feature highres "high resolution" "_highres" 253add_feature mad "MAD" "_mad" 254add_feature jpeg "JPEG" "_jpeg" 255add_feature png "PNG" "_png" 256add_feature theoradec "libtheoradec" "_theoradec" 257add_feature vorbis "Vorbis file support" "_vorbis _tremor" 258add_feature zlib "zlib" "_zlib" 259add_feature lua "lua" "_lua" 260 261# Directories for installing ScummVM. 262# This list is closely based on what GNU autoconf does, 263# although the default value for datadir differs. 264# Like GNU autoconf, we distinguish datadir and datarootdir 265# to make it possible to change e.g. the location of the 266# man pages independently of that of the engine data files, 267# which are placed inside $datadir/scummvm 268prefix=NONE 269exec_prefix=NONE 270bindir='${exec_prefix}/bin' 271libdir='${exec_prefix}/lib' 272datarootdir='${prefix}/share' 273datadir='${datarootdir}/scummvm' 274mandir='${datarootdir}/man' 275docdir='${datarootdir}/doc/scummvm' 276#localedir='${datarootdir}/locale' 277 278# For cross compiling 279_host="" 280_host_cpu="" 281_host_vendor="" 282_host_os="" 283_host_alias="" 284 285_port_mk="ports.mk" 286 287# Use temp files in the build directory 288TMPO=./scummvm-conf 289TMPC=${TMPO}.cpp 290TMPLOG=config.log 291 292cc_check_no_clean() { 293 echo >> "$TMPLOG" 294 cat "$TMPC" >> "$TMPLOG" 295 echo >> "$TMPLOG" 296 echo "$CXX $LDFLAGS $CXXFLAGS $TMPC -o $TMPO$HOSTEXEEXT $@" >> "$TMPLOG" 297 rm -f "$TMPO$HOSTEXEEXT" 298 if test "-c" = "$*" ; then 299 ( $CXX $CXXFLAGS "$TMPC" -o "$TMPO$HOSTEXEEXT" "$@" ) >> "$TMPLOG" 2>&1 300 else 301 ( $CXX $LDFLAGS $CXXFLAGS "$TMPC" -o "$TMPO$HOSTEXEEXT" "$@" ) >> "$TMPLOG" 2>&1 302 fi 303 TMPR="$?" 304 echo "return code: $TMPR" >> "$TMPLOG" 305 echo >> "$TMPLOG" 306 return "$TMPR" 307} 308 309cc_check_clean() { 310 rm -rf $TMPC $TMPO $TMPO.o $TMPO.dwo $TMPO.dSYM $TMPO$HOSTEXEEXT "$@" 311} 312 313cc_check() { 314 cc_check_no_clean "$@" 315 TMPR="$?" 316 cc_check_clean 317 return "$TMPR" 318} 319 320cc_check_define() { 321cat > $TMPC << EOF 322int main(void) { 323 #ifndef $1 324 syntax error 325 #endif 326 return 0; 327} 328EOF 329 cc_check -c 330 return $? 331} 332 333gcc_get_define() { 334 echo "" | $CXX -dM -E - | fgrep "$1" | head -n1 | cut -d ' ' -f 3- 335} 336 337# 338# Function to provide echo -n for bourne shells that don't have it 339# 340echo_n() { 341 printf "$@" 342} 343 344echocheck() { 345 echo_n "Checking for $@... " 346} 347 348# Add a line of data to config.mk. 349add_line_to_config_mk() { 350 _config_mk_data="$_config_mk_data"' 351'"$1" 352} 353 354# Add a line of data to config.h. 355add_line_to_config_h() { 356 _config_h_data="$_config_h_data"' 357'"$1" 358} 359 360# Conditionally add a line of data to config.h. Takes two parameters: 361# The first one can be set to 'no' to "comment out" the line, i.e. 362# make it ineffective, use 'yes' otherwise. 363# The second param is the line to insert. 364add_to_config_h_if_yes() { 365 if test "$1" = yes ; then 366 add_line_to_config_h "$2" 367 else 368 add_line_to_config_h "/* $2 */" 369 fi 370} 371 372# Conditionally add a line of data to config.mk. Takes two parameters: 373# The first one can be set to 'no' to "comment out" the line, i.e. 374# make it ineffective, use 'yes' otherwise. 375# The second param is the line to insert. 376add_to_config_mk_if_yes() { 377 if test "$1" = yes ; then 378 add_line_to_config_mk "$2" 379 else 380 add_line_to_config_mk "# $2" 381 fi 382} 383 384# Conditionally add a '#define' line to config.h. Takes two parameters: 385# The first one can be set to 'yes' or 'no'. If 'yes' is used, then 386# the line "#define $2" is added to config.h, otherwise "#undef $2". 387define_in_config_h_if_yes() { 388 if test "$1" = yes ; then 389 add_line_to_config_h "#define $2" 390 else 391 add_line_to_config_h "#undef $2" 392 fi 393} 394 395# Conditionally add definitions to config.h and config.mk. Takes two parameters: 396# The first one can be set to 'yes' or 'no'. If 'yes' is used, then 397# the line "#define $2" is added to config.h and "$2 = 1" to config.mk. 398# Otherwise "#undef $2" is added to config.h and "# $2 = 1" to config.mk 399define_in_config_if_yes() { 400 if test "$1" = yes ; then 401 add_line_to_config_h "#define $2" 402 add_line_to_config_mk "$2 = 1" 403 else 404 add_line_to_config_h "#undef $2" 405 add_line_to_config_mk "# $2 = 1" 406 fi 407} 408 409define_in_config_if_no() { 410 if test "$1" = no ; then 411 add_line_to_config_h "#define $2" 412 add_line_to_config_mk "$2 = 1" 413 else 414 add_line_to_config_h "#undef $2" 415 add_line_to_config_mk "# $2 = 1" 416 fi 417} 418 419# 420# Determine sdl-config 421# 422# TODO: small bit of code to test sdl usability 423find_sdlconfig() { 424 echo_n "Looking for sdl-config... " 425 sdlconfigs="$SDL_CONFIG:$_sdlconfig:sdl2-config:sdl12-config:sdl11-config:sdl-config" 426 _sdlconfig= 427 428 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$SEPARATOR" 429 for path_dir in $_sdlpath; do 430 #reset separator to parse sdlconfigs 431 IFS=":" 432 for sdlconfig in $sdlconfigs; do 433 if test -f "$path_dir/$sdlconfig" ; then 434 _sdlconfig="$path_dir/$sdlconfig" 435 echo $_sdlconfig 436 # Save the prefix 437 _sdlpath=$path_dir 438 if test `basename $path_dir` = bin ; then 439 _sdlpath=`dirname $path_dir` 440 fi 441 # break at first sdl-config found in path 442 break 2 443 fi 444 done 445 done 446 447 IFS="$ac_save_ifs" 448 449 if test -z "$_sdlconfig"; then 450 echo "none found!" 451 exit 1 452 fi 453} 454 455# 456# Determine freetype-config 457# 458find_freetypeconfig() { 459 echo_n "Looking for freetype-config... " 460 freetypeconfigs="$_freetypeconfig" 461 _freetypeconfig= 462 463 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$SEPARATOR" 464 for path_dir in $_freetypepath; do 465 #reset separator to parse freetypeconfigs 466 IFS=":" 467 for freetypeconfig in $freetypeconfigs; do 468 if test -f "$path_dir/$freetypeconfig" ; then 469 _freetypeconfig="$path_dir/$freetypeconfig" 470 echo $_freetypeconfig 471 # Save the prefix 472 _freetypepath=$path_dir 473 if test `basename $path_dir` = bin ; then 474 _freetypepath=`dirname $path_dir` 475 fi 476 # break at first freetype-config found in path 477 break 2 478 fi 479 done 480 done 481 482 IFS="$ac_save_ifs" 483 484 if test -z "$_freetypeconfig"; then 485 echo "none found!" 486 fi 487} 488 489# 490# Determine curl-config 491# 492find_libcurlconfig() { 493 echo_n "Looking for curl-config... " 494 libcurlconfigs="$_libcurlconfig" 495 _libcurlconfig= 496 497 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$SEPARATOR" 498 for path_dir in $_libcurlpath; do 499 #reset separator to parse sdlconfigs 500 IFS=":" 501 for libcurlconfig in $libcurlconfigs; do 502 if test -f "$path_dir/$libcurlconfig" ; then 503 _libcurlconfig="$path_dir/$libcurlconfig" 504 echo $_libcurlconfig 505 # Save the prefix 506 _libcurlpath=$path_dir 507 if test `basename $path_dir` = bin ; then 508 _libcurlpath=`dirname $path_dir` 509 fi 510 # break at first curl-config found in path 511 break 2 512 fi 513 done 514 done 515 516 IFS="$ac_save_ifs" 517 518 if test -z "$_libcurlconfig"; then 519 echo "none found!" 520 fi 521} 522 523# 524# Determine extension used for executables 525# 526get_system_exe_extension() { 527 case $1 in 528 riscos) 529 _exeext=",e1f" 530 ;; 531 3ds | dreamcast | ds | gamecube | n64 | ps2 | psp | switch | wii) 532 _exeext=".elf" 533 ;; 534 gph-linux) 535 _exeext=".gph" 536 ;; 537 mingw* | *os2-emx | wince) 538 _exeext=".exe" 539 ;; 540 *) 541 _exeext="" 542 ;; 543 esac 544} 545 546# 547# Generic options functions 548# 549 550# Show the configure help line for an option 551option_help() { 552 if test "${3}" != "" ; then 553 tmpopt_prefix="${3}" 554 else 555 tmpopt_prefix="--" 556 fi 557 tmpopt=`echo $1 | sed 's/_/-/g'` 558 option=`echo "${tmpopt_prefix}${tmpopt} " | sed "s/\(.\{23\}\).*/\1/"` 559 echo " ${option} ${2}" 560} 561 562# Show an error about an unknown option 563option_error() { 564 echo "error: unrecognized option: $ac_option 565Try \`$0 --help' for more information." >&2 566 exit 1 567} 568 569# Show an error about an unknown engine 570engine_option_error() { 571 echo "error: unrecognized engine: $1 572Try \`$0 --help' for more information." >&2 573 exit 1 574} 575 576# Show an error about an invalid subengine option 577subengine_option_error() { 578 echo "error: this option is invalid for the subengine $1: $ac_option 579Try \`$0 --help' for more information." >&2 580 exit 1 581} 582 583 584# 585# Feature handling functions 586# 587 588# Get the name of the feature 589get_feature_name() { 590 get_var _feature_$1_name 591} 592 593# Check whether the feature is enabled 594get_feature_state() { 595 for i in `get_var _feature_$1_settings`; do 596 if test `get_var $i` = "yes"; then 597 echo "yes" 598 return 599 fi 600 done 601 echo "no" 602} 603 604 605# 606# Engine handling functions 607# 608 609# Get the name of the engine 610get_engine_name() { 611 get_var _engine_$1_name 612} 613 614# Will this engine be built? 615get_engine_build() { 616 get_var _engine_$1_build 617} 618 619# Was this engine set to be built by default? 620get_engine_build_default() { 621 get_var _engine_$1_build_default 622} 623 624# Get the subengines 625get_engine_subengines() { 626 get_var _engine_$1_subengines 627} 628 629# Get the dependencies 630get_engine_dependencies() { 631 get_var _engine_$1_deps 632} 633 634# Get the base engine game support description 635get_engine_base() { 636 get_var _engine_$1_base 637} 638 639# Ask if this is a subengine 640get_engine_sub() { 641 sub=`get_var _engine_$1_sub` 642 if test -z "$sub" ; then 643 sub=no 644 fi 645 echo $sub 646} 647 648# Get a subengine's parent (undefined for non-subengines) 649get_subengine_parent() { 650 get_var _engine_$1_parent 651} 652 653# Enable *all* engines 654engine_enable_all() { 655 for engine in $_engines; do 656 set_var _engine_${engine}_build "yes" 657 done 658} 659 660# Disable *all* engines 661engine_disable_all() { 662 for engine in $_engines; do 663 set_var _engine_${engine}_build "no" 664 done 665} 666 667# Enable all unstable engines 668engine_enable_all_unstable() { 669 for engine in $_engines; do 670 engine_build_default=`get_engine_build_default $engine` 671 if test $engine_build_default = no ; then 672 set_var _engine_${engine}_build "yes" 673 fi 674 done 675} 676 677# Disable all unstable engines 678engine_disable_all_unstable() { 679 for engine in $_engines; do 680 engine_build_default=`get_engine_build_default $engine` 681 if test $engine_build_default = no ; then 682 set_var _engine_${engine}_build "no" 683 fi 684 done 685} 686 687# Enable the given engine 688engine_enable() { 689 # Get the parameter 690 if ( echo $1 | grep ':' ) 2> /dev/null > /dev/null ; then 691 eng=`echo $1 | cut -d ':' -f 1` 692 opt=`echo $1 | cut -d ':' -f 2` 693 else 694 eng=$1 695 opt=yes 696 fi 697 engine=`echo $eng | sed 's/-/_/g'` 698 699 # Filter the parameter for the subengines 700 if test "`get_engine_sub ${engine}`" != "no" ; then 701 if test "$opt" != "yes" ; then 702 subengine_option_error ${engine} 703 return 704 fi 705 parent=`get_subengine_parent ${engine}` 706 if test `get_engine_build ${parent}` = "no" ; then 707 set_var _engine_${parent}_build "yes" 708 fi 709 fi 710 711 if test "$opt" = "static" -o "$opt" = "dynamic" -o "$opt" = "yes" ; then 712 if test "`get_engine_name ${engine}`" != "" ; then 713 set_var _engine_${engine}_build "$opt" 714 else 715 engine_option_error ${engine} 716 fi 717 else 718 option_error 719 fi 720} 721 722# Disable the given engine 723engine_disable() { 724 # Filter malformed options 725 if ( echo $1 | grep '=' ) 2> /dev/null > /dev/null ; then 726 option_error 727 return 728 fi 729 730 engine=`echo $1 | sed 's/-/_/g'` 731 if test "`get_engine_name ${engine}`" != "" ; then 732 set_var _engine_${engine}_build "no" 733 else 734 engine_option_error ${engine} 735 fi 736} 737 738# Check whether the engine's dependencies are met 739# If that is not the case disable the engine 740check_engine_deps() { 741 unmet_deps="" 742 743 # Check whether the engine is enabled 744 if test `get_engine_build $1` != "no" ; then 745 # Collect unmet dependencies 746 for dep in `get_engine_dependencies $1`; do 747 if test `get_feature_state $dep` = "no"; then 748 feature_name=`get_feature_name $dep` 749 unmet_deps="${unmet_deps}${feature_name} " 750 fi 751 done 752 753 # Check whether there is any unmet dependency 754 if test -n "$unmet_deps"; then 755 echo "WARNING: Disabling engine "`get_engine_name $1`" because the following dependencies are unmet: "$unmet_deps 756 engine_disable $1 757 fi 758 fi 759} 760 761# Show the configure help line for a given engine 762show_engine_help() { 763 name=`get_engine_name $1` 764 option_help "${1}" "${name} engine" " " 765 for sub in `get_engine_subengines $1`; do 766 show_subengine_help $sub $1 767 done 768} 769 770# Show the configure help line for a given subengine 771show_subengine_help() { 772 name=`get_engine_name $1` 773 parent=`get_engine_name $2` 774 option_help "${1}" "${name} in ${parent} engine" " " 775} 776 777# Prepare the strings about the engines to build 778prepare_engine_build_strings() { 779 string=`get_engine_build_string $1 static` 780 if test -n "$string" ; then 781 _engines_built_static="${_engines_built_static}#$string@" 782 fi 783 784 string=`get_engine_build_string $1 dynamic` 785 if test -n "$string" ; then 786 _engines_built_dynamic="${_engines_built_dynamic}#$string@" 787 fi 788 789 string=`get_engine_build_string $1 no` 790 if test -n "$string" ; then 791 _engines_skipped="${_engines_skipped}#$string@" 792 fi 793 794 string=`get_engine_build_string $1 wip` 795 if test -n "$string" ; then 796 _engines_built_wip="${_engines_built_wip}#$string@" 797 fi 798 799} 800 801# Get the string about building an engine 802get_engine_build_string() { 803 engine=$1 804 request_status=$2 805 engine_string="" 806 engine_build=`get_engine_build $1` 807 engine_build_default=`get_engine_build_default $engine` 808 show=no 809 810 # Convert static/dynamic to yes to ease the check of subengines 811 if test $engine_build = no; then 812 subengine_filter=no 813 else 814 subengine_filter=yes 815 fi 816 817 # Check if the current engine should be shown for the current status 818 if test $engine_build = $request_status ; then 819 show=yes 820 else 821 # Test for disabled sub-engines 822 if test $request_status = no ; then 823 for subeng in `get_engine_subengines $engine` ; do 824 if test `get_engine_build $subeng` = no ; then 825 # In this case we to display _disabled_ subengines 826 subengine_filter=no 827 show=yes 828 fi 829 done 830 fi 831 # Test for enabled wip sub-engines 832 if test $request_status = wip ; then 833 for subeng in `get_engine_subengines $engine` ; do 834 if test `get_engine_build $subeng` != no -a `get_engine_build_default $subeng` = no ; then 835 show=yes 836 fi 837 done 838 fi 839 fi 840 841 842 # Check if it is a wip engine 843 if test "$request_status" = "wip" -a "$engine_build" != "no" -a "$engine_build_default" = no; then 844 show=yes 845 fi 846 847 # The engine should be shown, build the string 848 if test $show = yes ; then 849 engine_string=`get_subengines_build_string $engine $subengine_filter $request_status` 850 engine_string="`get_engine_name $engine` $engine_string" 851 fi 852 853 echo "$engine_string" 854} 855 856# Get the string about building subengines 857get_subengines_build_string() { 858 parent_engine=$1 859 subengine_filter=$2 860 request_status=$3 861 parent_engine_build_default=`get_engine_build_default $parent_engine` 862 subengine_string="" 863 864 # If the base engine isn't built at all, no need to list subengines 865 # in any of the possible categories. 866 if test `get_engine_build $parent_engine` = no; then 867 return 868 fi 869 870 all=yes 871 # If there are no subengines, never display "[all games]" (for brevity). 872 if test -z "`get_engine_subengines $parent_engine`"; then 873 all=no 874 fi 875 # If the base engine does not fit the category we're displaying here 876 # (WIP or Skipped), we should never show "[all games]" 877 if test "$request_status" = wip; then 878 if test $parent_engine_build_default = yes; then 879 all=no 880 fi 881 fi 882 if test "$request_status" = no; then 883 # If we're here, the parent engine is built, so no need to check that. 884 all=no 885 fi 886 887 888 # In the static/dynamic categories, also display the engine's base games. 889 if test -n "`get_engine_subengines $parent_engine`" -a $request_status != no -a $request_status != wip; then 890 subengine_string="[`get_engine_base $parent_engine`]" 891 fi 892 893 for subeng in `get_engine_subengines $parent_engine` ; do 894 subengine_build=`get_engine_build $subeng` 895 subengine_build_default=`get_engine_build_default $subeng` 896 897 # Display this subengine if it matches the filter, unless it is 898 # a stable subengine in the WIP request. 899 if test $subengine_build = $subengine_filter -a \! \( "$request_status" = wip -a "$subengine_build_default" = yes \) ; then 900 s="[`get_engine_name $subeng`]" 901 if test -n "$subengine_string"; then 902 subengine_string="$subengine_string $s" 903 else 904 subengine_string="$s" 905 fi 906 else 907 all=no 908 fi 909 done 910 911 # Summarize the full list, where applicable 912 if test $all = yes ; then 913 subengine_string="[all games]" 914 fi 915 916 echo "$subengine_string" 917} 918 919# 920# Check any parameters we received 921# 922# TODO: 923# * Change --disable-mad / --enable-mad to the way it's done in autoconf: 924# That is, --without-mad / --with-mad=/prefix/to/mad. Useful for people 925# who have Mad/Vorbis/ALSA installed in a non-standard locations. 926# 927 928for parm in "$@" ; do 929 if test "$parm" = "--help" || test "$parm" = "-help" || test "$parm" = "-h" ; then 930 for engine in $_engines; do 931 if test `get_engine_sub $engine` = no ; then 932 engines_help="$engines_help`show_engine_help $engine` 933" 934 fi 935 done 936 cat << EOF 937 938Usage: $0 [OPTIONS]... 939 940Configuration: 941 -h, --help display this help and exit 942 --backend=BACKEND backend to build (3ds, android, dc, dingux, ds, gcw0, 943 gph, iphone, ios7, linuxmoto, maemo, n64, null, openpandora, 944 ps2, psp, psp2, samsungtv, sdl, switch, tizen, webos, wii, wince) [sdl] 945 946Installation directories: 947 --prefix=PREFIX install architecture-independent files in PREFIX 948 [/usr/local] 949 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX 950 [PREFIX] 951 952By default, \`make install' will install all the files in 953\`/usr/local/bin', \`/usr/local/lib' etc. You can specify 954an installation prefix other than \`/usr/local' using \`--prefix', 955for instance \`--prefix=\$HOME'. 956 957For better control, use the options below. 958 959Fine tuning of the installation directories: 960 --bindir=DIR user executables [EPREFIX/bin] 961 --libdir=DIR object code libraries [EPREFIX/lib] 962 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] 963 --datadir=DIR read-only architecture-independent data 964 [DATAROOTDIR/scummvm] 965 --mandir=DIR man documentation [DATAROOTDIR/man] 966 --docdir=DIR documentation root [DATAROOTDIR/doc/scummvm] 967 968Special configuration feature: 969 --host=HOST cross-compile to target HOST (arm-linux, ...) 970 special targets: 3ds for Nintendo 3DS 971 android or android-arm for Android ARMv5TE (armeabi) 972 android-v7a or android-arm-v7a for Android ARMv7-A (armeabi-v7a) 973 android-arm64-v8a for Android ARMv8-A (arm64-v8a) 974 android-x86 for Android x86 975 android-x86_64 for Android x86_64 976 android-mips for Android MIPS 977 android-mips64 for Android MIPS64 978 androidsdl for Android with SDL backend 979 caanoo for Caanoo 980 dingux for Dingux 981 raspberrypi for Raspberry Pi 982 dreamcast for Sega Dreamcast 983 ds for Nintendo DS 984 gamecube for Nintendo GameCube 985 gcw0 for GCW Zero 986 gp2x for GP2X 987 gp2xwiz for GP2X Wiz 988 iphone for Apple iPhone (iOS <= 6) 989 ios7 for Apple iPhone / iPad (iOS >= 7) 990 maemo for Nokia Maemo 991 motoezx for MotoEZX 992 motomagx for MotoMAGX 993 n64 for Nintendo 64 994 openpandora for OpenPandora 995 ouya for OUYA 996 ps2 for PlayStation 2 997 ps3 for PlayStation 3 998 psp2 for PlayStation Vita 999 psp for PlayStation Portable 1000 samsungtv for Samsung TV 1001 switch for Nintendo Switch 1002 tizen for Samsung Tizen 1003 webos for HP Palm WebOS 1004 wii for Nintendo Wii 1005 wince for Windows CE 1006 1007Game engines: 1008 --enable-all-engines enable all engines, including those which are 1009 broken or unsupported 1010 --disable-all-engines disable all engines 1011 --enable-all-unstable-engines enable the engines which are 1012 broken or unsupported 1013 --disable-all-unstable-engines disable only the engines which are 1014 broken or unsupported 1015 --enable-engine=<engine name>[,<engine name>...] enable engine(s) listed 1016 --disable-engine=<engine name>[,<engine name>...] disable engine(s) listed 1017 --enable-engine-static=<engine name>[,<engine name>...] 1018 enable engine(s) listed as static builtin (when plugins are enabled) 1019 --enable-engine-dynamic=<engine name>[,<engine name>...] 1020 enable engine(s) listed as dynamic plugin (when plugins are enabled) 1021 The values of <engine name> for these options are as follows: 1022$engines_help 1023Optional Features: 1024 --enable-static build a static binary instead of using shared objects 1025 --enable-c++11 build as C++11 if the compiler allows that 1026 --disable-debug disable building with debugging symbols 1027 --enable-Werror treat warnings as errors 1028 --enable-release enable building in release mode (this activates 1029 optimizations) 1030 --enable-release-mode enable building in release mode (without optimizations) 1031 --enable-optimizations enable optimizations 1032 --enable-profiling enable profiling 1033 --enable-plugins enable the support for dynamic plugins 1034 --default-dynamic make plugins dynamic by default 1035 --disable-mt32emu don't enable the integrated MT-32 emulator 1036 --disable-lua don't enable Lua support 1037 --disable-nuked-opl don't build Nuked OPL driver 1038 --disable-16bit don't enable 16bit color support 1039 --disable-highres don't enable support for high resolution engines >320x240 1040 --disable-savegame-timestamp don't use timestamps for blank savegame descriptions 1041 --disable-scalers exclude scalers 1042 --disable-hq-scalers exclude HQ2x and HQ3x scalers 1043 --disable-translation don't build support for translated messages 1044 --disable-taskbar don't build support for taskbar and launcher integration 1045 --disable-cloud don't build cloud support 1046 --disable-system-dialogs don't build support for system dialogs 1047 --enable-vkeybd build virtual keyboard support 1048 --enable-keymapper build key mapper support 1049 --enable-eventrecorder enable event recording functionality 1050 --disable-eventrecorder disable event recording functionality 1051 --enable-updates build support for updates 1052 --enable-text-console use text console instead of graphical console 1053 --enable-verbose-build enable regular echoing of commands during build 1054 process 1055 --enable-tts build support for text to speech 1056 --disable-tts don't build support for text to speech 1057 --disable-bink don't build with Bink video support 1058 --opengl-mode=MODE OpenGL (ES) mode to use for OpenGL output [auto] 1059 available modes: auto for autodetection 1060 none for disabling any OpenGL usage 1061 any for runtime detection 1062 gl for forcing OpenGL 1063 gles for forcing OpenGL ES 1064 gles2 for forcing OpenGL ES 2 1065 WARNING: only specify this manually if you know what 1066 you are doing! 1067 1068Optional Libraries: 1069 --with-alsa-prefix=DIR prefix where alsa is installed (optional) 1070 --disable-alsa disable ALSA midi sound support [autodetect] 1071 1072 --with-ogg-prefix=DIR prefix where libogg is installed (optional) 1073 --disable-ogg disable Ogg support [autodetect] 1074 1075 --with-vorbis-prefix=DIR prefix where libvorbis is installed (optional) 1076 --disable-vorbis disable Vorbis support [autodetect] 1077 1078 --with-tremor-prefix=DIR prefix where tremor is installed (optional) 1079 --disable-tremor disable tremor support [autodetect] 1080 1081 --with-mad-prefix=DIR prefix where libmad is installed (optional) 1082 --disable-mad disable libmad (MP3) support [autodetect] 1083 1084 --with-flac-prefix=DIR prefix where libFLAC is installed (optional) 1085 --disable-flac disable FLAC support [autodetect] 1086 1087 --with-zlib-prefix=DIR prefix where zlib is installed (optional) 1088 --disable-zlib disable zlib (compression) support [autodetect] 1089 1090 --with-mpeg2-prefix=DIR prefix where libmpeg2 is installed (optional) 1091 --enable-mpeg2 enable mpeg2 codec for cutscenes [autodetect] 1092 1093 --with-a52-prefix=DIR Prefix where liba52 is installed (optional) 1094 --enable-a52 enable a52 codec for MPEG decoder [autodetect] 1095 1096 --with-jpeg-prefix=DIR Prefix where libjpeg is installed (optional) 1097 --disable-jpeg disable JPEG decoder [autodetect] 1098 1099 --with-png-prefix=DIR prefix where libpng is installed (optional) 1100 --disable-png disable PNG decoder [autodetect] 1101 1102 --with-theoradec-prefix=DIR prefix where libtheoradec is installed (optional) 1103 --disable-theoradec disable Theora decoder [autodetect] 1104 1105 --with-faad-prefix=DIR prefix where libfaad is installed (optional) 1106 --disable-faad disable AAC decoder [autodetect] 1107 1108 --with-fluidsynth-prefix=DIR prefix where libfluidsynth is 1109 installed (optional) 1110 --disable-fluidsynth disable fluidsynth MIDI driver [autodetect] 1111 1112 --with-ieee1284-prefix=DIR prefix where libieee1284 is installed (optional) 1113 --enable-opl2lpt enable OPL2LPT support 1114 1115 --with-sparkle-prefix=DIR prefix where sparkle is installed 1116 (OS X/Windows only - optional) 1117 --disable-sparkle disable sparkle automatic update support 1118 [OS X/Windows only - autodetect] 1119 1120 --disable-osx-dock-plugin disable the NSDockTilePlugin support 1121 [Mac OS X only - autodetect] 1122 1123 --with-sdl-prefix=DIR prefix where the sdl-config script is 1124 installed (optional) 1125 1126 --with-freetype2-prefix=DIR prefix where the freetype-config script is 1127 installed (optional) 1128 --disable-freetype2 disable freetype2 TTF library usage [autodetect] 1129 1130 --with-nasm-prefix=DIR prefix where nasm executable is installed (optional) 1131 --disable-nasm disable assembly language optimizations [autodetect] 1132 1133 --with-pandoc-format=FORMAT pandoc format to use during the conversion (optional) 1134 1135 --with-readline-prefix=DIR prefix where readline is installed (optional) 1136 --disable-readline disable readline support in text console [autodetect] 1137 1138 --with-libunity-prefix=DIR prefix where libunity is installed (optional) 1139 --disable-libunity disable Unity launcher integration [autodetect] 1140 1141 --with-sndio-prefix=DIR prefix where sndio is installed (optional) 1142 --disable-sndio disable sndio MIDI driver [autodetect] 1143 1144 --with-sdlnet-prefix=DIR prefix where SDL_Net is installed (optional) 1145 --disable-sdlnet disable SDL_Net networking library [autodetect] 1146 1147 --with-libcurl-prefix=DIR prefix where libcurl is installed (optional) 1148 --disable-libcurl disable libcurl networking library [autodetect] 1149 1150 --with-iconv-prefix=DIR prefix where libiconv is installed (optional) 1151 --disable-iconv disable libiconv encoding conversion library [autodetect] 1152 1153Some influential environment variables: 1154 AR archiver command 1155 AS assembler command 1156 ASFLAGS assembler flags 1157 CPPFLAGS C++ preprocessor flags, e.g. -I<include dir> if you have 1158 headers in a nonstandard directory <include dir> 1159 CXX C++ compiler command 1160 CXXFLAGS C++ compiler flags 1161 DWP DWARF packing utility command 1162 LD linker command 1163 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a 1164 nonstandard directory <lib dir> 1165 PKG_CONFIG_LIBDIR list of directories where pkg-config ‘.pc’ files are 1166 looked up 1167 RANLIB archive indexer command 1168 SDL_CONFIG SDL configurer script name (not path) 1169 STRIP symbol stripper command 1170 WINDRES Windows resource compiler command 1171 WINDRESFLAGS Windows resource compiler flags 1172 1173EOF 1174 exit 0 1175 fi 1176done # for parm in ... 1177 1178 1179# 1180# If we're not showing help, greet the user and start the log file 1181# 1182echo "Running ScummVM configure..." 1183echo "Configure run on" `date` > $TMPLOG 1184cat >> $TMPLOG <<EOF 1185Invocation command line was: 1186$0 $@ 1187Saved environment variables: 1188AR="$SAVED_AR" AS="$SAVED_AS" ASFLAGS="$SAVED_ASFLAGS" CPPFLAGS="$SAVED_CPPFLAGS" CXX="$SAVED_CXX" CXXFLAGS="$SAVED_CXXFLAGS" DWP="$SAVED_DWP" LD="$SAVED_LD" LDFLAGS="$SAVED_LDFLAGS" PKG_CONFIG_LIBDIR="$SAVED_PKG_CONFIG_LIBDIR" RANLIB="$SAVED_RANLIB" SDL_CONFIG="$SAVED_SDL_CONFIG" STRIP="$SAVED_STRIP" WINDRES="$SAVED_WINDRES" WINDRESFLAGS="$SAVED_WINDRESFLAGS" 1189EOF 1190 1191 1192for ac_option in $@; do 1193 case "$ac_option" in 1194 --enable-static) _static_build=yes ;; 1195 --disable-16bit) _16bit=no ;; 1196 --enable-highres) _highres=yes ;; 1197 --disable-highres) _highres=no ;; 1198 --disable-savegame-timestamp) _savegame_timestamp=no ;; 1199 --disable-scalers) _build_scalers=no ;; 1200 --disable-hq-scalers) _build_hq_scalers=no ;; 1201 --enable-alsa) _alsa=yes ;; 1202 --disable-alsa) _alsa=no ;; 1203 --enable-seq-midi) _seq_midi=yes ;; 1204 --disable-seq-midi) _seq_midi=no ;; 1205 --enable-sndio) _sndio=yes ;; 1206 --disable-sndio) _sndio=no ;; 1207 --enable-timidity) _timidity=yes ;; 1208 --disable-timidity) _timidity=no ;; 1209 --enable-ogg) _ogg=yes ;; 1210 --disable-ogg) _ogg=no ;; 1211 --enable-vorbis) _vorbis=yes ;; 1212 --disable-vorbis) _vorbis=no ;; 1213 --enable-tremor) _tremor=yes ;; 1214 --disable-tremor) _tremor=no ;; 1215 --enable-opl2lpt) _opl2lpt=yes ;; 1216 --disable-opl2lpt) _opl2lpt=no ;; 1217 --enable-flac) _flac=yes ;; 1218 --disable-flac) _flac=no ;; 1219 --enable-mad) _mad=yes ;; 1220 --disable-mad) _mad=no ;; 1221 --enable-zlib) _zlib=yes ;; 1222 --disable-zlib) _zlib=no ;; 1223 --enable-sparkle) _sparkle=yes ;; 1224 --disable-sparkle) _sparkle=no ;; 1225 --enable-osx-dock-plugin) _osxdockplugin=yes ;; 1226 --disable-osx-dock-plugin) _osxdockplugin=no ;; 1227 --enable-nasm) _nasm=yes ;; 1228 --disable-nasm) _nasm=no ;; 1229 --enable-mpeg2) _mpeg2=yes ;; 1230 --disable-mpeg2) _mpeg2=no ;; 1231 --enable-a52) _a52=yes ;; 1232 --disable-a52) _a52=no ;; 1233 --disable-jpeg) _jpeg=no ;; 1234 --enable-jpeg) _jpeg=yes ;; 1235 --disable-png) _png=no ;; 1236 --enable-png) _png=yes ;; 1237 --disable-theoradec) _theoradec=no ;; 1238 --enable-theoradec) _theoradec=yes ;; 1239 --disable-faad) _faad=no ;; 1240 --enable-faad) _faad=yes ;; 1241 --disable-fluidsynth) _fluidsynth=no ;; 1242 --enable-readline) _readline=yes ;; 1243 --disable-readline) _readline=no ;; 1244 --enable-freetype2) _freetype2=yes ;; 1245 --disable-freetype2) _freetype2=no ;; 1246 --enable-taskbar) _taskbar=yes ;; 1247 --disable-taskbar) _taskbar=no ;; 1248 --enable-system-dialogs) _dialogs=yes ;; 1249 --disable-system-dialogs) _dialogs=no ;; 1250 --enable-sdlnet) _sdlnet=yes ;; 1251 --disable-sdlnet) _sdlnet=no ;; 1252 --enable-libcurl) _libcurl=yes ;; 1253 --disable-libcurl) _libcurl=no ;; 1254 --enable-cloud) _cloud=yes ;; 1255 --disable-cloud) _cloud=no ;; 1256 --enable-updates) _updates=yes ;; 1257 --disable-updates) _updates=no ;; 1258 --enable-libunity) _libunity=yes ;; 1259 --disable-libunity) _libunity=no ;; 1260 --enable-tts) _tts=yes ;; 1261 --disable-tts) _tts=no ;; 1262 --enable-bink) _bink=yes ;; 1263 --disable-bink) _bink=no ;; 1264 --opengl-mode=*) 1265 _opengl_mode=`echo $ac_option | cut -d '=' -f 2` 1266 ;; 1267 --enable-verbose-build) _verbose_build=yes ;; 1268 --enable-plugins) _dynamic_modules=yes ;; 1269 --default-dynamic) _plugins_default=dynamic;; 1270 --enable-mt32emu) _mt32emu=yes ;; 1271 --disable-mt32emu) _mt32emu=no ;; 1272 --enable-lua) _lua=yes ;; 1273 --disable-lua) _lua=no ;; 1274 --enable-nuked-opl) _nuked_opl=yes ;; 1275 --disable-nuked-opl) _nuked_opl=no ;; 1276 --enable-translation) _translation=yes ;; 1277 --disable-translation) _translation=no ;; 1278 --enable-vkeybd) _vkeybd=yes ;; 1279 --disable-vkeybd) _vkeybd=no ;; 1280 --enable-keymapper) _keymapper=yes ;; 1281 --disable-keymapper) _keymapper=no ;; 1282 --enable-eventrecorder) _eventrec=yes ;; 1283 --disable-eventrecorder) _eventrec=no ;; 1284 --enable-text-console) _text_console=yes ;; 1285 --disable-text-console) _text_console=no ;; 1286 --enable-iconv) _iconv=yes ;; 1287 --disable-iconv) _iconv=no ;; 1288 --with-fluidsynth-prefix=*) 1289 arg=`echo $ac_option | cut -d '=' -f 2` 1290 FLUIDSYNTH_CFLAGS="-I$arg/include" 1291 FLUIDSYNTH_LIBS="-L$arg/lib" 1292 ;; 1293 --with-mpeg2-prefix=*) 1294 arg=`echo $ac_option | cut -d '=' -f 2` 1295 MPEG2_CFLAGS="-I$arg/include" 1296 MPEG2_LIBS="-L$arg/lib" 1297 ;; 1298 --with-a52-prefix=*) 1299 arg=`echo $ac_option | cut -d '=' -f 2` 1300 A52_CFLAGS="-I$arg/include" 1301 A52_LIBS="-L$arg/lib" 1302 ;; 1303 --with-alsa-prefix=*) 1304 arg=`echo $ac_option | cut -d '=' -f 2` 1305 ALSA_CFLAGS="-I$arg/include" 1306 ALSA_LIBS="-L$arg/lib" 1307 ;; 1308 --with-sndio-prefix=*) 1309 arg=`echo $ac_option | cut -d '=' -f 2` 1310 SNDIO_CFLAGS="-I$arg/include" 1311 SNDIO_LIBS="-L$arg/lib" 1312 ;; 1313 --with-ogg-prefix=*) 1314 arg=`echo $ac_option | cut -d '=' -f 2` 1315 OGG_CFLAGS="-I$arg/include" 1316 OGG_LIBS="-L$arg/lib" 1317 ;; 1318 --with-vorbis-prefix=*) 1319 arg=`echo $ac_option | cut -d '=' -f 2` 1320 VORBIS_CFLAGS="-I$arg/include" 1321 VORBIS_LIBS="-L$arg/lib" 1322 ;; 1323 --with-tremor-prefix=*) 1324 arg=`echo $ac_option | cut -d '=' -f 2` 1325 TREMOR_CFLAGS="-I$arg/include" 1326 TREMOR_LIBS="-L$arg/lib" 1327 ;; 1328 --with-ieee1284-prefix=*) 1329 arg=`echo $ac_option | cut -d '=' -f 2` 1330 IEEE1284_CFLAGS="-I$arg/include" 1331 IEEE1284_LIBS="-L$arg/lib" 1332 ;; 1333 --with-flac-prefix=*) 1334 arg=`echo $ac_option | cut -d '=' -f 2` 1335 FLAC_CFLAGS="-I$arg/include" 1336 FLAC_LIBS="-L$arg/lib" 1337 ;; 1338 --with-mad-prefix=*) 1339 arg=`echo $ac_option | cut -d '=' -f 2` 1340 MAD_CFLAGS="-I$arg/include" 1341 MAD_LIBS="-L$arg/lib" 1342 ;; 1343 --with-jpeg-prefix=*) 1344 arg=`echo $ac_option | cut -d '=' -f 2` 1345 JPEG_CFLAGS="-I$arg/include" 1346 JPEG_LIBS="-L$arg/lib" 1347 ;; 1348 --with-png-prefix=*) 1349 arg=`echo $ac_option | cut -d '=' -f 2` 1350 PNG_CFLAGS="-I$arg/include" 1351 PNG_LIBS="-L$arg/lib" 1352 ;; 1353 --with-theoradec-prefix=*) 1354 arg=`echo $ac_option | cut -d '=' -f 2` 1355 THEORADEC_CFLAGS="-I$arg/include" 1356 THEORADEC_LIBS="-L$arg/lib" 1357 ;; 1358 --with-faad-prefix=*) 1359 arg=`echo $ac_option | cut -d '=' -f 2` 1360 FAAD_CFLAGS="-I$arg/include" 1361 FAAD_LIBS="-L$arg/lib" 1362 ;; 1363 --with-zlib-prefix=*) 1364 arg=`echo $ac_option | cut -d '=' -f 2` 1365 ZLIB_CFLAGS="-I$arg/include" 1366 ZLIB_LIBS="-L$arg/lib" 1367 ;; 1368 --with-sparkle-prefix=*) 1369 arg=`echo $ac_option | cut -d '=' -f 2` 1370 _sparklepath=$arg 1371 ;; 1372 --with-readline-prefix=*) 1373 arg=`echo $ac_option | cut -d '=' -f 2` 1374 READLINE_CFLAGS="-I$arg/include" 1375 READLINE_LIBS="-L$arg/lib" 1376 ;; 1377 --with-libunity-prefix=*) 1378 arg=`echo $ac_option | cut -d '=' -f 2` 1379 LIBUNITY_CFLAGS="-I$arg/include" 1380 LIBUNITY_LIBS="-L$arg/lib" 1381 ;; 1382 --with-sdlnet-prefix=*) 1383 arg=`echo $ac_option | cut -d '=' -f 2` 1384 SDL_NET_CFLAGS="-I$arg/include" 1385 SDL_NET_LIBS="-L$arg/lib" 1386 ;; 1387 --with-iconv-prefix=*) 1388 arg=`echo $ac_option | cut -d '=' -f 2` 1389 ICONV_CFLAGS="-I$arg/include" 1390 ICONV_LIBS="-L$arg/lib" 1391 ;; 1392 --backend=*) 1393 _backend=`echo $ac_option | cut -d '=' -f 2` 1394 ;; 1395 --enable-c++11) 1396 _use_cxx11=yes 1397 ;; 1398 --disable-c++11) 1399 _use_cxx11=no 1400 ;; 1401 --enable-debug) 1402 _debug_build=yes 1403 ;; 1404 --disable-debug) 1405 _debug_build=no 1406 ;; 1407 --enable-Werror) 1408 append_var CXXFLAGS "-Werror" 1409 ;; 1410 --enable-release-mode) 1411 _release_build=yes 1412 ;; 1413 --disable-release-mode) 1414 _release_build=no 1415 ;; 1416 --enable-release) 1417 _release_build=yes 1418 _optimizations=yes 1419 _updates=yes 1420 ;; 1421 --disable-release) 1422 _release_build=no 1423 _optimizations=no 1424 ;; 1425 --enable-optimizations) 1426 _optimizations=yes 1427 ;; 1428 --disable-optimizations) 1429 _optimizations=no 1430 ;; 1431 --enable-profiling) 1432 _enable_prof=yes 1433 ;; 1434 --with-sdl-prefix=*) 1435 arg=`echo $ac_option | cut -d '=' -f 2` 1436 _sdlpath="$arg:$arg/bin" 1437 ;; 1438 --with-freetype2-prefix=*) 1439 arg=`echo $ac_option | cut -d '=' -f 2` 1440 _freetypepath="$arg:$arg/bin" 1441 ;; 1442 --with-libcurl-prefix=*) 1443 arg=`echo $ac_option | cut -d '=' -f 2` 1444 _libcurlpath="$arg:$arg/bin" 1445 ;; 1446 --with-nasm-prefix=*) 1447 arg=`echo $ac_option | cut -d '=' -f 2` 1448 _nasmpath="$arg:$arg/bin" 1449 ;; 1450 --with-pandoc-format=*) 1451 arg=`echo $ac_option | cut -d '=' -f 2` 1452 _pandocformat="$arg" 1453 _pandoc=yes 1454 ;; 1455 --with-staticlib-prefix=*) 1456 _staticlibpath=`echo $ac_option | cut -d '=' -f 2` 1457 ;; 1458 --with-xcodetools-path=*) 1459 _xcodetoolspath=`echo $ac_option | cut -d '=' -f 2` 1460 ;; 1461 --host=*) 1462 _host=`echo $ac_option | cut -d '=' -f 2` 1463 ;; 1464 --prefix=*) 1465 prefix=`echo $ac_option | cut -d '=' -f 2` 1466 ;; 1467 --exec-prefix=*) 1468 exec_prefix=`echo $ac_option | cut -d '=' -f 2` 1469 ;; 1470 --bindir=*) 1471 bindir=`echo $ac_option | cut -d '=' -f 2` 1472 ;; 1473 --libdir=*) 1474 libdir=`echo $ac_option | cut -d '=' -f 2` 1475 ;; 1476 --datarootdir=*) 1477 datarootdir=`echo $ac_option | cut -d '=' -f 2` 1478 ;; 1479 --datadir=*) 1480 datadir=`echo $ac_option | cut -d '=' -f 2` 1481 ;; 1482 --mandir=*) 1483 mandir=`echo $ac_option | cut -d '=' -f 2` 1484 ;; 1485 --docdir=*) 1486 docdir=`echo $ac_option | cut -d '=' -f 2` 1487 ;; 1488 --enable-all-engines) 1489 engine_enable_all 1490 ;; 1491 --disable-all-engines) 1492 engine_disable_all 1493 ;; 1494 --enable-all-unstable-engines) 1495 engine_enable_all_unstable 1496 ;; 1497 --disable-all-unstable-engines) 1498 engine_disable_all_unstable 1499 ;; 1500 --enable-engine=* | --enable-engines=*) 1501 for engine_name in `echo $ac_option | cut -d '=' -f 2- | tr ',' '\n'`; do 1502 engine_enable "${engine_name}" 1503 done 1504 ;; 1505 --enable-engine-static=* | --enable-engines-static=*) 1506 for engine_name in `echo $ac_option | cut -d '=' -f 2- | tr ',' '\n'`; do 1507 engine_enable "${engine_name}:static" 1508 done 1509 ;; 1510 --enable-engine-dynamic=* | --enable-engines-dynamic=*) 1511 for engine_name in `echo $ac_option | cut -d '=' -f 2- | tr ',' '\n'`; do 1512 engine_enable "${engine_name}:dynamic" 1513 done 1514 ;; 1515 --disable-engine=* | --disable-engines=*) 1516 for engine_name in `echo $ac_option | cut -d '=' -f 2 | tr ',' '\n'`; do 1517 engine_disable ${engine_name} 1518 done 1519 ;; 1520 *) 1521 option_error 1522 ;; 1523 esac; 1524done; 1525 1526guessed_host=`$_srcdir/config.guess` 1527get_system_exe_extension $guessed_host 1528NATIVEEXEEXT=$_exeext 1529 1530case $_host in 15313ds) 1532 _host_os=3ds 1533 _host_cpu=arm 1534 _host_alias=arm-none-eabi 1535 1536 test "x$prefix" = xNONE && prefix=romfs: 1537 1538 datarootdir='${prefix}' 1539 datadir='${datarootdir}' 1540 docdir='${prefix}/doc' 1541 ;; 1542android | android-arm | android-v7a | android-arm-v7a | ouya) 1543 _host_os=android 1544 _host_cpu=arm 1545 _host_alias=arm-linux-androideabi 1546 ;; 1547android-arm64-v8a) 1548 _host_os=android 1549 _host_cpu=aarch64 1550 _host_alias=aarch64-linux-android 1551 ;; 1552android-mips) 1553 _host_os=android 1554 _host_cpu=mipsel 1555 _host_alias=mipsel-linux-android 1556 ;; 1557android-mips64) 1558 _host_os=android 1559 _host_cpu=mips64el 1560 _host_alias=mips64el-linux-android 1561 ;; 1562android-x86) 1563 _host_os=android 1564 _host_cpu=i686 1565 _host_alias=i686-linux-android 1566 ;; 1567android-x86_64) 1568 _host_os=android 1569 _host_cpu=x86_64 1570 _host_alias=x86_64-linux-android 1571 ;; 1572androidsdl-armeabi | androidsdl-armeabi-v7a) 1573 _host_os=androidsdl 1574 _host_cpu=arm 1575 _host_alias=arm-linux-androideabi 1576 ;; 1577androidsdl-arm64-v8a) 1578 _host_os=androidsdl 1579 _host_cpu=aarch64 1580 _host_alias=aarch64-linux-android 1581 ;; 1582androidsdl-mips) 1583 _host_os=androidsdl 1584 _host_cpu=mipsel 1585 _host_alias=mipsel-linux-android 1586 ;; 1587androidsdl-x86) 1588 _host_os=androidsdl 1589 _host_cpu=i686 1590 _host_alias=i686-linux-android 1591 ;; 1592androidsdl-x86_64) 1593 _host_os=androidsdl 1594 _host_cpu=x86_64 1595 _host_alias=x86_64-linux-android 1596 ;; 1597arm-*riscos) 1598 _host_os=riscos 1599 _host_cpu=arm 1600 _host_alias=$_host 1601 datarootdir='/\<ScummVM\$$Dir\>' 1602 datadir='${datarootdir}/data' 1603 docdir='${datarootdir}/docs' 1604 ;; 1605raspberrypi) 1606 _host_os=linux 1607 _host_cpu=arm 1608 # This tuple is the one used by the official Rpi toolchain. 1609 # It may change in the future. 1610 _host_alias=arm-linux-gnueabihf 1611 ;; 1612caanoo) 1613 _host_os=gph-linux 1614 _host_cpu=arm 1615 _host_alias=arm-none-linux-gnueabi 1616 ;; 1617dingux | gcw0) 1618 _host_os=linux 1619 _host_cpu=mipsel 1620 _host_alias=mipsel-linux 1621 ;; 1622dreamcast) 1623 _host_os=dreamcast 1624 _host_cpu=sh 1625 _host_alias=sh-elf 1626 append_var CXXFLAGS "-ml -m4-single-only" 1627 append_var LDFLAGS "-ml -m4-single-only" 1628 ;; 1629ds) 1630 _host_os=ds 1631 _host_cpu=arm 1632 _host_alias=arm-none-eabi 1633 ;; 1634gamecube) 1635 _host_os=gamecube 1636 _host_cpu=powerpc 1637 _host_alias=powerpc-eabi 1638 ;; 1639gp2x) 1640 _host_os=gph-linux 1641 _host_cpu=arm 1642 _host_alias=arm-open2x-linux 1643 ;; 1644gp2xwiz) 1645 _host_os=gph-linux 1646 _host_cpu=arm 1647 _host_alias=arm-open2x-linux 1648 ;; 1649i586-mingw32msvc) 1650 _host_os=mingw32msvc 1651 _host_cpu=i586 1652 ;; 1653iphone) 1654 _host_os=iphone 1655 _host_cpu=arm 1656 _host_alias=arm-apple-darwin9 1657 ;; 1658ios7) 1659 _host_os=iphone 1660 _host_cpu=arm 1661 _host_alias=arm-apple-darwin11 1662 ;; 1663maemo) 1664 _host_os=maemo 1665 _host_cpu=arm 1666 _host_alias=arm-none-linux-gnueabi 1667 1668 # The prefix is always the same on Maemo so we hardcode the default 1669 # here. It is still possible to define a custom prefix which is 1670 # needed when packaging the app with a user-specific app ID. 1671 test "x$prefix" = xNONE && prefix=/opt/scummvm 1672 # Maemo apps are installed into app-specific directories. The 1673 # default directory structure of ScummVM makes no sense here so we 1674 # hardcode Maemo specific directories here. 1675 datarootdir='${prefix}/share' 1676 datadir=/opt/scummvm/share 1677 docdir='${datarootdir}/doc/scummvm' 1678 ;; 1679motoezx) 1680 _host_os=linux 1681 _host_cpu=arm 1682 _host_alias=arm-linux-gnu 1683 ;; 1684motomagx) 1685 _host_os=linux 1686 _host_cpu=arm 1687 _host_alias=arm-linux-gnueabi 1688 ;; 1689n64) 1690 _host_os=n64 1691 _host_cpu=mips 1692 _host_alias=mips64 1693 ;; 1694neuros) 1695 _host_os=linux 1696 _host_cpu=arm 1697 ;; 1698openpandora) 1699 _host_os=linux 1700 _host_cpu=arm 1701 _host_alias=arm-angstrom-linux-gnueabi 1702 ;; 1703ppc-amigaos) 1704 _host_os=amigaos 1705 _host_cpu=powerpc 1706 _host_alias=$_host 1707 ;; 1708ps2) 1709 _host_os=ps2 1710 _host_cpu=mips64r5900el 1711 _host_alias=ee 1712 # PS2 bogus dirs: they actually depend on launch medium 1713 datadir='host:data' 1714 docdir='host:docs' 1715 ;; 1716ps3) 1717 _host_os=ps3 1718 _host_cpu=powerpc 1719 _host_alias=powerpc64-ps3-elf 1720 1721 # The prefix is always the same on PS3 so we hardcode the default 1722 # here. It is still possible to define a custom prefix which is 1723 # needed when packaging the app with a user-specific app ID. 1724 test "x$prefix" = xNONE && prefix=/dev_hdd0/game/SCUM12000/USRDIR 1725 # PS3 apps are installed into app-specific directories. The 1726 # default directory structure of ScummVM makes no sense here so we 1727 # hardcode PS3 specific directories here. 1728 datarootdir='${prefix}/data' 1729 datadir='${datarootdir}' 1730 docdir='${prefix}/doc' 1731 ;; 1732psp2) 1733 _host_os=psp2 1734 _host_cpu=arm 1735 _host_alias=arm-vita-eabi 1736 1737 # The prefix is always the same on PSP2 so we hardcode the default 1738 # here. It is still possible to define a custom prefix which is 1739 # needed when packaging the app with a user-specific app ID. 1740 test "x$prefix" = xNONE && prefix=app0: 1741 # PSP2 apps are installed into app-specific directories. The 1742 # default directory structure of ScummVM makes no sense here so we 1743 # hardcode PSP2 specific directories here. 1744 datarootdir='${prefix}/data' 1745 datadir='${datarootdir}' 1746 docdir='${prefix}/doc' 1747 ;; 1748psp) 1749 _host_os=psp 1750 _host_cpu=mipsallegrexel 1751 _host_alias=psp 1752 ;; 1753samsungtv) 1754 _host_os=linux 1755 _host_cpu=arm 1756 _host_alias=arm-linux-gnueabi 1757 ;; 1758switch) 1759 _host_os=switch 1760 _host_cpu=aarch64 1761 _host_alias=aarch64-none-elf 1762 test "x$prefix" = xNONE && prefix=. 1763 datarootdir='${prefix}/data' 1764 datadir='${datarootdir}' 1765 docdir='${prefix}/doc' 1766 ;; 1767tizen) 1768 _host_os=tizen 1769 _host_cpu=arm 1770 _host_alias=arm-linux-gnueabi 1771 ;; 1772webos) 1773 _host_os=webos 1774 _host_cpu=arm 1775 _host_alias=arm-none-linux-gnueabi 1776 # The prefix is always the same on WebOS so we hardcode the default 1777 # here. It is still possible to define a custom prefix which is 1778 # needed when packaging the app with a user-specific app ID. 1779 test "x$prefix" = xNONE && prefix=/media/cryptofs/apps/usr/palm/applications/org.scummvm.scummvm 1780 # WebOS apps are installed into app-specific directories. The 1781 # default directory structure of ScummVM makes no sense here so we 1782 # hardcode WebOS specific directories here. 1783 datarootdir='${prefix}/data' 1784 datadir='${datarootdir}' 1785 docdir='${prefix}/doc' 1786 ;; 1787wii) 1788 _host_os=wii 1789 _host_cpu=powerpc 1790 _host_alias=powerpc-eabi 1791 ;; 1792wince) 1793 _host_os=wince 1794 _host_cpu=arm 1795 _host_alias=arm-mingw32ce 1796 ;; 1797*) 1798 if test -n "$_host"; then 1799 guessed_host=`$_srcdir/config.sub $_host` 1800 fi 1801 _host_cpu=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` 1802 _host_vendor=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` 1803 _host_os=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` 1804 ;; 1805esac 1806 1807if test -z "$_host_alias"; then 1808 _host_alias="$_host_cpu-$_host_os" 1809else 1810 # if _host_alias was set, default to the standard GNU tools 1811 _ranlib=$_host_alias-ranlib 1812 _strip=$_host_alias-strip 1813 _ar="$_host_alias-ar cru" 1814 _as="$_host_alias-as" 1815 _dwp=$_host_alias-dwp 1816 _windres=$_host_alias-windres 1817fi 1818 1819case $_host in 1820arm-*riscos | caanoo | gp2x | gp2xwiz | openpandora | ps2 | psp | psp2 | switch) 1821 if test "$_debug_build" = auto; then 1822 # If you want to debug one of these platforms, use '--disable-optimizations --enable-debug' 1823 _debug_build=no 1824 fi 1825 1826 if test "$_optimizations" = auto; then 1827 # Enable optimizations by default. 1828 _optimizations=yes 1829 fi 1830 ;; 1831esac 1832 1833# 1834# Determine extension used for executables 1835# 1836get_system_exe_extension $_host_os 1837HOSTEXEPRE= 1838HOSTEXEEXT=$_exeext 1839 1840# 1841# Determine separator used for $PATH 1842# 1843case $_host_os in 1844os2-emx*) 1845 SEPARATOR=";" 1846 ;; 1847*) 1848 SEPARATOR=":" 1849 ;; 1850esac 1851 1852# 1853# Platform specific sanity checks 1854# 1855case $_host_os in 1856android) 1857 if test -z "$ANDROID_SDK"; then 1858 # $ANDROID_SDK must be the path to the root of the Android SDK folder; 1859 # The SDK should have installed the target SDK platform version as specified 1860 # in the Android port's manifest files and project.properties 1861 echo "Please set ANDROID_SDK in your environment. Export ANDROID_SDK=<path to Android SDK>" 1862 exit 1 1863 fi 1864 if test -z "$ANDROID_NDK"; then 1865 # $ANDROID_NDK must be the path to the root of the NDK folder; 1866 # A ndk-build script should reside (in r14b this calls the actual ndk-build in the build subfolder) 1867 echo "Please set ANDROID_NDK in your environment. Export ANDROID_NDK=<path to Android NDK>" 1868 exit 1 1869 fi 1870 ;; 18713ds | ds | gamecube | switch | wii) 1872 if test -z "$DEVKITPRO"; then 1873 echo "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to devkitPRO>" 1874 exit 1 1875 fi 1876 ;; 1877dreamcast) 1878 if test -z "$RONINDIR"; then 1879 echo "Please set RONINDIR in your environment. export RONINDIR=<path to libronin>" 1880 exit 1 1881 fi 1882 ;; 1883n64) 1884 if test -z "$N64SDK"; then 1885 echo "Please set N64SDK in your environment. export N64SDK=<path to n64 sdk>" 1886 exit 1 1887 fi 1888 ;; 1889ps2) 1890 if test -z "$PS2SDK"; then 1891 echo "Please set PS2SDK in your environment. export PS2SDK=<path to ps2 sdk>" 1892 exit 1 1893 fi 1894 ;; 1895ps3) 1896 if test -z "$PS3DEV"; then 1897 echo "Please set PS3DEV in your environment. export PS3DEV=<path to ps3 toolchain>" 1898 exit 1 1899 fi 1900 if test -z "$PSL1GHT"; then 1901 echo "Please set PSL1GHT in your environment. export PSL1GHT=<path to psl1ght>" 1902 exit 1 1903 fi 1904 ;; 1905psp2) 1906 if test -z "$VITASDK"; then 1907 echo "Please set VITASDK in your environment. export VITASDK=<path to psp2 toolchain>" 1908 exit 1 1909 fi 1910 ;; 1911psp) 1912 if test -z "$PSPDEV"; then 1913 PSPDEV=`psp-config --pspdev-path` 1914 fi 1915 # TODO: Should we also insist on a valid PSPDEV value? 1916 if test -z "$PSPSDK"; then 1917 PSPSDK=`psp-config --pspsdk-path` 1918 fi 1919 if test -z "$PSPSDK"; then 1920 echo "Please set PSPSDK in your environment. export PSPSDK=<path to psp sdk>" 1921 exit 1 1922 fi 1923 1924 # These have to be set early because the compiler will not link successfully 1925 # during testing otherwise 1926 if test -d "$PSPDEV/psp/lib"; then 1927 append_var LDFLAGS "-L$PSPDEV/psp/lib" 1928 fi 1929 append_var LDFLAGS "-L$PSPSDK/lib" 1930 append_var LDFLAGS "-specs=$_srcdir/backends/platform/psp/psp.spec" 1931 1932 ;; 1933riscos) 1934 if test -z "$GCCSDK_INSTALL_ENV"; then 1935 echo "Please set GCCSDK_INSTALL_ENV in your environment. export GCCSDK_INSTALL_ENV=<path to GCCSDK_INSTALL_ENV>" 1936 exit 1 1937 fi 1938 1939 if test -e "$GCCSDK_INSTALL_ENV/bin/tokenize"; then 1940 add_line_to_config_mk "TOKENIZE := $GCCSDK_INSTALL_ENV/bin/tokenize" 1941 elif `which tokenize >/dev/null 2>&1`; then 1942 add_line_to_config_mk "TOKENIZE := tokenize" 1943 fi 1944 if test -e "$GCCSDK_INSTALL_ENV/bin/bindhelp"; then 1945 add_line_to_config_mk "BINDHELP := $GCCSDK_INSTALL_ENV/bin/bindhelp" 1946 elif `which bindhelp >/dev/null 2>&1`; then 1947 add_line_to_config_mk "BINDHELP := bindhelp" 1948 fi 1949 ;; 1950tizen) 1951 if test -z "$TIZEN_ROOTSTRAP"; then 1952 echo "Please set TIZEN_ROOTSTRAP in your environment. export TIZEN_ROOTSTRAP=<path to Tizen SDK device profile>" 1953 exit 1 1954 fi 1955 ;; 1956webos) 1957 if test -z "$WEBOS_SDK"; then 1958 echo "Please set WEBOS_SDK in your environment. export WEBOS_SDK=<path to WebOS SDK>" 1959 exit 1 1960 fi 1961 if test -z "$WEBOS_PDK"; then 1962 echo "Please set WEBOS_PDK in your environment. export WEBOS_PDK=<path to WebOS PDK>" 1963 exit 1 1964 fi 1965 ;; 1966*) 1967 ;; 1968esac 1969 1970# 1971# Determine the C++ compiler 1972# 1973echo_n "Looking for C++ compiler... " 1974 1975# Check whether the given command is a working C++ compiler 1976test_compiler() { 1977 cat > tmp_cxx_compiler.cpp << EOF 1978 class Foo { int a; }; 1979 int main(int argc, char **argv) { 1980 Foo *a = new Foo(); delete a; return 0; 1981 } 1982EOF 1983 1984 echo "testing compiler: $1" >> "$TMPLOG" 1985 1986 if test -n "$_host"; then 1987 # In cross-compiling mode, we cannot run the result 1988 eval "$1 $CXXFLAGS -o $TMPO.o -c tmp_cxx_compiler.cpp" 2> /dev/null && cc_check_clean tmp_cxx_compiler.cpp 1989 else 1990 eval "$1 $CXXFLAGS $LDFLAGS -o $TMPO$HOSTEXEEXT tmp_cxx_compiler.cpp" 2> /dev/null && eval "$TMPO$HOSTEXEEXT 2> /dev/null" && cc_check_clean tmp_cxx_compiler.cpp 1991 fi 1992} 1993 1994# Prepare a list of candidates for the C++ compiler 1995if test -n "$CXX" && test_compiler "$CXX"; then 1996 # Use the compiler specified in CXX 1997 echo $CXX 1998else 1999 if test -n "$_host"; then 2000 compilers="$_host_alias-g++ $_host_alias-c++ $_host-g++ $_host-c++" 2001 else 2002 compilers="g++ c++" 2003 fi 2004 2005 # Iterate over all candidates, pick the first working one 2006 CXX= 2007 for compiler in $compilers; do 2008 if test_compiler $compiler; then 2009 echo "success testing compiler: $compiler" >> "$TMPLOG" 2010 CXX=$compiler 2011 echo $CXX 2012 break 2013 else 2014 echo "failure testing compiler: $compiler" >> "$TMPLOG" 2015 fi 2016 done 2017fi 2018 2019if test -z "$CXX"; then 2020 echo "none found!" 2021 exit 1 2022fi 2023 2024if test -n "$RANLIB"; then 2025 _ranlib=$RANLIB 2026fi 2027 2028if test -n "$STRIP"; then 2029 _strip=$STRIP 2030fi 2031 2032if test -n "$AR"; then 2033 _ar="$AR cru" 2034fi 2035 2036if test -n "$AS"; then 2037 _as=$AS 2038fi 2039 2040if test -n "$DWP"; then 2041 _dwp=$DWP 2042fi 2043 2044if test -n "$WINDRES"; then 2045 _windres=$WINDRES 2046fi 2047 2048LD=$CXX 2049 2050# 2051# Determine the compiler version 2052# 2053echocheck "compiler version" 2054 2055# Some compilers pretend to be gcc to ease compatibility with 2056# common Linux etc. programs. We first check for some of these here. 2057have_gcc=no 2058cc_check_define __GNUC__ && have_gcc=yes 2059have_icc=no 2060cc_check_define __INTEL_COMPILER && have_icc=yes 2061have_clang=no 2062cc_check_define __clang__ && have_clang=yes 2063 2064if test "$have_icc" = yes; then 2065 add_line_to_config_mk 'HAVE_ICC = 1' 2066 2067 # Make ICC error out on unknown command line options instead of printing 2068 # a warning. This is for example required to make the -Wglobal-destructors 2069 # detection work correctly. 2070 append_var CXXFLAGS "-diag-error 10006,10148" 2071 2072 # ICC doesn't accept all gcc options, so we disable have_gcc, even if 2073 # ICC does have the gcc-compatibility defines. 2074 have_gcc=no 2075fi 2076 2077if test "$have_clang" = yes; then 2078 add_line_to_config_mk 'HAVE_CLANG = 1' 2079 2080 # clang does accept all gcc options we use, so we keep have_gcc 2081fi 2082 2083if test "$have_gcc" = yes; then 2084 add_line_to_config_mk 'HAVE_GCC = 1' 2085 _cxx_major=`gcc_get_define __GNUC__` 2086 _cxx_minor=`gcc_get_define __GNUC_MINOR__` 2087 cxx_version="`( $CXX -dumpversion ) 2>&1`" 2088 2089 if test "$have_clang" = yes; then 2090 # Clang sets a gcc version number for compatibility. 2091 # We keep that as _cxx_minor/_cxx_major for later 2092 # compiler version checks. 2093 2094 # For the version reported in the configure log (cxx_version), 2095 # we get the actual clang version. 2096 cxx_version=`gcc_get_define __clang_version__` 2097 cxx_version="`echo "${cxx_version}" | sed -e 's/"\([^ ]*\) .*/\1/'`" 2098 cxx_version="clang $cxx_version, ok" 2099 elif test "$_cxx_major" -eq 2 && test "$_cxx_minor" -ge 95 || \ 2100 test "$_cxx_major" -gt 2 ; then 2101 cxx_version="$cxx_version, ok" 2102 cxx_verc_fail=no 2103 else 2104 cxx_version="$cxx_version, bad" 2105 cxx_verc_fail=yes 2106 fi 2107elif test "$have_icc" = yes; then 2108 cxx_version="`( $CXX -dumpversion ) 2>/dev/null`" 2109 _cxx_major="`echo "${cxx_version}" | sed -ne 's/\([0-9][0-9]*\)\..*/\1/gp'`" 2110 _cxx_minor="`echo "${cxx_version}" | sed -ne 's/[0-9][0-9]*\.\([0-9][0-9]*\)/\1/gp'`" 2111 cxx_version="ICC $cxx_version, ok" 2112else 2113 # TODO: Big scary warning about unsupported compilers 2114 cxx_version=`( $CXX -version ) 2>&1` 2115 if test "$?" -eq 0; then 2116 cxx_version="`echo "${cxx_version}" | sed -ne 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/gp'`" 2117 if test -z "${cxx_version}"; then 2118 cxx_version="not found" 2119 cxx_verc_fail=yes 2120 fi 2121 echo non-gcc compiler version ${cxx_version} 2122 else 2123 cxx_version="not found" 2124 cxx_verc_fail=yes 2125 echo found non-gcc compiler version ${cxx_version} 2126 fi 2127 2128 case $_host_os in 2129 irix*) 2130 case $cxx_version in 2131 7.4.4*) 2132 # We just assume this is SGI MIPSpro 2133 _cxx_major=7 2134 _cxx_minor=4 2135 cxx_verc_fail=no 2136 add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MDupdate "$(*D)/$(DEPDIR)/$(*F).d"' 2137 add_line_to_config_mk '-include Makedepend' 2138 ;; 2139 *) 2140 cxx_version="$cxx_version, bad" 2141 cxx_verc_fail=yes 2142 ;; 2143 esac 2144 ;; 2145 *) 2146 cxx_version="$cxx_version, bad" 2147 cxx_verc_fail=yes 2148 ;; 2149 esac 2150fi 2151 2152echo "$cxx_version" 2153 2154# 2155# Bail out now if no useable compiler was found. 2156# 2157if test "$cxx_verc_fail" = yes ; then 2158 echo 2159 echo "The version of your compiler is not supported at this time" 2160 echo "Please ensure you are using GCC >= 2.95" 2161 exit 1 2162fi 2163 2164# 2165# Check whether the compiler supports C++11 2166# 2167have_cxx11=no 2168cat > $TMPC << EOF 2169int main(int argc, char *argv[]) { if (argv == nullptr) return -1; else return 0; } 2170EOF 2171cc_check -std=c++11 && have_cxx11=yes 2172if test "$_use_cxx11" = "yes" ; then 2173 _use_cxx11=$have_cxx11 2174fi 2175 2176# 2177# Setup compiler specific CXXFLAGS now that we know the compiler version. 2178# Foremost, this means enabling various warnings. 2179# In addition, we set CXX_UPDATE_DEP_FLAG for GCC >= 3.0 and for ICC. 2180# 2181if test "$have_gcc" = yes ; then 2182 if test "$_cxx_major" -ge "3" ; then 2183 # Try to use ANSI mode when C++11 is disabled. 2184 if test "$_use_cxx11" = "no" ; then 2185 case $_host_os in 2186 # newlib-based system include files suppress non-C89 function 2187 # declarations under __STRICT_ANSI__ 2188 3ds | amigaos* | android | androidsdl | dreamcast | ds | gamecube | mingw* | mint* | n64 | psp | ps2 | ps3 | psp2 | switch | tizen | wii | wince ) 2189 ;; 2190 *) 2191 append_var CXXFLAGS "-ansi" 2192 ;; 2193 esac 2194 fi 2195 append_var CXXFLAGS "-W -Wno-unused-parameter" 2196 add_line_to_config_mk 'HAVE_GCC3 = 1' 2197 add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP' 2198 fi; 2199 2200 if test "$_cxx_major" -eq 4 && test "$_cxx_minor" -ge 3 || \ 2201 test "$_cxx_major" -gt 4 ; then 2202 append_var CXXFLAGS "-Wno-empty-body" 2203 else 2204 append_var CXXFLAGS "-Wconversion" 2205 fi; 2206elif test "$have_icc" = yes ; then 2207 add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP' 2208fi; 2209 2210# 2211# Update status about C++11 mode 2212# 2213echo_n "Building as C++11... " 2214if test "$_use_cxx11" = "yes" ; then 2215 append_var CXXFLAGS "-std=c++11" 2216fi 2217echo $_use_cxx11 2218 2219# 2220# Determine extra build flags for debug and/or release builds 2221# 2222if test "$_debug_build" != no; then 2223 # debug mode not explicitly disabled -> compile with debug information 2224 echo_n "Checking best debug mode... " 2225 2226 debug_mode=-g 2227 test "$_host_os" = amigaos && debug_mode=-gstabs 2228 append_var CXXFLAGS "$debug_mode" 2229 echo_n -- "$debug_mode" 2230 2231 echo "int main() { return 0; }" > $TMPC 2232 if `which $_dwp >/dev/null 2>&1` && cc_check_no_clean $debug_mode -gsplit-dwarf && `$_dwp -e $TMPO -o /dev/null >/dev/null 2>&1`; then 2233 append_var CXXFLAGS "-gsplit-dwarf" 2234 add_line_to_config_mk "SPLIT_DWARF = 1" 2235 echo_n -- " + split DWARF" 2236 if cc_check_no_clean $debug_mode -gsplit-dwarf -fuse-ld=gold -Wl,--gdb-index; then 2237 append_var LDFLAGS "-fuse-ld=gold" 2238 append_var LDFLAGS "-Wl,--gdb-index" 2239 echo_n -- " + Gold" 2240 fi 2241 fi 2242 2243 if cc_check_no_clean $debug_mode -fvar-tracking-assignments; then 2244 append_var CXXFLAGS "-fvar-tracking-assignments" 2245 echo_n -- " + var tracking" 2246 fi 2247 cc_check_clean 2248 echo "" 2249fi 2250 2251if test "$_release_build" = yes; then 2252 # Add a define, which indicates we are doing 2253 # an build for a release version. 2254 append_var DEFINES "-DRELEASE_BUILD" 2255fi 2256 2257# By default, we add -pedantic to the CXXFLAGS to catch some potentially 2258# non-portable constructs, like use of GNU extensions. 2259# However, some platforms use GNU extensions in system header files, so 2260# for these we must not use -pedantic. 2261case $_host_os in 22623ds | android | androidsdl | gamecube | ps2 | psp | switch | tizen | wii | webos) 2263 ;; 2264*) 2265 # ICC does not support pedantic, while GCC and clang do. 2266 if test "$have_icc" = no ; then 2267 # We *do* want the 'long long' extension. 2268 append_var CXXFLAGS "-pedantic -Wno-long-long" 2269 fi 2270 ;; 2271esac 2272 2273# If possible, we want to use -Wglobal-constructors 2274# However, not all compilers support that, so check whether the active one does. 2275echocheck "whether C++ compiler accepts -Wglobal-constructors" 2276cat > $TMPC << EOF 2277int main() { return 0; } 2278EOF 2279cc_check -Wglobal-constructors -Werror && _global_constructors=yes 2280 2281if test "$_global_constructors" = yes; then 2282 append_var CXXFLAGS "-Wglobal-constructors" 2283fi 2284echo $_global_constructors 2285 2286# If the compiler supports the -Wundefined-var-template flag, silence that warning. 2287# We get this warning a lot with regard to the Singleton class as we explicitly 2288# instantiate each specialisation. An alternate way to deal with it would be to 2289# change the way we instantiate the singleton classes as done in PR #967. 2290# Note: we check the -Wundefined-var-template as gcc does not error out on unknown 2291# -Wno-xxx flags. 2292echocheck "whether C++ compiler accepts -Wno-undefined-var-template" 2293cat > $TMPC << EOF 2294int main() { return 0; } 2295EOF 2296cc_check -Wundefined-var-template -Werror && _no_undefined_var_template=yes 2297 2298if test "$_no_undefined_var_template" = yes; then 2299 append_var CXXFLAGS "-Wno-undefined-var-template" 2300fi 2301echo $_no_undefined_var_template 2302 2303# Vanilla clang 6 enables the new -Wpragma-pack which warns when leaving an 2304# included file which changes the current alignment. 2305# As our common/pack-{start,end}.h trigger this we disable this warning. 2306# Because there is no correlation between the version reported by Apple Xcode 2307# clang and vanilla clang we cannot rely on the __clang_major__/clang_minor__ 2308# macros. 2309# Note: as above, we check for -Wpragma-pack as not all compilers error out on 2310# unknown -Wno-xxx flags. 2311echocheck "whether C++ compiler accepts -Wno-pragma-pack" 2312echo "int main() { return 0; }" >$TMPC 2313cc_check -Wpragma-pack -Werror && _no_pragma_pack=yes 2314test "$_no_pragma_pack" = yes && append_var CXXFLAGS "-Wno-pragma-pack" 2315echo $_no_pragma_pack 2316 2317if test -n "$STRINGS"; then 2318 _strings=$STRINGS 2319else 2320 echo_n "Checking for $_host_alias-strings... " >> "$TMPLOG" 2321 if `which $_host_alias-strings >/dev/null 2>&1`; then 2322 _strings=$_host_alias-strings 2323 echo yes >> "$TMPLOG" 2324 else 2325 _strings=strings 2326 echo no >> "$TMPLOG" 2327 fi 2328fi 2329 2330# 2331# Check for endianness 2332# 2333echo_n "Checking endianness... " 2334cat > tmp_endianness_check.cpp << EOF 2335unsigned short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; 2336unsigned short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; 2337void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; } 2338unsigned short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; 2339unsigned short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; 2340void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; } 2341int main() { _ascii (); _ebcdic (); return 0; } 2342EOF 2343$CXX $LDFLAGS $CXXFLAGS -o $TMPO$HOSTEXEEXT tmp_endianness_check.cpp 2344if $_strings $TMPO$HOSTEXEEXT | grep BIGenDianSyS >/dev/null; then 2345 _endian=big 2346elif $_strings $TMPO$HOSTEXEEXT | grep LiTTleEnDian >/dev/null; then 2347 _endian=little 2348fi 2349echo $_endian; 2350cc_check_clean tmp_endianness_check.cpp tmp_endianness_check.dwo 2351 2352case $_endian in 2353 big) 2354 add_line_to_config_h '#undef SCUMM_LITTLE_ENDIAN' 2355 add_line_to_config_h '#define SCUMM_BIG_ENDIAN' 2356 ;; 2357 little) 2358 add_line_to_config_h '#define SCUMM_LITTLE_ENDIAN' 2359 add_line_to_config_h '#undef SCUMM_BIG_ENDIAN' 2360 ;; 2361 *) 2362 exit 1 2363 ;; 2364esac 2365 2366# 2367# Determine a data type with the given length 2368# 2369find_type_with_size() { 2370 for datatype in int short char long "long long" __int64 "long long int" unknown; do 2371 cat > tmp_find_type_with_size.cpp << EOF 2372typedef $datatype ac__type_sizeof_; 2373int main() { 2374 static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) == $1)]; 2375 test_array [0] = 0; 2376 return 0; 2377} 2378EOF 2379 if $CXX $CXXFLAGS -c -o $TMPO.o tmp_find_type_with_size.cpp 2>/dev/null ; then 2380 break 2381 else 2382 if test "$datatype" = "unknown"; then 2383 echo "couldn't find data type with $1 bytes" 2384 exit 1 2385 fi 2386 continue 2387 fi 2388 done 2389 cc_check_clean tmp_find_type_with_size.cpp 2390 echo $datatype 2391} 2392 2393# 2394# Check whether the system is 32-bit 2395# 2396pointer_is_32bit() { 2397 cat > tmp_pointer_is_32bit.cpp << EOF 2398int main() { 2399 static int test_array[1 - 2 * !(sizeof(void *) == 4)]; 2400 test_array[0] = 0; 2401 return 0; 2402} 2403EOF 2404 $CXX $CXXFLAGS -c -o $TMPO.o tmp_pointer_is_32bit.cpp 2>/dev/null 2405 status=$? 2406 cc_check_clean tmp_pointer_is_32bit.cpp 2407 return $status 2408} 2409 2410echo_n "Checking 64-bitness... " 2411pointer_is_32bit 2412if test $? -eq 0; then 2413 type_ptr=uint32 2414 echo "no" 2415else 2416 type_ptr=uint64 2417 echo "yes" 2418fi 2419 2420# 2421# Determine data type sizes 2422# 2423echo_n "Type with 1 byte... " 2424type_1_byte=`find_type_with_size 1` 2425TMPR="$?" 2426echo "$type_1_byte" 2427test $TMPR -eq 0 || exit 1 # check exit code of subshell 2428 2429echo_n "Type with 2 bytes... " 2430type_2_byte=`find_type_with_size 2` 2431TMPR="$?" 2432echo "$type_2_byte" 2433test $TMPR -eq 0 || exit 1 # check exit code of subshell 2434 2435echo_n "Type with 4 bytes... " 2436type_4_byte=`find_type_with_size 4` 2437TMPR="$?" 2438echo "$type_4_byte" 2439test $TMPR -eq 0 || exit 1 # check exit code of subshell 2440 2441echo_n "Type with 8 bytes... " 2442type_8_byte=`find_type_with_size 8` 2443TMPR="$?" 2444echo "$type_8_byte" 2445test $TMPR -eq 0 || exit 1 # check exit code of subshell 2446 2447# 2448# Check whether memory alignment is required 2449# 2450# For some CPU types, unaligned memory access is either not supported at 2451# all (and so leads to a crash), requires a super-slow emulation via an 2452# exception handler, or just results in incorrect results. 2453# On the other hand, accessing data in a manner that works regardless of 2454# alignment can be a lot slower than regular access, so we don't want 2455# to use it if we don't have to. 2456# 2457# So we do the following: For CPU families where we know whether unaligned 2458# access is safe & fast, we enable / disable unaligned access accordingly. 2459# Otherwise, we just disable memory alignment. 2460# 2461# NOTE: In the past, for non-cross compiled builds, we would also run some code 2462# which would try to test whether unaligned access worked or not. But this test 2463# could not reliably determine whether unaligned access really worked in all 2464# situations (and across different implementations of the target CPU arch), nor 2465# whether it was fast (as opposed to slowly emulated by fault handlers). Hence, 2466# we do not use this approach anymore. 2467# 2468# NOTE: The only kinds of unaligned access we allow are for 2 byte and 4 2469# byte loads / stores. No promises are made for bigger sizes, such as 8 2470# or 16 byte loads, for which architectures may behave differently than 2471# for the smaller sizes. 2472echo_n "Alignment required... " 2473case $_host_cpu in 2474 i[3-6]86 | amd64 | x86_64 | powerpc* | ppc*) 2475 # Unaligned access should work 2476 _need_memalign=no 2477 ;; 2478 alpha* | arm* | bfin* | hp* | mips* | sh* | sparc* | ia64 | nv1*) 2479 # Unaligned access is not supported or extremely slow. 2480 _need_memalign=yes 2481 ;; 2482 *) 2483 # Status of unaligned access is unknown, so assume the worst. 2484 _need_memalign=yes 2485 ;; 2486esac 2487echo "$_need_memalign" 2488 2489define_in_config_h_if_yes $_need_memalign 'SCUMM_NEED_ALIGNMENT' 2490 2491# 2492# Check the CPU architecture 2493# 2494echo_n "Checking host CPU architecture... " 2495case $_host_cpu in 2496 arm*) 2497 echo "ARM" 2498 case $_host in 2499 openpandora) 2500 define_in_config_if_yes yes 'USE_ARM_NEON_ASPECT_CORRECTOR' 2501 ;; 2502 android | android-arm | androidsdl-armeabi | arm-*riscos | caanoo | ds | gp2x | gp2xwiz | maemo | tizen | wince) 2503 define_in_config_if_yes yes 'USE_ARM_SCALER_ASM' 2504 # FIXME: The following feature exhibits a bug. It produces distorted 2505 # sound since 9003ce517ff9906b0288f9f7c02197fd091d4554. The ARM 2506 # assembly will need to be properly adapted to the changes to the C 2507 # code in 8f5a7cde2f99de9fef849b0ff688906f05f4643e. 2508 # See bug #6957: "AUDIO: ARM ASM sound code causes distorted audio on 32 bit armv6" 2509 #define_in_config_if_yes yes 'USE_ARM_SOUND_ASM' 2510 define_in_config_if_yes yes 'USE_ARM_SMUSH_ASM' 2511 define_in_config_if_yes yes 'USE_ARM_GFX_ASM' 2512 # FIXME: The following feature exhibits a bug during the intro scene of Indy 4 2513 # (on Pandora and iPhone at least) 2514 #define_in_config_if_yes yes 'USE_ARM_COSTUME_ASM' 2515 ;; 2516 esac 2517 2518 append_var DEFINES "-DARM_TARGET" 2519 ;; 2520 i[3-6]86) 2521 echo "x86" 2522 _have_x86=yes 2523 define_in_config_h_if_yes $_have_x86 'HAVE_X86' 2524 ;; 2525 mips*) 2526 echo "MIPS" 2527 append_var DEFINES "-DMIPS_TARGET" 2528 ;; 2529 powerpc* | ppc*) 2530 echo "PowerPC" 2531 append_var DEFINES "-DPPC_TARGET" 2532 ;; 2533 amd64 | x86_64) 2534 echo "x86_64" 2535 ;; 2536 *) 2537 echo "unknown ($_host_cpu)" 2538 ;; 2539esac 2540 2541 2542# 2543# Determine build settings 2544# 2545echo_n "Checking hosttype... " 2546echo $_host_os 2547case $_host_os in 2548 3ds) 2549 _optimization_level=-O2 2550 append_var DEFINES "-D__3DS__" 2551 append_var DEFINES "-DARM" 2552 append_var DEFINES "-DARM11" 2553 append_var CXXFLAGS "-march=armv6k" 2554 append_var CXXFLAGS "-mtune=mpcore" 2555 append_var CXXFLAGS "-mword-relocations" 2556 append_var CXXFLAGS "-mfloat-abi=hard" 2557 append_var CXXFLAGS "-ffunction-sections" 2558 append_var CXXFLAGS "-fomit-frame-pointer" 2559 append_var CXXFLAGS "-I$DEVKITPRO/libctru/include" 2560 append_var CXXFLAGS "-I$DEVKITPRO/portlibs/3ds/include" 2561 if test "$_dynamic_modules" = no ; then 2562 append_var LDFLAGS "-Wl,--gc-sections" 2563 else 2564 append_var LDFLAGS "-Wl,--no-gc-sections" 2565 fi 2566 append_var LDFLAGS "-L$DEVKITPRO/libctru/lib" 2567 append_var LDFLAGS "-L$DEVKITPRO/portlibs/3ds/lib" 2568 append_var LIBS "-lcitro3d -lctru" 2569 ;; 2570 amigaos*) 2571 append_var LDFLAGS "-Wl,--export-dynamic" 2572 append_var LDFLAGS "-L/sdk/local/newlib/lib" 2573 # We have to use 'long' for our 4 byte typedef because AmigaOS already typedefs (u)int32 2574 # as (unsigned) long, and consequently we'd get a compiler error otherwise. 2575 type_4_byte='long' 2576 # Supress format warnings as the long 4 byte causes noisy warnings. 2577 append_var CXXFLAGS "-Wno-format" 2578 add_line_to_config_mk 'AMIGAOS = 1' 2579 _port_mk="backends/platform/sdl/amigaos/amigaos.mk" 2580 _nuked_opl=no 2581 ;; 2582 android) 2583 case $_host in 2584 android | android-arm) 2585 append_var CXXFLAGS "-march=armv5te" 2586 append_var CXXFLAGS "-mtune=xscale" 2587 append_var CXXFLAGS "-mfloat-abi=softfp" 2588 ABI="armeabi" 2589 ;; 2590 android-v7a | android-arm-v7a) 2591 append_var CXXFLAGS "-march=armv7-a" 2592 append_var CXXFLAGS "-mfloat-abi=softfp" 2593 append_var CXXFLAGS "-mfpu=vfp" 2594 append_var LDFLAGS "-march=armv7-a" 2595 append_var LDFLAGS "-Wl,--fix-cortex-a8" 2596 ABI="armeabi-v7a" 2597 ;; 2598 android-arm64-v8a) 2599 ABI="arm64-v8a" 2600 ;; 2601 android-mips) 2602 append_var CXXFLAGS "-march=mips32" 2603 append_var CXXFLAGS "-mtune=mips32" 2604 ABI="mips" 2605 # Platform version 9 is needed as earlier versions of platform do not support this arch. 2606 ;; 2607 android-mips64) 2608 ABI="mips64" 2609 ;; 2610 android-x86) 2611 append_var CXXFLAGS "-march=i686" 2612 append_var CXXFLAGS "-mtune=intel" 2613 ABI="x86" 2614 # Platform version 9 is needed as earlier versions of platform do not support this arch. 2615 ;; 2616 android-x86_64) 2617 append_var CXXFLAGS "-march=x86-64" 2618 append_var CXXFLAGS "-mtune=intel" 2619 ABI="x86_64" 2620 ;; 2621 ouya) 2622 append_var CXXFLAGS "-march=armv7-a" 2623 append_var CXXFLAGS "-mtune=cortex-a9" 2624 append_var CXXFLAGS "-mfloat-abi=softfp" 2625 append_var CXXFLAGS "-mfpu=neon" 2626 ABI="armeabi-v7a" 2627 ;; 2628 esac 2629 2630 append_var CXXFLAGS "-fpic" 2631 append_var CXXFLAGS "-ffunction-sections" 2632 append_var CXXFLAGS "-funwind-tables" 2633 if test "$_debug_build" = yes; then 2634 append_var CXXFLAGS "-fno-omit-frame-pointer" 2635 append_var CXXFLAGS "-fno-strict-aliasing" 2636 else 2637 append_var CXXFLAGS "-fomit-frame-pointer" 2638 append_var CXXFLAGS "-fstrict-aliasing" 2639 fi 2640 _optimization_level=-Os 2641 2642 add_line_to_config_mk "ANDROID_SDK = $ANDROID_SDK" 2643 _seq_midi=no 2644 ;; 2645 beos*) 2646 append_var DEFINES "-DSYSTEM_NOT_SUPPORTING_D_TYPE" 2647 # Needs -lbind -lsocket for the timidity MIDI driver 2648 LDFLAGS="-L/boot/home/config/lib" 2649 CFLAGS="-I/boot/home/config/include" 2650 append_var CXXFLAGS "-fhuge-objects" 2651 append_var LIBS "-lbind -lsocket" 2652 _seq_midi=no 2653 ;; 2654 cygwin*) 2655 echo ERROR: Cygwin building is not supported by ScummVM anymore. Consider using MinGW. 2656 exit 1 2657 ;; 2658 darwin*) 2659 # Pass -mlongcall to gcc so that it emits long calls 2660 # which will allow for calls larger than 32MB. The linker 2661 # will discard the calls if they are not needed, but we 2662 # need to ensure the compiler emits them in the first place. 2663 case $_host_cpu in 2664 powerpc*) 2665 append_var CFLAGS "-mlongcall" 2666 append_var CXXFLAGS "-mlongcall" 2667 ;; 2668 esac 2669 2670 append_var DEFINES "-DMACOSX" 2671 append_var LIBS "-framework AudioUnit -framework AudioToolbox -framework Carbon -framework CoreMIDI" 2672 # SDL2 doesn't seem to add Cocoa for us. 2673 append_var LIBS "-framework Cocoa" 2674 add_line_to_config_mk 'MACOSX = 1' 2675 2676 # Now we may have MacPorts or Fink installed 2677 # Which put libraries and headers in non-standard places 2678 # Checking them here 2679 2680 # MacPorts 2681 # There is no way to get the prefix, so implementing a hack here 2682 macport_version=`port version 2>/dev/null` 2683 if test "$?" -eq 0; then 2684 macport_version="`echo "${macport_version}" | sed -ne 's/Version: \([0-9]\.[0-9]\.[0-9]\)/\1/gp'`" 2685 echo_n "You seem to be running MacPorts version ${macport_version}..." 2686 2687 macport_prefix=`which port` 2688 # strip off /bin/port from /opt/local/bin/port 2689 macport_prefix=`dirname ${macport_prefix}` 2690 macport_prefix=`dirname ${macport_prefix}` 2691 2692 echo "adding ${macport_prefix} to paths" 2693 2694 LDFLAGS="-L${macport_prefix}/lib $LDFLAGS" 2695 CXXFLAGS="-I${macport_prefix}/include $CXXFLAGS" 2696 2697 if test -z "$_staticlibpath"; then 2698 _staticlibpath=${macport_prefix} 2699 echo "Set staticlib-prefix to ${_staticlibpath}" 2700 fi 2701 fi 2702 2703 # Fink 2704 # There is no way to get the prefix, so implementing a hack here 2705 fink_version=`fink -V 2>/dev/null` 2706 if test "$?" -eq 0; then 2707 fink_version="`echo "${fink_version}" | sed -ne 's/Package manager version: \([0-9.]*\)/\1/gp'`" 2708 echo_n "You seem to be running Fink version ${fink_version}..." 2709 2710 fink_prefix=`which fink` 2711 # strip off /bin/fink from /sw/bin/port 2712 fink_prefix=`dirname ${fink_prefix}` 2713 fink_prefix=`dirname ${fink_prefix}` 2714 2715 echo "adding ${fink_prefix} to paths" 2716 2717 LDFLAGS="-L${fink_prefix}/lib $LDFLAGS" 2718 CXXFLAGS="-I${fink_prefix}/include $CXXFLAGS" 2719 2720 if test -z "$_staticlibpath"; then 2721 _staticlibpath=${fink_prefix} 2722 echo "Set staticlib-prefix to ${_staticlibpath}" 2723 fi 2724 fi 2725 2726 # Homebrew 2727 brew_version=`brew -v 2>/dev/null` 2728 if test "$?" -eq 0; then 2729 brew_version="`echo "${brew_version}" | sed -ne 's/Homebrew \([0-9.]*\)/\1/gp'`" 2730 echo_n "You seem to be running Homebrew version ${brew_version}..." 2731 2732 brew_prefix=`brew --prefix` 2733 2734 echo "adding ${brew_prefix} to paths" 2735 2736 LDFLAGS="-L${brew_prefix}/lib $LDFLAGS" 2737 CXXFLAGS="-I${brew_prefix}/include $CXXFLAGS" 2738 2739 if test -z "$_staticlibpath"; then 2740 _staticlibpath=${brew_prefix} 2741 echo "Set staticlib-prefix to ${_staticlibpath}" 2742 fi 2743 fi 2744 2745 # If _staticlibpath is not set yet try first /sw (fink) then /usr/local 2746 # (the macports case is handled above). 2747 if test -z "$_staticlibpath"; then 2748 if test -d "/sw"; then 2749 _staticlibpath=/sw 2750 echo "Set staticlib-prefix to ${_staticlibpath}" 2751 elif test -d "/usr/local"; then 2752 _staticlibpath=/usr/local 2753 echo "Set staticlib-prefix to ${_staticlibpath}" 2754 else 2755 echo "Could not determine prefix for static libraries" 2756 fi 2757 fi 2758 2759 # If _xcodetoolspath is not set yet use xcode-select to get the path 2760 if test -z "$_xcodetoolspath"; then 2761 _xcodetoolspath=`xcode-select -print-path`/Tools 2762 if test -d "$_xcodetoolspath"; then 2763 echo "Set xcodetools-path to ${_xcodetoolspath}" 2764 else 2765 _xcodetoolspath= 2766 echo "Could not determine path for Xcode Tools" 2767 fi 2768 fi 2769 2770 # Use pandoc to generate README and NEWS file for the bundle 2771 # Also default to HTML rather than plain text as it gives a nicer 2772 # formating, especially for the README. We could consider using RTF 2773 # as well, but TextEdit does not support links within the document, 2774 # and having a TOC with links, which we do with html, is quite convenient. 2775 _pandoc=yes 2776 if test "$_pandocformat" = "default"; then 2777 _pandocformat="html" 2778 fi 2779 ;; 2780 dreamcast) 2781 append_var DEFINES "-D__DC__" 2782 append_var DEFINES "-DNONSTANDARD_PORT" 2783 ;; 2784 ds) 2785 append_var DEFINES "-D__DS__" 2786 append_var DEFINES "-DNDS" 2787 append_var DEFINES "-DARM9" 2788 append_var DEFINES "-DARM" 2789 append_var DEFINES "-DNONSTANDARD_PORT" 2790 append_var CXXFLAGS "-isystem $DEVKITPRO/libnds/include" 2791 append_var CXXFLAGS "-isystem $DEVKITPRO/portlibs/nds/include" 2792 append_var CXXFLAGS "-isystem $DEVKITPRO/portlibs/armv5te/include" 2793 append_var CXXFLAGS "-mcpu=arm9tdmi" 2794 append_var CXXFLAGS "-mtune=arm9tdmi" 2795 append_var CXXFLAGS "-fomit-frame-pointer" 2796 append_var CXXFLAGS "-mthumb-interwork" 2797 append_var CXXFLAGS "-ffunction-sections" 2798 append_var CXXFLAGS "-fdata-sections" 2799 append_var CXXFLAGS "-fno-strict-aliasing" 2800 append_var CXXFLAGS "-fuse-cxa-atexit" 2801 append_var LDFLAGS "-mthumb-interwork" 2802 append_var LDFLAGS "-mfloat-abi=soft" 2803 append_var LDFLAGS "-Wl,-Map,map.txt" 2804 if test "$_dynamic_modules" = no ; then 2805 append_var LDFLAGS "-Wl,--gc-sections" 2806 else 2807 append_var LDFLAGS "-Wl,--no-gc-sections" 2808 # TODO automate this required 2 step linking phase 2809 # append_var LDFLAGS "-Wl,--retain-symbols-file,ds.syms" 2810 fi 2811 append_var LDFLAGS "-L$DEVKITPRO/libnds/lib" 2812 append_var LDFLAGS "-L$DEVKITPRO/portlibs/nds/lib" 2813 append_var LDFLAGS "-L$DEVKITPRO/portlibs/armv5te/lib" 2814 append_var LIBS "-specs=ds_arm9.specs" 2815 append_var LIBS "-lnds9" 2816 ;; 2817 freebsd*) 2818 append_var LDFLAGS "-L/usr/local/lib" 2819 append_var CXXFLAGS "-I/usr/local/include" 2820 ;; 2821 gamecube) 2822 _optimization_level=-Os 2823 append_var CXXFLAGS "-mogc" 2824 append_var CXXFLAGS "-mcpu=750" 2825 append_var CXXFLAGS "-meabi" 2826 append_var CXXFLAGS "-mhard-float" 2827 append_var CXXFLAGS "-ffunction-sections" 2828 append_var CXXFLAGS "-fdata-sections" 2829 append_var CXXFLAGS "-fmodulo-sched" 2830 append_var CXXFLAGS "-fuse-cxa-atexit" 2831 append_var CXXFLAGS "-I$DEVKITPRO/libogc/include" 2832 # libogc is required to link the cc tests (includes _start()) 2833 append_var LDFLAGS "-mogc" 2834 append_var LDFLAGS "-mcpu=750" 2835 append_var LDFLAGS "-L$DEVKITPRO/libogc/lib/cube" 2836 append_var LDFLAGS "-logc" 2837 if test "$_dynamic_modules" = "yes" ; then 2838 # retarded toolchain patch forces --gc-sections, overwrite it 2839 append_var LDFLAGS "-Wl,--no-gc-sections" 2840 fi 2841 ;; 2842 haiku*) 2843 append_var DEFINES "-DSYSTEM_NOT_SUPPORTING_D_TYPE" 2844 # Needs -lnetwork for the timidity MIDI driver 2845 append_var LIBS "-lnetwork" 2846 _seq_midi=no 2847 ;; 2848 irix*) 2849 append_var DEFINES "-DIRIX" 2850 append_var DEFINES "-DSYSTEM_NOT_SUPPORTING_D_TYPE" 2851 append_var LIBS "-lmd -lfastm -lm" 2852 _ranlib=: 2853 ;; 2854 linux* | uclinux*) 2855 # When not cross-compiling, enable large file support, but don't 2856 # care if getconf doesn't exist or doesn't recognize LFS_CFLAGS. 2857 if test -z "$_host"; then 2858 append_var CXXFLAGS "`getconf LFS_CFLAGS 2>/dev/null`" 2859 fi 2860 ;; 2861 maemo) 2862 append_var DEFINES "-DMAEMO" 2863 ;; 2864 mingw*) 2865 append_var DEFINES "-DWIN32" 2866 # append_var DEFINES "-D__USE_MINGW_ANSI_STDIO=0" # Modern MinGW does not need it 2867 append_var LDFLAGS "-static-libgcc -static-libstdc++" 2868 append_var LIBS "-lmingw32 -lwinmm -lgdi32" 2869 append_var OBJS "dists/scummvm.o" 2870 add_line_to_config_mk 'WIN32 = 1' 2871 _port_mk="backends/platform/sdl/win32/win32.mk" 2872 ;; 2873 mint*) 2874 append_var DEFINES "-DSYSTEM_NOT_SUPPORTING_D_TYPE" 2875 append_var DEFINES "-D_GNU_SOURCE" 2876 append_var DEFINES "-D_ISOC11_SOURCE" 2877 ;; 2878 msys) 2879 echo ERROR: Using the MSYS shell in msys mode is not supported. Please use the MSYS shell in mingw mode instead. 2880 exit 1 2881 ;; 2882 n64) 2883 append_var DEFINES "-D__N64__" 2884 append_var DEFINES "-DLIMIT_FPS" 2885 append_var DEFINES "-DNONSTANDARD_PORT" 2886 append_var DEFINES "-DDISABLE_COMMAND_LINE" 2887 append_var DEFINES "-DDISABLE_DEFAULT_SAVEFILEMANAGER" 2888 append_var DEFINES "-DDISABLE_DOSBOX_OPL" 2889 append_var DEFINES "-DDISABLE_FANCY_THEMES" 2890 append_var DEFINES "-DDISABLE_NES_APU" 2891 append_var DEFINES "-DDISABLE_SID" 2892 append_var DEFINES "-DREDUCE_MEMORY_USAGE" 2893 add_line_to_config_mk 'N64 = 1' 2894 _nuked_opl=no 2895 ;; 2896 ps2) 2897 append_var CXXFLAGS "-G2" 2898 append_var DEFINES "-D_EE" 2899 append_var DEFINES "-D__PLAYSTATION2__" 2900 if test -z "$PS2SDK_OLD"; then 2901 append_var DEFINES "-D__NEW_PS2SDK__" 2902 fi 2903 ;; 2904 ps3) 2905 # Force use of SDL and freetype from the ps3 toolchain 2906 _sdlpath="$PS3DEV/portlibs/ppu:$PS3DEV/portlibs/ppu/bin" 2907 _freetypepath="$PS3DEV/portlibs/ppu:$PS3DEV/portlibs/ppu/bin" 2908 _libcurlpath="$PS3DEV/portlibs/ppu:$PS3DEV/portlibs/ppu/bin" 2909 2910 append_var DEFINES "-DPLAYSTATION3" 2911 append_var CXXFLAGS "-mcpu=cell -mno-fp-in-toc -I$PSL1GHT/ppu/include -I$PS3DEV/portlibs/ppu/include" 2912 append_var LDFLAGS "-L$PSL1GHT/ppu/lib -L$PS3DEV/portlibs/ppu/lib" 2913 # The network libraries are statically linked and need to be specified in the following order 2914 append_var SDL_NET_LIBS "-lSDL_net -lnet -lsysmodule" 2915 add_line_to_config_mk 'PLAYSTATION3 = 1' 2916 add_line_to_config_h "#define PREFIX \"${prefix}\"" 2917 ;; 2918 psp2) 2919 _freetypepath="$VITASDK/arm-vita-eabi/bin" 2920 _freetype2=yes 2921 _libcurlpath="$VITASDK/arm-vita-eabi/bin" 2922 append_var CXXFLAGS "--sysroot=$VITASDK/arm-vita-eabi" 2923 append_var LDFLAGS "--sysroot=$VITASDK/arm-vita-eabi" 2924 append_var DEFINES "-DPSP2 -DSYSTEM_NOT_SUPPORTING_D_TYPE" 2925 append_var CXXFLAGS "-Wl,-q -I$VITASDK/arm-vita-eabi/include" 2926 append_var CXXFLAGS "-march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard" 2927 append_var LDFLAGS "-Wl,-q -L$VITASDK/arm-vita-eabi/lib" 2928 #the next line fixes a crash when starting scumm-7-8 games (The Dig etc.) 2929 #when either -O2, -O3 or -Os optimizations are enabled 2930 append_var CXXFLAGS "-fno-optimize-sibling-calls" 2931 #the next line fixes "branch out of range" error in gob engine when -Os is used 2932 append_var CXXFLAGS "-mlong-calls" 2933 if test "$_debug_build" = no; then 2934 #optimize for smallest file size. This is necessary to prevent a crash on startup 2935 #due to the large executable file size when many engines are enabled 2936 #for example when --enable-all-engines is used to enable all the unstable engines 2937 _optimization_level=-Os 2938 fi 2939 if test "$_debug_build" = yes; then 2940 _optimization_level=-O0 2941 append_var DEFINES "-D__PSP2_DEBUG__" 2942 append_var LIBS "-lpsp2shell" 2943 fi 2944 add_line_to_config_mk 'PSP2 = 1' 2945 add_line_to_config_h "#define PREFIX \"${prefix}\"" 2946 ;; 2947 psp) 2948 _optimization_level=-O2 2949 append_var CXXFLAGS "-I$PSPSDK/include" 2950 # FIXME: Why is the following in CXXFLAGS and not in DEFINES? Change or document this. 2951 append_var CXXFLAGS "-D_PSP_FW_VERSION=150" 2952 add_line_to_config_mk 'PSP = 1' 2953 ;; 2954 riscos) 2955 define_in_config_if_yes yes 'RISCOS' 2956 append_var LDFLAGS "-L$GCCSDK_INSTALL_ENV/lib" 2957 append_var CXXFLAGS "-isystem $GCCSDK_INSTALL_ENV/include" 2958 _pkgconfig=$GCCSDK_INSTALL_ENV/ro-pkg-config 2959 _sdlpath=$GCCSDK_INSTALL_ENV/bin 2960 _freetypepath=$GCCSDK_INSTALL_ENV/bin 2961 _libcurlpath=$GCCSDK_INSTALL_ENV/bin 2962 append_var CXXFLAGS "-march=armv3m" 2963 append_var CXXFLAGS "-mtune=xscale" 2964 append_var LDFLAGS "-static" 2965 _optimization_level=-O2 2966 append_var CXXFLAGS "-ffunction-sections" 2967 append_var CXXFLAGS "-fdata-sections" 2968 append_var LDFLAGS "-Wl,--gc-sections" 2969 _port_mk="backends/platform/sdl/riscos/riscos.mk" 2970 _pandoc=yes 2971 ;; 2972 solaris*) 2973 append_var DEFINES "-DSOLARIS" 2974 append_var DEFINES "-DSYSTEM_NOT_SUPPORTING_D_TYPE" 2975 # Needs -lbind -lsocket for the timidity MIDI driver 2976 append_var LIBS "-lnsl -lsocket" 2977 ;; 2978 switch) 2979 _pkgconfig="$DEVKITPRO/portlibs/switch/bin/aarch64-none-elf-pkg-config" 2980 _libcurlpath="$DEVKITPRO/portlibs/switch/bin" 2981 _sdlpath="$DEVKITPRO/portlibs/switch/bin" 2982 append_var DEFINES "-DSWITCH -D__SWITCH__ -DNINTENDO_SWITCH" 2983 append_var CXXFLAGS "-march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -ftls-model=local-exec" 2984 append_var CXXFLAGS "-ffunction-sections -fdata-sections" 2985 append_var CXXFLAGS "-I$DEVKITPRO/libnx/include -I$DEVKITPRO/portlibs/switch/include" 2986 append_var LDFLAGS "-L$DEVKITPRO/libnx/lib -L$DEVKITPRO/portlibs/switch/lib" 2987 append_var LIBS "-specs=$DEVKITPRO/libnx/switch.specs" 2988 add_line_to_config_mk 'SWITCH = 1' 2989 if test "$_debug_build" = yes; then 2990 append_var DEFINES "-D__SWITCH_DEBUG__" 2991 else 2992 _optimization_level=-O3 2993 fi 2994 ;; 2995 tizen) 2996 add_line_to_config_mk "TIZEN_ROOTSTRAP = $TIZEN_ROOTSTRAP" 2997 append_var LDFLAGS "--sysroot=${TIZEN_ROOTSTRAP}" 2998 append_var LDFLAGS "-L${TIZEN_LIBS}/lib" 2999 append_var CXXFLAGS "-I${TIZEN_LIBS}/include" 3000 ;; 3001 webos) 3002 append_var CXXFLAGS "--sysroot=$WEBOS_PDK/arm-gcc/sysroot" 3003 append_var CXXFLAGS "-I$WEBOS_PDK/include" 3004 append_var CXXFLAGS "-I$WEBOS_PDK/include/SDL" 3005 append_var CXXFLAGS "-I$WEBOS_PDK/device/usr/include" 3006 # These compiler options are needed to support the Palm Pixi 3007 append_var CXXFLAGS "-mcpu=arm1136jf-s" 3008 append_var CXXFLAGS "-mfpu=vfp " 3009 append_var CXXFLAGS "-mfloat-abi=softfp" 3010 append_var LDFLAGS "-L$WEBOS_PDK/device/lib" 3011 append_var LDFLAGS "-L$WEBOS_PDK/device/usr/lib" 3012 append_var LDFLAGS "-Wl,--allow-shlib-undefined" 3013 append_var LDFLAGS "--sysroot=$WEBOS_PDK/arm-gcc/sysroot" 3014 add_line_to_config_mk "WEBOS_SDK = $WEBOS_SDK" 3015 _seq_midi=no 3016 ;; 3017 wii) 3018 _optimization_level=-Os 3019 append_var CXXFLAGS "-mrvl" 3020 append_var CXXFLAGS "-mcpu=750" 3021 append_var CXXFLAGS "-meabi" 3022 append_var CXXFLAGS "-mhard-float" 3023 append_var CXXFLAGS "-ffunction-sections" 3024 append_var CXXFLAGS "-fdata-sections" 3025 append_var CXXFLAGS "-fmodulo-sched" 3026 append_var CXXFLAGS "-fuse-cxa-atexit" 3027 append_var CXXFLAGS "-I$DEVKITPRO/libogc/include" 3028 # libogc is required to link the cc tests (includes _start()) 3029 append_var LDFLAGS "-mrvl" 3030 append_var LDFLAGS "-mcpu=750" 3031 append_var LDFLAGS "-L$DEVKITPRO/libogc/lib/wii" 3032 append_var LDFLAGS "-logc" 3033 if test "$_dynamic_modules" = "yes" ; then 3034 # retarded toolchain patch forces --gc-sections, overwrite it 3035 append_var LDFLAGS "-Wl,--no-gc-sections" 3036 fi 3037 ;; 3038 wince) 3039 _optimization_level=-O3 3040 append_var CXXFLAGS "-fno-inline-functions" 3041 append_var CXXFLAGS "-march=armv4" 3042 append_var CXXFLAGS "-mtune=xscale" 3043 append_var DEFINES "-D_WIN32_WCE=300" 3044 append_var DEFINES "-D__ARM__" 3045 append_var DEFINES "-D_ARM_" 3046 append_var DEFINES "-DUNICODE" 3047 append_var DEFINES "-DFPM_DEFAULT" 3048 append_var DEFINES "-DNONSTANDARD_PORT" 3049 append_var DEFINES "-DWRAP_MALLOC" 3050 append_var DEFINES "-DWIN32" 3051 append_var DEFINES "-Dcdecl=" 3052 append_var DEFINES "-D__cdecl__=" 3053 add_line_to_config_mk "WRAP_MALLOC = 1" 3054 ;; 3055esac 3056 3057if test -n "$_host"; then 3058 # Cross-compiling mode - add your target here if needed 3059 echo "Cross-compiling to $_host" 3060 case "$_host" in 3061 3ds) 3062 append_var DEFINES "-DDISABLE_FANCY_THEMES" 3063 append_var DEFINES "-DDISABLE_SID" 3064 append_var DEFINES "-DDISABLE_NES_APU" 3065 _backend="3ds" 3066 _build_scalers=no 3067 _vkeybd=yes 3068 _mt32emu=no 3069 # Should use Tremor instead of Vorbis 3070 _vorbis=no 3071 _port_mk="backends/platform/3ds/3ds.mk" 3072 ;; 3073 android | android-arm | android-v7a | android-arm-v7a | android-arm64-v8a | android-mips | android-mips64 | android-x86 | android-x86_64 | ouya) 3074 # also __ANDROID__ is defined by Clang in the NDK 3075 DEFINES="$DEFINES -D__ANDROID_PLAIN_PORT__ -DANDROID_PLAIN_PORT" 3076 # we link a .so as default 3077 append_var LDFLAGS "-shared" 3078 append_var LDFLAGS "-Wl,-Bsymbolic,--no-undefined" 3079 HOSTEXEPRE=lib 3080 HOSTEXEEXT=.so 3081 _backend="android" 3082 _port_mk="backends/platform/android/android.mk" 3083 _build_scalers=no 3084 _seq_midi=no 3085 _timidity=no 3086 ;; 3087 androidsdl | androidsdl-armeabi | androidsdl-armeabi-v7a | androidsdl-mips | androidsdl-x86 | androidsdl-arm64-v8a | androidsdl-x86_64) 3088 DEFINES="$DEFINES -DANDROIDSDL" 3089 _unix=yes 3090 _seq_midi=no 3091 _timidity=no 3092 _backend="androidsdl" 3093 _port_mk="backends/platform/androidsdl/androidsdl.mk" 3094 ;; 3095 arm-linux|arm*-linux-gnueabi|arm-*-linux) 3096 ;; 3097 arm-*riscos) 3098 _opengl_mode=none 3099 _vorbis=no 3100 ;; 3101 bfin*) 3102 ;; 3103 caanoo) 3104 append_var DEFINES "-DCAANOO" 3105 if test "$_debug_build" = no; then 3106 # Use -O3 on the Caanoo for non-debug builds. 3107 _optimization_level=-O3 3108 fi 3109 append_var CXXFLAGS "-mcpu=arm926ej-s" 3110 append_var CXXFLAGS "-mtune=arm926ej-s" 3111 _backend="gph" 3112 _build_hq_scalers=no 3113 _savegame_timestamp=no 3114 _vkeybd=yes 3115 _seq_midi=no 3116 _mt32emu=no 3117 _timidity=no 3118 _port_mk="backends/platform/gph/caanoo-bundle.mk" 3119 ;; 3120 *darwin*) 3121 _ranlib=$_host-ranlib 3122 _strip=$_host-strip 3123 ;; 3124 dingux) 3125 append_var DEFINES "-DDINGUX" 3126 append_var DEFINES "-DDISABLE_DOSBOX_OPL" 3127 append_var DEFINES "-DREDUCE_MEMORY_USAGE" 3128 append_var CXXFLAGS "-msoft-float" 3129 append_var CXXFLAGS "-mips32" 3130 _backend="dingux" 3131 _mt32emu=no 3132 _nuked_opl=no 3133 _optimization_level=-O3 3134 # Disable alsa midi to get the port build on OpenDingux toolchain 3135 _alsa=no 3136 # Disable cloud and SDL_Net due to outdated toolchain 3137 _cloud=no 3138 _sdlnet=no 3139 _libcurl=no 3140 _vkeybd=yes 3141 _build_hq_scalers=no 3142 _keymapper=no 3143 # Force disable vorbis on dingux, it has terrible performance compared to tremor 3144 _vorbis=no 3145 # Force disable seq on dingux, no way to use it and it would get enabled by default with configure 3146 _seq_midi=no 3147 _port_mk="backends/platform/dingux/dingux.mk" 3148 ;; 3149 raspberrypi) 3150 # This is needed because the official cross compiler doesn't have multiarch enabled 3151 # but Raspbian does. 3152 # Be careful as it's the linker (LDFLAGS) which must know about sysroot. 3153 # These are needed to build against Raspbian's libSDL. 3154 append_var LDFLAGS "--sysroot=$RPI_ROOT" 3155 append_var LDFLAGS "-B$RPI_ROOT/usr/lib/arm-linux-gnueabihf" 3156 append_var LDFLAGS "-Xlinker --rpath-link=$RPI_ROOT/usr/lib/arm-linux-gnueabihf" 3157 append_var LDFLAGS "-Xlinker --rpath-link=$RPI_ROOT/lib/arm-linux-gnueabihf" 3158 append_var LDFLAGS "-Xlinker --rpath-link=$RPI_ROOT/opt/vc/lib" 3159 append_var LDFLAGS "-L$RPI_ROOT/opt/vc/lib" 3160 # This is so optional OpenGL ES includes are found. 3161 append_var CXXFLAGS "-I$RPI_ROOT/opt/vc/include" 3162 _savegame_timestamp=no 3163 _eventrec=no 3164 _build_scalers=no 3165 _build_hq_scalers=no 3166 # We prefer SDL2 on the Raspberry Pi: acceleration now depends on it 3167 # since SDL2 manages dispmanx/GLES2 very well internally. 3168 # SDL1 is bit-rotten on this platform. 3169 _sdlconfig=sdl2-config 3170 # OpenGL ES support is mature enough as to be the best option on 3171 # the Raspberry Pi, so it's enabled by default. 3172 # The Raspberry Pi always supports OpenGL ES 2.0 contexts, thus we 3173 # take advantage of those. 3174 _opengl_mode=gles2 3175 ;; 3176 dreamcast) 3177 append_var DEFINES "-DDISABLE_DEFAULT_SAVEFILEMANAGER" 3178 append_var DEFINES "-DDISABLE_TEXT_CONSOLE" 3179 append_var DEFINES "-DDISABLE_COMMAND_LINE" 3180 # Enable serial debugging output only when --enable-debug is passed 3181 if test "$_release_build" = yes -o "$_debug_build" != yes; then 3182 append_var DEFINES "-DNOSERIAL" 3183 fi 3184 _optimization_level=-O3 3185 append_var CXXFLAGS "-funroll-loops" 3186 append_var CXXFLAGS "-fschedule-insns2" 3187 append_var CXXFLAGS "-fomit-frame-pointer" 3188 append_var CXXFLAGS "-fdelete-null-pointer-checks" 3189 _backend="dc" 3190 _build_scalers=no 3191 # These two are needed due to shortcomings of the 3192 # detection systems. Do not remove until auto- 3193 # detection works correctly. 3194 _mad=yes 3195 _zlib=yes 3196 _port_mk="backends/platform/dc/dreamcast.mk" 3197 ;; 3198 ds) 3199 append_var DEFINES "-DDISABLE_COMMAND_LINE" 3200 append_var DEFINES "-DDISABLE_DEFAULT_SAVEFILEMANAGER" 3201 append_var DEFINES "-DDISABLE_DOSBOX_OPL" 3202 append_var DEFINES "-DDISABLE_FANCY_THEMES" 3203 append_var DEFINES "-DDISABLE_SID" 3204 append_var DEFINES "-DDISABLE_NES_APU" 3205 append_var DEFINES "-DDISABLE_TEXT_CONSOLE" 3206 append_var DEFINES "-DREDUCE_MEMORY_USAGE" 3207 append_var DEFINES "-DSTREAM_AUDIO_FROM_DISK" 3208 append_var DEFINES "-DVECTOR_RENDERER_FORMAT=1555" 3209 _backend="ds" 3210 _build_scalers=no 3211 _mt32emu=no 3212 _nuked_opl=no 3213 _bink=no 3214 _lua=no 3215 _port_mk="backends/platform/ds/ds.mk" 3216 ;; 3217 gamecube) 3218 _backend="wii" 3219 _build_scalers=no 3220 _vkeybd=yes 3221 _mt32emu=no 3222 _port_mk="backends/platform/wii/wii.mk" 3223 add_line_to_config_mk 'GAMECUBE = 1' 3224 add_line_to_config_h '#define AUDIO_REVERSE_STEREO' 3225 add_line_to_config_h '#define GAMECUBE' 3226 add_line_to_config_h "/* #define DEBUG_WII_USBGECKO */" 3227 add_line_to_config_h "/* #define DEBUG_WII_MEMSTATS */" 3228 add_line_to_config_h "/* #define DEBUG_WII_GDB */" 3229 add_line_to_config_h "#define USE_WII_DI" 3230 ;; 3231 gcw0) 3232 _sysroot=`$CXX --print-sysroot` 3233 _sdlpath=$_sysroot/usr/bin 3234 append_var DEFINES "-DDINGUX -DGCW0" 3235 append_var DEFINES "-DREDUCE_MEMORY_USAGE" 3236 append_var CXXFLAGS "-mips32" 3237 _backend="dingux" 3238 _alsa=no 3239 _mt32emu=no 3240 _seq_midi=no 3241 _timidity=no 3242 _build_scalers=yes 3243 _optimization_level=-O3 3244 _vkeybd=yes 3245 _keymapper=yes 3246 _vorbis=no 3247 _sdlconfig=sdl-config 3248 _port_mk="backends/platform/dingux/dingux.mk" 3249 ;; 3250 gp2x) 3251 append_var DEFINES "-DGP2X" 3252 append_var CXXFLAGS "-march=armv4t" 3253 append_var ASFLAGS "-mfloat-abi=soft" 3254 append_var LDFLAGS "-static" 3255 _backend="gph" 3256 _build_hq_scalers=no 3257 _savegame_timestamp=no 3258 _vkeybd=yes 3259 _seq_midi=no 3260 _mt32emu=no 3261 _timidity=no 3262 _port_mk="backends/platform/gph/gp2x-bundle.mk" 3263 ;; 3264 gp2xwiz) 3265 append_var DEFINES "-DGP2XWIZ" 3266 append_var CXXFLAGS "-mcpu=arm926ej-s" 3267 append_var CXXFLAGS "-mtune=arm926ej-s" 3268 append_var ASFLAGS "-mfloat-abi=soft" 3269 _backend="gph" 3270 _build_hq_scalers=no 3271 _savegame_timestamp=no 3272 _vkeybd=yes 3273 _seq_midi=no 3274 _mt32emu=no 3275 _timidity=no 3276 _port_mk="backends/platform/gph/gp2xwiz-bundle.mk" 3277 ;; 3278 iphone) 3279 append_var DEFINES "-DIPHONE" 3280 append_var ASFLAGS "-arch armv6" 3281 _backend="iphone" 3282 _build_scalers=no 3283 _mt32emu=no 3284 _seq_midi=no 3285 _timidity=no 3286 ;; 3287 ios7) 3288 append_var DEFINES "-DIPHONE" 3289 _backend="ios7" 3290 _seq_midi=no 3291 _timidity=no 3292 ;; 3293 m68k-atari-mint) 3294 _seq_midi=no 3295 _timidity=no 3296 ;; 3297 maemo) 3298 _optimization_level=-Os 3299 append_var CXXFLAGS "-mcpu=arm926ej-s" 3300 append_var CXXFLAGS "-fomit-frame-pointer" 3301 append_var INCLUDES "-I/usr/X11R6/include" 3302 append_var LIBS "-lX11" 3303 append_var LIBS "-L/usr/lib" 3304 3305 _backend="maemo" 3306 _vkeybd=yes 3307 _keymapper=yes 3308 _build_hq_scalers=no 3309 _mt32emu=no 3310 _alsa=no 3311 _mad=yes 3312 _tremor=yes 3313 _zlib=yes 3314 ;; 3315 *mingw32*) 3316 _sdlconfig=$_host-sdl-config 3317 _windres=$_host-windres 3318 _ar="$_host-ar cr" 3319 _ranlib=$_host-ranlib 3320 ;; 3321 mips-sgi*) 3322 append_var LDFLAGS "-static-libgcc" 3323 append_var LIBS "-laudio" 3324 ;; 3325 motoezx) 3326 append_var DEFINES "-DMOTOEZX" 3327 append_var ASFLAGS "-mfpu=vfp" 3328 _backend="linuxmoto" 3329 _build_hq_scalers=no 3330 _mt32emu=no 3331 _vkeybd=yes 3332 _seq_midi=no 3333 _port_mk="backends/platform/linuxmoto/linuxmoto.mk" 3334 ;; 3335 motomagx) 3336 append_var DEFINES "-DMOTOMAGX" 3337 append_var ASFLAGS "-mfpu=vfp" 3338 _backend="linuxmoto" 3339 _build_hq_scalers=no 3340 _mt32emu=no 3341 _vkeybd=yes 3342 _seq_midi=no 3343 _port_mk="backends/platform/linuxmoto/linuxmoto.mk" 3344 ;; 3345 n64) 3346 append_var CXXFLAGS "-mno-extern-sdata" 3347 append_var CXXFLAGS "--param max-inline-insns-auto=20" 3348 append_var CXXFLAGS "-fomit-frame-pointer" 3349 append_var CXXFLAGS "-march=vr4300" 3350 append_var CXXFLAGS "-mtune=vr4300" 3351 append_var CXXFLAGS "-mhard-float" 3352 append_var LDFLAGS "-march=vr4300" 3353 append_var LDFLAGS "-mtune=vr4300" 3354 append_var LDFLAGS "-nodefaultlibs" 3355 append_var LDFLAGS "-nostartfiles" 3356 append_var LDFLAGS "-mno-crt0" 3357 append_var LDFLAGS "-L$N64SDK/hkz-libn64" 3358 append_var LDFLAGS "-L$N64SDK/lib" 3359 append_var LDFLAGS "-T n64ld_cpp.x -Xlinker -Map -Xlinker scummvm.map" 3360 _backend="n64" 3361 _mt32emu=no 3362 _build_scalers=no 3363 _savegame_timestamp=no 3364 _translation=no 3365 _keymapper=no 3366 _text_console=no 3367 _vkeybd=yes 3368 _dynamic_modules=no 3369 _plugins_default=static 3370 # Force use of libmad, libtremor and zlib 3371 _mad=no 3372 _tremor=yes 3373 _zlib=yes 3374 _port_mk="backends/platform/n64/n64.mk" 3375 ;; 3376 neuros) 3377 append_var DEFINES "-DNEUROS" 3378 _backend='null' 3379 _build_hq_scalers=no 3380 _mt32emu=no 3381 ;; 3382 openpandora) 3383 append_var DEFINES "-DOPENPANDORA" 3384 append_var DEFINES "-DREDUCE_MEMORY_USAGE" 3385 if test "$_release_build" = no; then 3386 append_var DEFINES "-DOP_DEBUG" 3387 fi 3388 3389 # Use -O3 on the OpenPandora for optimized builds. 3390 if test "$_optimizations" = yes; then 3391 _optimization_level=-O3 3392 fi 3393 3394 append_var CXXFLAGS "-march=armv7-a" 3395 append_var CXXFLAGS "-mtune=cortex-a8" 3396 append_var CXXFLAGS "-mfloat-abi=softfp" 3397 append_var CXXFLAGS "-mfpu=neon" 3398 append_var CXXFLAGS "-fsingle-precision-constant" 3399 append_var ASFLAGS "-mfloat-abi=softfp" 3400 _backend="openpandora" 3401 _build_hq_scalers=yes 3402 _vkeybd=no 3403 _mt32emu=no 3404 _seq_midi=no 3405 _port_mk="backends/platform/openpandora/op-bundle.mk" 3406 ;; 3407 ppc-amigaos) 3408 # PPC Linker requires this to fix relocation errors 3409 append_var CXXFLAGS "-mlongcall" 3410 3411 # Only static builds link successfully on buildbot 3412 LDFLAGS=`echo $LDFLAGS | sed 's/-use-dynld//'` 3413 append_var LDFLAGS "-static" 3414 3415 _port_mk="backends/platform/sdl/amigaos/amigaos.mk" 3416 ;; 3417 ps2) 3418 append_var DEFINES "-DDISABLE_TEXT_CONSOLE" 3419 append_var DEFINES "-DDISABLE_COMMAND_LINE" 3420 append_var DEFINES "-DDISABLE_DOSBOX_OPL" 3421 append_var DEFINES "-DDISABLE_SID" 3422 append_var DEFINES "-DDISABLE_NES_APU" 3423 append_var CXXFLAGS "-fno-exceptions" 3424 append_var CXXFLAGS "-fno-rtti" 3425 _backend="ps2" 3426 _build_scalers=no 3427 _mt32emu=no 3428 _nuked_opl=no 3429 # HACK to enable mad & zlib (they are not properly detected due to linker issues). 3430 # This trick doesn't work for tremor right now, as the PS2 port the resulting library 3431 # libtremor, while our code later on expects it to be called libvorbisidec. 3432 # TODO: Enable tremor, e.g. by adding -ltremor or by renaming the lib. 3433 # Disable this for older SDK as this breaks the build otherwise... 3434 if test -z "$PS2SDK_OLD" && test "$_tremor" = auto; then 3435 _tremor=yes 3436 fi 3437 _mad=yes 3438 _zlib=yes 3439 # HACK to fix compilation of C source files for now. 3440 add_line_to_config_mk 'CC := ee-gcc' 3441 add_line_to_config_mk 'CFLAGS := -std=c99 -W -Wno-unused-parameter -Wconversion -pedantic -G2 -s -O2 -Wuninitialized' 3442 # HACK to fix linking for now. It seems ee-g++ does not handle linking correctly. 3443 LD=ee-gcc 3444 3445 if test "$_debug_build" = yes; then 3446 # TODO: Setup debug build properly 3447 append_var DEFINES "-D__PS2_DEBUG__" 3448 #append_var INCLUDES "-I$(PS2GDB)/ee" 3449 #append_var LDFLAGS "-L$(PS2GDB)/lib" 3450 append_var LDFLAGS "-lps2gdbStub" 3451 append_var LDFLAGS "-lps2ip" 3452 append_var LDFLAGS "-ldebug" 3453 else 3454 # If not building for debug mode, strip binaries. 3455 append_var CXXFLAGS "-s" 3456 fi 3457 ;; 3458 ps3) 3459 _timidity=no 3460 _vkeybd=yes 3461 _eventrec=no 3462 _port_mk="backends/platform/sdl/ps3/ps3.mk" 3463 ;; 3464 psp2) 3465 _backend="psp2" 3466 _vkeybd=yes 3467 _build_scalers=yes 3468 _build_hq_scalers=no 3469 _mt32emu=no 3470 _timidity=no 3471 _eventrec=no 3472 _port_mk="backends/platform/sdl/psp2/psp2.mk" 3473 ;; 3474 psp) 3475 _backend="psp" 3476 _build_scalers=no 3477 _mt32emu=no 3478 _port_mk="backends/platform/psp/psp.mk" 3479 ;; 3480 samsungtv) 3481 append_var DEFINES "-DSAMSUNGTV" 3482 append_var DEFINES "-DDISABLE_COMMAND_LINE" 3483 append_var ASFLAGS "-mfpu=vfp" 3484 HOSTEXEEXT=".so" 3485 _backend="samsungtv" 3486 _mt32emu=no 3487 _vkeybd=yes 3488 ;; 3489 switch) 3490 _backend="switch" 3491 # Switch port crashes when switching between SDL2 and OpenGL 3492 # graphics. But OpenGL works when it is enabled from the start. 3493 # This might be related to a known crash on OpenGL de-init due 3494 # to the OpenGL implementation on this platform. 3495 _opengl_mode=gles2 3496 _vkeybd=yes 3497 _port_mk="backends/platform/sdl/switch/switch.mk" 3498 ;; 3499 tizen) 3500 _unix=yes 3501 _backend="tizen" 3502 _port_mk="backends/platform/tizen/tizen.mk" 3503 _build_scalers=no 3504 _seq_midi=no 3505 _mt32emu=no 3506 _timidity=no 3507 _vkeybd=yes 3508 # Tizen relies on the OpenGL ES output thus we always enable it. 3509 _opengl_mode=gles 3510 ;; 3511 webos) 3512 _backend="webos" 3513 _port_mk="backends/platform/webos/webos.mk" 3514 _build_scalers=yes 3515 _build_hq_scalers=no 3516 _timidity=no 3517 _mt32emu=no 3518 _seq_midi=no 3519 _vkeybd=no 3520 _keymapper=yes 3521 add_line_to_config_mk "HOST_COMPILER = `uname`" 3522 ;; 3523 wii) 3524 _backend="wii" 3525 _build_scalers=no 3526 _vkeybd=yes 3527 _port_mk="backends/platform/wii/wii.mk" 3528 add_line_to_config_mk 'GAMECUBE = 0' 3529 add_line_to_config_h '#define AUDIO_REVERSE_STEREO' 3530 add_line_to_config_h "#define DEBUG_WII_USBGECKO" 3531 add_line_to_config_h "/* #define DEBUG_WII_MEMSTATS */" 3532 add_line_to_config_h "/* #define DEBUG_WII_GDB */" 3533 add_line_to_config_h "#define USE_WII_DI" 3534 add_line_to_config_h "#define USE_WII_SMB" 3535 add_line_to_config_h "#define USE_WII_KBD" 3536 ;; 3537 wince) 3538 append_var LDFLAGS "-Wl,--stack,65536" 3539 if test "$_tremor" = auto; then 3540 _tremolo=yes 3541 fi 3542 _backend="wince" 3543 _detectlang=yes 3544 _mt32emu=no 3545 _port_mk="backends/platform/wince/wince.mk" 3546 ;; 3547 *) 3548 echo "WARNING: Unknown target, continuing with auto-detected values" 3549 ;; 3550 esac 3551fi 3552 3553# 3554# Backend related stuff 3555# 3556case $_backend in 3557 3ds) 3558 ;; 3559 android) 3560 append_var DEFINES "-DREDUCE_MEMORY_USAGE" 3561 append_var DEFINES "-DNONSTANDARD_PORT" 3562 append_var INCLUDES '-I$(srcdir)/backends/platform/android' 3563 append_var CXXFLAGS "-Wa,--noexecstack" 3564 append_var LDFLAGS "-Wl,-z,noexecstack" 3565 # removed the following directive - was causing compilation issues when not also explicitly using --disable-mt32emu 3566# append_var INCLUDES "-isystem $ANDROID_NDK/sources/cxx-stl/system/include" 3567 _sdl=no 3568 if test "$_host" = ouya; then 3569 _sdlnet=no 3570 fi 3571 ;; 3572 androidsdl) 3573 _sdl=auto 3574 ;; 3575 dc) 3576 append_var INCLUDES '-I$(srcdir)/backends/platform/dc' 3577 append_var INCLUDES "-isystem $RONINDIR/include" 3578 append_var LDFLAGS "-Wl,-Ttext,0x8c010000" 3579 append_var LDFLAGS "-nostartfiles" 3580 append_var LDFLAGS "-L$RONINDIR/lib" 3581 append_var LDFLAGS "$RONINDIR/lib/crt0.o" 3582 # Enable serial debugging output only when --enable-debug is passed 3583 if test "$_release_build" = yes -o "$_debug_build" != yes; then 3584 append_var LIBS "-lronin-noserial -lm" 3585 append_var LDFLAGS "-lronin-noserial -lm" 3586 else 3587 append_var LIBS "-lronin -lm" 3588 append_var LDFLAGS "-lronin -lm" 3589 fi 3590 ;; 3591 dingux) 3592 append_var DEFINES "-DDINGUX" 3593 _sdl=auto 3594 ;; 3595 ds) 3596 append_var INCLUDES '-I$(srcdir)/backends/platform/ds/arm9/source' 3597 append_var INCLUDES '-I$(srcdir)/backends/platform/ds/commoninclude' 3598 append_var INCLUDES '-Ibackends/platform/ds/arm9/data' 3599 ;; 3600 gph) 3601 # On the GPH devices we want fancy themes but do not want the load/save thumbnail grid. 3602 append_var DEFINES "-DDISABLE_SAVELOADCHOOSER_GRID" 3603 append_var DEFINES "-DGPH_DEVICE" 3604 append_var DEFINES "-DREDUCE_MEMORY_USAGE" 3605 if test "$_debug_build" = yes; then 3606 append_var DEFINES "-DGPH_DEBUG" 3607 fi 3608 _sdl=auto 3609 ;; 3610 iphone) 3611 append_var LIBS "-lobjc -framework UIKit -framework CoreGraphics -framework OpenGLES" 3612 append_var LIBS "-framework QuartzCore -framework CoreFoundation -framework Foundation" 3613 append_var LIBS "-framework AudioToolbox -framework CoreAudio" 3614 ;; 3615 ios7) 3616 append_var LIBS "-lobjc -framework UIKit -framework CoreGraphics -framework OpenGLES" 3617 append_var LIBS "-framework QuartzCore -framework CoreFoundation -framework Foundation" 3618 append_var LIBS "-framework AudioToolbox -framework CoreAudio -framework SystemConfiguration " 3619 append_var LDFLAGS "-miphoneos-version-min=7.1 -arch armv7" 3620 append_var CFLAGS "-miphoneos-version-min=7.1 -arch armv7" 3621 append_var CXXFLAGS "-miphoneos-version-min=7.1 -arch armv7" 3622 if test -n "$SDKROOT"; then 3623 append_var LDFLAGS "-mlinker-version=134.9 -B/usr/local/bin/arm-apple-darwin11-" 3624 append_var CFLAGS "-isysroot $SDKROOT -F$SDKROOT/System/Library/Frameworks" 3625 append_var CXXFLAGS "-isysroot $SDKROOT -I$SDKROOT/usr/include/c++/4.2.1 -F$SDKROOT/System/Library/Frameworks" 3626 fi 3627 ;; 3628 linuxmoto) 3629 append_var DEFINES "-DLINUXMOTO" 3630 _sdl=auto 3631 ;; 3632 maemo) 3633 append_var DEFINES "-DMAEMO" 3634 _sdl=auto 3635 ;; 3636 n64) 3637 append_var INCLUDES '-I$(N64SDK)/include' 3638 append_var INCLUDES '-I$(N64SDK)/mips64/include' 3639 append_var INCLUDES '-I$(N64SDK)/hkz-libn64' 3640 append_var INCLUDES '-I$(srcdir)/backends/platform/n64' 3641 append_var LIBS "-lpakfs -lframfs -ln64 -ln64utils -lromfs" 3642 append_var LIBS "-lm -lstdc++ -lz" 3643 ;; 3644 null) 3645 append_var DEFINES "-DUSE_NULL_DRIVER" 3646 ;; 3647 openpandora) 3648 _sdl=auto 3649 ;; 3650 ps2) 3651 append_var DEFINES "-D_EE" 3652 append_var DEFINES "-DFORCE_RTL" 3653 append_var INCLUDES "-I$PS2SDK/ee/include" 3654 append_var INCLUDES "-I$PS2SDK/common/include" 3655 append_var INCLUDES "-I$PS2SDK/ports/include" 3656 if test "$_dynamic_modules" = no ; then 3657 append_var LDFLAGS "-mno-crt0" 3658 append_var LDFLAGS "$PS2SDK/ee/startup/crt0.o" 3659 append_var LDFLAGS "-T $PS2SDK/ee/startup/linkfile" 3660 fi 3661 append_var LDFLAGS "-L$PS2SDK/ee/lib" 3662 append_var LDFLAGS "-L$PS2SDK/ports/lib" 3663 if test -d "$PS2DEV/isjpcm"; then 3664 append_var INCLUDES "-I$PS2DEV/isjpcm/include" 3665 append_var LDFLAGS "-L$PS2DEV/isjpcm/lib" 3666 fi 3667 append_var LIBS "-lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm" 3668 append_var LIBS "-lm -lc -lfileXio -lkernel -lstdc++" 3669 ;; 3670 psp) 3671 append_var DEFINES "-D__PSP__" 3672 append_var DEFINES "-DDISABLE_COMMAND_LINE" 3673 append_var DEFINES "-DDISABLE_DOSBOX_OPL" 3674 append_var LIBS "-lpng" 3675 append_var LIBS "-Wl,-Map,mapfile.txt" 3676 _nuked_opl=no 3677 ;; 3678 psp2) 3679 append_var LIBS "-lvitashaders -lSDL2 -lvita2d_fbo -lSceCommonDialog_stub" 3680 append_var LIBS "-lSceSysmodule_stub -lSceDisplay_stub -lSceGxm_stub" 3681 append_var LIBS "-lSceAudio_stub -lSceCtrl_stub -lScePower_stub" 3682 append_var LIBS "-lSceNet_stub -lSceNetCtl_stub -lSceAppMgr_stub -lScePgf_stub" 3683 append_var LIBS "-lSceTouch_stub -lSceHid_stub" 3684 _sdl=yes 3685 _sdlversion=2.0.0 3686 append_var MODULES "backends/platform/sdl" 3687 append_var INCLUDES "-I$VITASDK/arm-vita-eabi/include/SDL2" 3688 ;; 3689 samsungtv) 3690 append_var DEFINES "-DSAMSUNGTV" 3691 append_var LDFLAGS "-shared" 3692 append_var LDFLAGS "-fpic" 3693 _sdl=auto 3694 ;; 3695 sdl) 3696 _sdl=auto 3697 ;; 3698 switch) 3699 _sdl=auto 3700 append_var MODULES "backends/platform/sdl" 3701 ;; 3702 tizen) 3703 # dirent.h not available. NONSTANDARD_PORT==ensure portdefs.h is included 3704 append_var DEFINES "-DTIZEN -DDISABLE_STDIO_FILESTREAM -DNONSTANDARD_PORT" 3705 append_var DEFINES "-DNO_STDERR_STDOUT" 3706 append_var DEFINES "-DDISABLE_COMMAND_LINE" 3707 append_var INCLUDES '-I$(srcdir)/backends/platform/tizen' 3708 append_var INCLUDES '-I$(TIZEN_ROOTSTRAP)/usr/include' 3709 append_var INCLUDES '-I$(TIZEN_ROOTSTRAP)/usr/include/osp' 3710 if test "$_debug_build" = yes; then 3711 append_var CXXFLAGS "-D_DEBUG -DBUILD_DLL -O0 -g3" 3712 fi 3713 # created a shared library for inclusion via the eclipse build 3714 append_var CXXFLAGS "-Wno-psabi" 3715 append_var CXXFLAGS "--sysroot=${TIZEN_ROOTSTRAP}" 3716 append_var CXXFLAGS "-fmessage-length=0" 3717 append_var CXXFLAGS "-fPIC" 3718 HOSTEXEPRE=lib 3719 HOSTEXEEXT=.a 3720 ;; 3721 webos) 3722 # There is no sdl-config in the WebOS PDK so we don't use find_sdlconfig here. 3723 # The PDL library acts as the WebOS device toolchain, and is required to control the virtual keyboard among other OS-level events. 3724 append_var LIBS "-lSDL -lpdl" 3725 append_var DEFINES "-DWEBOS" 3726 append_var MODULES "backends/platform/sdl" 3727 _sdl=yes 3728 _sdlversion=1.2.0 3729 ;; 3730 wii) 3731 append_var DEFINES "-D__WII__" 3732 append_var DEFINES "-DGEKKO" 3733 case $_host_os in 3734 gamecube) 3735 append_var LIBS "-lgxflux -liso9660 -lfat -logc -ldb" 3736 ;; 3737 *) 3738 append_var LIBS "-lgxflux -ldi -liso9660 -ltinysmb -lfat -lwiiuse -lbte -logc -lwiikeyboard -ldb" 3739 ;; 3740 esac 3741 ;; 3742 wince) 3743 append_var INCLUDES '-I$(srcdir)/backends/platform/wince' 3744 append_var INCLUDES '-I$(srcdir)/backends/platform/wince/CEgui' 3745 append_var INCLUDES '-I$(srcdir)/backends/platform/wince/CEkeys' 3746 append_var INCLUDES '-I$(srcdir)/backends/platform/wince/missing' 3747 append_var LIBS "-static -lSDL" 3748 _sdl=yes 3749 _sdlversion=1.2.0 3750 ;; 3751 *) 3752 echo "support for $_backend backend not implemented in configure script yet" 3753 exit 1 3754 ;; 3755esac 3756append_var MODULES "backends/platform/$_backend" 3757 3758# 3759# Check for pkg-config 3760# 3761echocheck "pkg-config" 3762_pkg_config=no 3763command -v $_pkgconfig >/dev/null 2>&1 && _pkg_config=yes 3764echo "$_pkg_config" 3765 3766if test "$_pkg_config" = yes && test -n "$_host" && test -z "$PKG_CONFIG_LIBDIR"; then 3767 echo "WARNING: When cross-compiling PKG_CONFIG_LIBDIR must be set to the location of the .pc files for the target" 3768fi 3769 3770# 3771# Setup SDL specifics for SDL based backends 3772# 3773if test "$_sdl" = auto ; then 3774 find_sdlconfig 3775 append_var SDL_CFLAGS "`$_sdlconfig --prefix="$_sdlpath" --cflags`" 3776 if test "$_static_build" = yes ; then 3777 append_var SDL_LIBS "`$_sdlconfig --prefix="$_sdlpath" --static-libs`" 3778 else 3779 append_var SDL_LIBS "`$_sdlconfig --prefix="$_sdlpath" --libs`" 3780 fi 3781 _sdlversion=`$_sdlconfig --version` 3782 3783 echocheck "SDL" 3784 _sdl=no 3785 cat > $TMPC << EOF 3786#include "SDL.h" 3787int main(int argc, char *argv[]) { SDL_Init(0); return 0; } 3788EOF 3789 cc_check $LIBS $SDL_LIBS $INCLUDES $SDL_CFLAGS && _sdl=yes 3790 echo "$_sdl" 3791 if test "$_sdl" = no ; then 3792 exit 1 3793 fi 3794fi 3795 3796_sdlMajorVersionNumber=0 3797if test "$_sdl" = yes ; then 3798 append_var DEFINES "-DSDL_BACKEND" 3799 add_line_to_config_mk "SDL_BACKEND = 1" 3800 append_var INCLUDES "$SDL_CFLAGS" 3801 append_var LIBS "$SDL_LIBS" 3802 case $_sdlversion in 3803 2.0.*) 3804 add_line_to_config_mk "USE_SDL2 = 1" 3805 _sdlMajorVersionNumber=2 3806 ;; 3807 *) 3808 _sdlMajorVersionNumber=1 3809 ;; 3810 esac 3811fi 3812 3813# 3814# Some platforms (eg. Android, iOS) may use an edited version 3815# of SDL-net or SDL2-net that does not require SDL or SDL2 respectively 3816# 3817if test "$_sdlnet" = auto ; then 3818 # If SDL2 was detected, then test for SDL2_net exclusively 3819 # If SDL was detected, then test for SDL_net exclusively 3820 # If neither SDL nor SDL2 detected, then test for both (SDL2_net success takes priority) 3821 set_var SDL2_NET_LIBS "$SDL_NET_LIBS" 3822 set_var SDL2_NET_CFLAGS "$SDL_NET_CFLAGS" 3823 set_var SDL1_NET_LIBS "$SDL_NET_LIBS" 3824 set_var SDL1_NET_CFLAGS "$SDL_NET_CFLAGS" 3825 3826 if test "$_sdl" = no || test "$_sdlMajorVersionNumber" = 2; then 3827 if test "$_pkg_config" = "yes" && $_pkgconfig --exists SDL2_net; then 3828 append_var SDL2_NET_LIBS "`$_pkgconfig --libs SDL2_net`" 3829 append_var SDL2_NET_CFLAGS "`$_pkgconfig --cflags SDL2_net`" 3830 else 3831 append_var SDL2_NET_LIBS "-lSDL2_net" 3832 fi 3833 fi 3834 3835 if test "$_sdl" = no || test "$_sdlMajorVersionNumber" = 1; then 3836 if test "$_pkg_config" = "yes" && $_pkgconfig --exists SDL_net; then 3837 append_var SDL1_NET_LIBS "`$_pkgconfig --libs SDL_net`" 3838 append_var SDL1_NET_CFLAGS "`$_pkgconfig --cflags SDL_net`" 3839 else 3840 append_var SDL1_NET_LIBS "-lSDL_net" 3841 fi 3842 fi 3843 3844 # Check for SDL_Net 3845 echocheck "SDL_Net" 3846 _sdlnet=no 3847 cat > $TMPC << EOF 3848#include "SDL_net.h" 3849int main(int argc, char *argv[]) { SDLNet_Init(); return 0; } 3850EOF 3851 3852 cc_check $SDL2_NET_LIBS $LIBS $INCLUDES $SDL2_NET_CFLAGS && _sdlnet=yes 3853 if test "$_sdlnet" = yes ; then 3854 set_var SDL_NET_LIBS "$SDL2_NET_LIBS" 3855 set_var SDL_NET_CFLAGS "$SDL2_NET_CFLAGS" 3856 else 3857 cat > $TMPC << EOF 3858#include "SDL_net.h" 3859int main(int argc, char *argv[]) { SDLNet_Init(); return 0; } 3860EOF 3861 cc_check $SDL1_NET_LIBS $LIBS $INCLUDES $SDL1_NET_CFLAGS && _sdlnet=yes 3862 set_var SDL_NET_LIBS "$SDL1_NET_LIBS" 3863 set_var SDL_NET_CFLAGS "$SDL1_NET_CFLAGS" 3864 fi 3865 3866 if test "$_sdlnet" = yes ; then 3867 # Some platforms require SDL to be after SDL_Net, thus we prepend var 3868 prepend_var LIBS "$SDL_NET_LIBS" 3869 append_var INCLUDES "$SDL_NET_CFLAGS" 3870 fi 3871 define_in_config_if_yes "$_sdlnet" 'USE_SDL_NET' 3872 echo "$_sdlnet" 3873fi 3874 3875 3876# 3877# Enable 16bit support only for backends which support it 3878# 3879case $_backend in 3880 3ds | android | androidsdl | dingux | dc | gph | iphone | ios7 | maemo | openpandora | psp | psp2 | samsungtv | sdl | switch | tizen | webos | wii) 3881 if test "$_16bit" = auto ; then 3882 _16bit=yes 3883 else 3884 _16bit=no 3885 fi 3886 ;; 3887 *) 3888 _16bit=no 3889 ;; 3890esac 3891 3892# 3893# Enable High resolution engines (>320x240) support only for backends which support it 3894# 3895case $_host in 3896 ds | gcw0) 3897 if test "$_highres" = yes ; then 3898 _highres=yes 3899 else 3900 _highres=no 3901 fi 3902 ;; 3903 *) 3904 if test "$_highres" = no ; then 3905 _highres=no 3906 else 3907 _highres=yes 3908 fi 3909 ;; 3910esac 3911 3912# 3913# Enable Event Recorder only for backends that support it 3914# 3915case $_backend in 3916 sdl) 3917 if test "$_eventrec" = auto ; then 3918 _eventrec=yes 3919 fi 3920 ;; 3921 *) 3922 _eventrec=no 3923 ;; 3924esac 3925 3926# 3927# Disable savegame timestamp support for backends which don't have a reliable real time clock 3928# 3929case $_backend in 3930 gph | n64) 3931 if test "$_savegame_timestamp" = auto ; then 3932 _savegame_timestamp=no 3933 else 3934 _savegame_timestamp=yes 3935 fi 3936 ;; 3937 *) 3938 if test "$_savegame_timestamp" = auto ; then 3939 _savegame_timestamp=yes 3940 else 3941 _savegame_timestamp=no 3942 fi 3943 ;; 3944esac 3945 3946# 3947# Determine whether host is POSIX compliant, or at least POSIX 3948# compatible enough to support our POSIX code (including dlsym(), 3949# mkdir() and some other APIs). 3950# 3951# TODO: Instead of basing this on the host name, we should really base 3952# this on the presence of features (such as the dlsym and mkdir APIs). 3953# 3954echo_n "Checking if host is POSIX compliant... " 3955case $_host_os in 3956 amigaos* | cygwin* | dreamcast | ds | gamecube | mingw* | n64 | ps2 | ps3 | psp2 | psp | riscos | wii | wince) 3957 _posix=no 3958 ;; 3959 3ds | android | androidsdl | beos* | bsd* | darwin* | freebsd* | gnu* | gph-linux | haiku* | hpux* | iphone | ios7 | irix*| k*bsd*-gnu* | linux* | maemo | mint* | netbsd* | openbsd* | solaris* | sunos* | switch | uclinux* | webos) 3960 _posix=yes 3961 ;; 3962 os2-emx*) 3963 _posix=yes # FIXME: Really??? 3964 ;; 3965 *) 3966 # given this is a shell script, we might assume some type of posix. 3967 # However, the host system might be a totally different one, so 3968 # we can assume nothing about it. 3969 # Indeed, as mentioned further above, we really should test for the 3970 # presences of relevant APIs on the host anyway... 3971 _posix=no 3972 ;; 3973esac 3974echo $_posix 3975 3976if test "$_posix" = yes ; then 3977 append_var DEFINES "-DPOSIX" 3978 add_line_to_config_mk 'POSIX = 1' 3979 3980 echo_n "Checking if posix_spawn is supported... " 3981 cat > $TMPC << EOF 3982#include <spawn.h> 3983int main(void) { return posix_spawn(0, 0, 0, 0, 0, 0); } 3984EOF 3985 cc_check && _has_posix_spawn=yes 3986 echo $_has_posix_spawn 3987 if test "$_has_posix_spawn" = yes ; then 3988 append_var DEFINES "-DHAS_POSIX_SPAWN" 3989 fi 3990fi 3991 3992# 3993# Check whether to enable a verbose build 3994# 3995echo_n "Checking whether to have a verbose build... " 3996echo "$_verbose_build" 3997add_to_config_mk_if_yes "$_verbose_build" 'VERBOSE_BUILD = 1' 3998 3999 4000# 4001# If a specific optimization level was requested, enable optimizations 4002# 4003if test -n "$_optimization_level" ; then 4004 # Ports will specify an optimization level and expect that to be enabled 4005 if test "$_optimizations" != no ; then 4006 _optimizations=yes 4007 fi 4008else 4009 _optimization_level=$_default_optimization_level 4010fi 4011 4012# 4013# Check whether to enable optimizations 4014# 4015if test "$_optimizations" = yes ; then 4016 # Enable optimizations. This also 4017 # makes it possible to use -Wuninitialized, so let's do that. 4018 append_var CXXFLAGS "$_optimization_level" 4019 append_var CXXFLAGS "-Wuninitialized" 4020fi 4021 4022# 4023# Check whether plugin support is requested and possible 4024# 4025echo_n "Checking whether building plugins was requested... " 4026echo "$_dynamic_modules" 4027_mak_plugins= 4028 4029if test "$_dynamic_modules" = yes ; then 4030 echo_n "Checking whether building plugins is supported... " 4031 case $_host_os in 4032 3ds) 4033 _elf_loader=yes 4034 append_var DEFINES "-DUNCACHED_PLUGINS" 4035_mak_plugins=' 4036PLUGIN_LDFLAGS += -Wl,-T$(srcdir)/backends/plugins/3ds/plugin.ld -march=armv6k -mfloat-abi=hard 4037' 4038 ;; 4039 amigaos) 4040 _plugin_prefix="lib" 4041 _plugin_suffix=".so" 4042 append_var CXXFLAGS "-fPIC" 4043 append_var LIBS "-use-dynld" 4044_mak_plugins=' 4045PLUGIN_EXTRA_DEPS = 4046PLUGIN_LDFLAGS += -shared 4047PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive 4048POST_OBJS_FLAGS := -Wl,-no-whole-archive 4049' 4050 ;; 4051 android) 4052 _plugin_prefix="lib" 4053 _plugin_suffix=".so" 4054 append_var CXXFLAGS "-fpic" 4055 append_var LIBS "-ldl" 4056# Work around an Android 2.0+ run-time linker bug: 4057# The linker doesn't actually look in previously 4058# loaded libraries when trying to resolve symbols - 4059# effectively turning all dlopen(RTLD_GLOBAL) calls 4060# into dlopen(RTLD_LOCAL). It *does* look in 4061# DT_NEEDED libraries, so the workaround is to add an 4062# (otherwise unnecessary) dependency from plugins back 4063# to the main libscummvm.so. 4064_mak_plugins=' 4065PLUGIN_EXTRA_DEPS = libscummvm.so 4066PLUGIN_LDFLAGS += $(LDFLAGS) -L. -lscummvm 4067PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive 4068POST_OBJS_FLAGS := -Wl,-no-whole-archive 4069' 4070 ;; 4071 darwin*) 4072 _plugin_prefix="" 4073 _plugin_suffix=".plugin" 4074 append_var LIBS "-ldl" 4075_mak_plugins=' 4076PLUGIN_EXTRA_DEPS = $(EXECUTABLE) 4077PLUGIN_LDFLAGS += -bundle -bundle_loader $(EXECUTABLE) -exported_symbols_list "$(srcdir)/plugin.exp" 4078PRE_OBJS_FLAGS := -all_load 4079POST_OBJS_FLAGS := 4080' 4081 ;; 4082 dreamcast) 4083 _plugin_prefix="" 4084 _plugin_suffix=".plg" 4085_mak_plugins=' 4086PLUGIN_EXTRA_DEPS = $(abspath $(srcdir)/backends/platform/dc/plugin.x $(srcdir)/backends/platform/dc/plugin.syms) $(EXECUTABLE) backends/platform/dc/plugin_head.o 4087PLUGIN_LDFLAGS = -ml -m4-single-only -nostartfiles -Wl,-q,-T$(srcdir)/backends/platform/dc/plugin.x,--just-symbols,$(EXECUTABLE),--retain-symbols-file,$(srcdir)/backends/platform/dc/plugin.syms backends/platform/dc/plugin_head.o 4088PRE_OBJS_FLAGS := -Wl,--whole-archive 4089POST_OBJS_FLAGS := -Wl,--no-whole-archive 4090' 4091 ;; 4092 ds) 4093 _elf_loader=yes 4094 append_var DEFINES "-DELF_LOADER_CXA_ATEXIT" 4095 append_var DEFINES "-DUNCACHED_PLUGINS" 4096 append_var DEFINES "-DELF_NO_MEM_MANAGER" 4097_mak_plugins=' 4098PLUGIN_LDFLAGS += -Wl,-T$(srcdir)/backends/plugins/ds/plugin.ld -mthumb-interwork -mfloat-abi=soft 4099' 4100 ;; 4101 freebsd*) 4102 _plugin_prefix="lib" 4103 _plugin_suffix=".so" 4104 append_var CXXFLAGS "-fPIC" 4105_mak_plugins=' 4106PLUGIN_EXTRA_DEPS = 4107PLUGIN_LDFLAGS += -shared 4108PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive 4109POST_OBJS_FLAGS := -Wl,-no-whole-archive 4110' 4111 ;; 4112 gamecube | wii) 4113 _elf_loader=yes 4114 append_var DEFINES "-DELF_LOADER_CXA_ATEXIT" 4115 append_var DEFINES "-DUNCACHED_PLUGINS" 4116_mak_plugins=' 4117PLUGIN_LDFLAGS += -Wl,-T$(srcdir)/backends/plugins/wii/plugin.ld 4118' 4119 ;; 4120 gph*) 4121 _plugin_prefix="" 4122 _plugin_suffix=".plugin" 4123 append_var CXXFLAGS "-fpic" 4124 append_var LIBS "-ldl" 4125_mak_plugins=' 4126PLUGIN_EXTRA_DEPS = $(EXECUTABLE) 4127PLUGIN_LDFLAGS += -shared 4128PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive 4129POST_OBJS_FLAGS := -Wl,-no-whole-archive 4130' 4131 ;; 4132 irix*) 4133 _plugin_prefix="lib" 4134 _plugin_suffix=".so" 4135 append_var CXXFLAGS "-fpic" 4136 append_var LIBS "-ldl" 4137_mak_plugins=' 4138PLUGIN_EXTRA_DEPS = 4139PLUGIN_LDFLAGS += -shared -static-libgcc 4140PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive 4141POST_OBJS_FLAGS := -Wl,-no-whole-archive 4142' 4143 ;; 4144 4145 linux* | gnu* | k*bsd*-gnu*) 4146 _plugin_prefix="lib" 4147 _plugin_suffix=".so" 4148 append_var CXXFLAGS "-fPIC" 4149 append_var LIBS "-ldl" 4150_mak_plugins=' 4151PLUGIN_EXTRA_DEPS = 4152PLUGIN_LDFLAGS += -shared 4153PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive 4154POST_OBJS_FLAGS := -Wl,-no-whole-archive 4155' 4156 ;; 4157 *mingw32* | mingw64) 4158 _plugin_prefix="" 4159 _plugin_suffix=".dll" 4160_mak_plugins=' 4161PLUGIN_EXTRA_DEPS = $(EXECUTABLE) 4162PLUGIN_LDFLAGS := -Wl,--enable-auto-import -shared ./libscummvm.a 4163PRE_OBJS_FLAGS := -Wl,--whole-archive 4164POST_OBJS_FLAGS := -Wl,--export-all-symbols -Wl,--no-whole-archive -Wl,--out-implib,./libscummvm.a 4165' 4166 ;; 4167 wince) 4168 append_var DEFINES "-DUNCACHED_PLUGINS" 4169 HOSTEXEEXT=".dll" 4170 _plugin_prefix="" 4171 _plugin_suffix=".plugin" 4172_mak_plugins=' 4173PLUGIN_EXTRA_DEPS = $(EXECUTABLE) 4174PLUGIN_LDFLAGS := -shared -lscummvm -L. 4175PRE_OBJS_FLAGS := -Wl,--whole-archive 4176POST_OBJS_FLAGS := -Wl,--export-all-symbols -Wl,--no-whole-archive -Wl,--out-implib,./libscummvm.a -shared 4177' 4178 ;; 4179 ps2) 4180 _elf_loader=yes 4181 append_var DEFINES "-DUNCACHED_PLUGINS" 4182_mak_plugins=' 4183LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/main_prog.ld 4184PLUGIN_LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/plugin.ld -lstdc++ -lc 4185' 4186 ;; 4187 psp) 4188 _elf_loader=yes 4189 append_var DEFINES "-DUNCACHED_PLUGINS" 4190_mak_plugins=' 4191LDFLAGS += -Wl,-T$(srcdir)/backends/plugins/psp/main_prog.ld 4192PLUGIN_LDFLAGS += -Wl,-T$(srcdir)/backends/plugins/psp/plugin.ld -lstdc++ -lc 4193' 4194 ;; 4195 webos) 4196 _plugin_prefix="lib" 4197 _plugin_suffix=".so" 4198 append_var CXXFLAGS "-fpic" 4199 append_var LIBS "-ldl" 4200_mak_plugins=' 4201PLUGIN_EXTRA_DEPS = 4202PLUGIN_LDFLAGS += -shared $(LDFLAGS) 4203PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive 4204POST_OBJS_FLAGS := -Wl,-no-whole-archive 4205' 4206 ;; 4207 *) 4208 _dynamic_modules=no 4209 _mak_plugins= 4210 ;; 4211 esac 4212 echo "$_dynamic_modules" 4213fi 4214 4215# 4216# Check whether integrated ELF loader support is requested 4217# 4218define_in_config_if_yes "$_elf_loader" 'USE_ELF_LOADER' 4219 4220if test "$_elf_loader" = yes; then 4221 _plugin_prefix="" 4222 _plugin_suffix=".plg" 4223 _mak_plugins=' 4224PLUGIN_EXTRA_DEPS = $(EXECUTABLE) 4225PLUGIN_LDFLAGS = -nostartfiles backends/plugins/elf/version.o -Wl,-q,--just-symbols,$(EXECUTABLE),--retain-symbols-file,$(srcdir)/backends/plugins/elf/plugin.syms 4226PRE_OBJS_FLAGS := -Wl,--whole-archive 4227POST_OBJS_FLAGS := -Wl,--no-whole-archive 4228'"$_mak_plugins" 4229fi 4230 4231# 4232# Set up some common plugin settings in config.h and config.mk, if enabled 4233# 4234define_in_config_if_yes "$_dynamic_modules" 'DYNAMIC_MODULES' 4235 4236if test "$_dynamic_modules" = yes ; then 4237 add_line_to_config_h "#define PLUGIN_PREFIX \"$_plugin_prefix\"" 4238 add_line_to_config_h "#define PLUGIN_SUFFIX \"$_plugin_suffix\"" 4239 add_line_to_config_mk "PLUGIN_PREFIX := $_plugin_prefix" 4240 add_line_to_config_mk "PLUGIN_SUFFIX := $_plugin_suffix" 4241fi 4242 4243 4244# 4245# Check whether integrated MT-32 emulator support is requested 4246# 4247define_in_config_if_yes "$_mt32emu" 'USE_MT32EMU' 4248 4249# 4250# Check whether Lua support is requested 4251# 4252define_in_config_if_yes "$_lua" 'USE_LUA' 4253 4254# 4255# Check whether Nuked OPL emulator support is disabled 4256# 4257define_in_config_if_no "$_nuked_opl" 'DISABLE_NUKED_OPL' 4258 4259# 4260# Check whether 16bit color support is requested 4261# 4262define_in_config_if_yes "$_16bit" 'USE_RGB_COLOR' 4263 4264# 4265# Check whether High resolution graphics support is requested 4266# 4267define_in_config_if_yes "$_highres" 'USE_HIGHRES' 4268 4269# 4270# Check whether save games use the current time as default description 4271# 4272define_in_config_if_yes "$_savegame_timestamp" 'USE_SAVEGAME_TIMESTAMP' 4273 4274# 4275# Check whether to enable the (hq) scalers 4276# 4277if test "$_build_scalers" = no ; then 4278 _build_hq_scalers=no 4279fi 4280define_in_config_if_yes "$_build_scalers" 'USE_SCALERS' 4281 4282define_in_config_if_yes "$_build_hq_scalers" 'USE_HQ_SCALERS' 4283 4284# 4285# Check for math lib 4286# 4287cat > $TMPC << EOF 4288int main(void) { return 0; } 4289EOF 4290cc_check -lm && append_var LIBS "-lm" 4291 4292# 4293# Check for Ogg 4294# 4295echocheck "Ogg" 4296if test "$_ogg" = auto ; then 4297 _ogg=no 4298 cat > $TMPC << EOF 4299#include <ogg/ogg.h> 4300int main(void) { return 0; } 4301EOF 4302 cc_check $OGG_CFLAGS $OGG_LIBS -logg && _ogg=yes 4303fi 4304define_in_config_if_yes "$_ogg" 'USE_OGG' 4305echo "$_ogg" 4306# 4307# Check for TTS 4308# 4309echocheck "TTS libraries" 4310if test "$_tts" = auto ; then 4311 _tts=no 4312 case $_host_os in 4313 mingw*) 4314 cat > $TMPC << EOF 4315#include <windows.h> 4316#include <Servprov.h> 4317#include <sapi.h> 4318int main(void) { return 0; } 4319EOF 4320 cc_check -lsapi -lole32 && _tts=yes 4321 ;; 4322 linux*) 4323 cat > $TMPC << EOF 4324#include <speech-dispatcher/libspeechd.h> 4325int main(void) { return 0; } 4326EOF 4327 cc_check -lspeechd && _tts=yes 4328 ;; 4329 darwin*) 4330 # Check the API is available. The most recent API we need is for the NSSpeechSynthesizerDelegate protocole 4331 cat > $TMPC << EOF 4332#include <AppKit/NSSpeechSynthesizer.h> 4333@interface SpeechDelegate : NSObject<NSSpeechSynthesizerDelegate> { 4334} 4335@end 4336int main(void) { return 0; } 4337EOF 4338 cc_check -ObjC++ -lobjc && _tts=yes 4339 ;; 4340 esac 4341fi 4342echo "$_tts" 4343 4344# 4345# Check for Vorbis 4346# 4347echocheck "Vorbis" 4348if test "$_vorbis" = auto ; then 4349 _vorbis=no 4350 cat > $TMPC << EOF 4351#include <vorbis/codec.h> 4352int main(void) { vorbis_packet_blocksize(0,0); return 0; } 4353EOF 4354 if test "$_ogg" = yes ; then 4355 cc_check $OGG_CFLAGS $OGG_LIBS $VORBIS_CFLAGS $VORBIS_LIBS \ 4356 -lvorbisfile -lvorbis -logg && _vorbis=yes 4357 else 4358 cc_check $VORBIS_CFLAGS $VORBIS_LIBS \ 4359 -lvorbisfile -lvorbis && _vorbis=yes 4360 fi 4361fi 4362if test "$_vorbis" = yes ; then 4363 append_var LIBS "$VORBIS_LIBS -lvorbisfile -lvorbis" 4364 append_var INCLUDES "$VORBIS_CFLAGS" 4365fi 4366define_in_config_if_yes "$_vorbis" 'USE_VORBIS' 4367echo "$_vorbis" 4368 4369# 4370# Check for Tremor 4371# 4372echocheck "Tremor" 4373if test "$_tremolo" = yes ; then 4374 _tremor=yes 4375fi 4376 4377if test "$_tremor" = auto ; then 4378 _tremor=no 4379 cat > $TMPC << EOF 4380#include <tremor/ivorbiscodec.h> 4381int main(void) { vorbis_info_init(0); return 0; } 4382EOF 4383 if test "$_ogg" = yes ; then 4384 cc_check $TREMOR_CFLAGS $TREMOR_LIBS $OGG_CFLAGS $OGG_LIBS \ 4385 -lvorbisidec -logg && _tremor=yes 4386 else 4387 cc_check $TREMOR_CFLAGS $TREMOR_LIBS -lvorbisidec && \ 4388 _tremor=yes 4389 fi 4390fi 4391if test "$_tremor" = yes && test "$_vorbis" = no; then 4392 add_line_to_config_h '#define USE_TREMOR' 4393 add_line_to_config_h '#define USE_VORBIS' 4394 if test "$_tremolo" = yes ; then 4395 add_line_to_config_h '#define USE_TREMOLO' 4396 append_var LIBS "$TREMOR_LIBS -ltremolo" 4397 elif test "$_host" = ps2 ; then 4398 LIBS="-ltremor $LIBS" 4399 else 4400 append_var LIBS "$TREMOR_LIBS -lvorbisidec" 4401 fi 4402 append_var INCLUDES "$TREMOR_CFLAGS" 4403else 4404 if test "$_vorbis" = yes; then 4405 _tremor="no (Vorbis/Tremor support is mutually exclusive)" 4406 fi 4407 add_line_to_config_h '#undef USE_TREMOR' 4408fi 4409add_to_config_mk_if_yes "$_tremor" 'USE_TREMOR = 1' 4410echo "$_tremor" 4411 4412# 4413# Check for IEEE1284 for OPL2lPT 4414# 4415echocheck "OPL2LPT" 4416if test "$_opl2lpt" = yes ; then 4417 _opl2lpt=no 4418 cat > $TMPC << EOF 4419#include <ieee1284.h> 4420struct parport_list parports; 4421int main(void) { ieee1284_find_ports(&parports, 0); return 0; } 4422EOF 4423 cc_check $IEEE1284_CFLAGS $IEEE1284_LIBS -lieee1284 && \ 4424 _opl2lpt=yes 4425fi 4426if test "$_opl2lpt" = yes; then 4427 append_var LIBS "$IEEE1284_LIBS -lieee1284" 4428 append_var INCLUDES "$IEEE1284_CFLAGS" 4429fi 4430define_in_config_if_yes "$_opl2lpt" 'ENABLE_OPL2LPT' 4431echo "$_opl2lpt" 4432 4433# 4434# Check for FLAC 4435# 4436echocheck "FLAC >= 1.0.1" 4437if test "$_flac" = auto ; then 4438 _flac=no 4439 cat > $TMPC << EOF 4440#include <FLAC/stream_decoder.h> 4441#include <FLAC/format.h> 4442int main(void) { 4443 FLAC__StreamDecoder *decoder = FLAC__stream_decoder_new(); 4444 FLAC__stream_decoder_delete(decoder); 4445 return FLAC__STREAM_SYNC_LEN >> 30; /* guaranteed to be 0 */ 4446} 4447EOF 4448 if test "$_ogg" = yes ; then 4449 cc_check $FLAC_CFLAGS $FLAC_LIBS $OGG_CFLAGS $OGG_LIBS \ 4450 -lFLAC -logg && _flac=yes 4451 else 4452 cc_check $FLAC_CFLAGS $FLAC_LIBS \ 4453 -lFLAC && _flac=yes 4454 fi 4455fi 4456if test "$_flac" = yes ; then 4457 append_var LIBS "$FLAC_LIBS -lFLAC" 4458 append_var INCLUDES "$FLAC_CFLAGS" 4459fi 4460define_in_config_if_yes "$_flac" 'USE_FLAC' 4461echo "$_flac" 4462 4463# Add the link to ogg only after vorbis, tremor and flac as it might be used by those. 4464if test "$_ogg" = yes ; then 4465 append_var LIBS "$OGG_LIBS -logg" 4466 append_var INCLUDES "$OGG_CFLAGS" 4467fi 4468 4469# 4470# Check for MAD (MP3 library) 4471# 4472echocheck "MAD" 4473if test "$_mad" = auto ; then 4474 _mad=no 4475 cat > $TMPC << EOF 4476#include <mad.h> 4477int main(void) { return 0; } 4478EOF 4479 cc_check $MAD_CFLAGS $MAD_LIBS -lmad && _mad=yes 4480fi 4481if test "$_mad" = yes ; then 4482 append_var LIBS "$MAD_LIBS -lmad" 4483 append_var INCLUDES "$MAD_CFLAGS" 4484fi 4485define_in_config_if_yes "$_mad" 'USE_MAD' 4486echo "$_mad" 4487 4488# 4489# Check for ALSA 4490# 4491echocheck "ALSA >= 0.9" 4492if test "$_alsa" = auto ; then 4493 _alsa=no 4494 cat > $TMPC << EOF 4495#include <alsa/asoundlib.h> 4496int main(void) { return (!(SND_LIB_MAJOR==0 && SND_LIB_MINOR==9)); } 4497EOF 4498 cc_check $ALSA_CFLAGS $ALSA_LIBS -lasound && _alsa=yes 4499fi 4500if test "$_alsa" = yes ; then 4501 append_var LIBS "$ALSA_LIBS -lasound" 4502 append_var INCLUDES "$ALSA_CFLAGS" 4503fi 4504define_in_config_if_yes "$_alsa" 'USE_ALSA' 4505echo "$_alsa" 4506 4507# 4508# Check for libjpeg 4509# 4510echocheck "libjpeg >= v6b" 4511if test "$_jpeg" = auto ; then 4512 _jpeg=no 4513 cat > $TMPC << EOF 4514#include <stdio.h> 4515#include <jpeglib.h> 4516int main(void) { 4517#if JPEG_LIB_VERSION >= 62 4518#else 4519 syntax error 4520#endif 4521 return 0; 4522} 4523EOF 4524 cc_check $JPEG_CFLAGS $JPEG_LIBS -ljpeg && _jpeg=yes 4525fi 4526if test "$_jpeg" = yes ; then 4527 append_var LIBS "$JPEG_LIBS -ljpeg" 4528 append_var INCLUDES "$JPEG_CFLAGS" 4529fi 4530define_in_config_if_yes "$_jpeg" 'USE_JPEG' 4531echo "$_jpeg" 4532 4533# 4534# Check for PNG 4535# 4536echocheck "PNG >= 1.2.8" 4537if test "$_pkg_config" = "yes" && $_pkgconfig --exists libpng; then 4538 append_var PNG_LIBS "`$_pkgconfig --libs libpng`" 4539 append_var PNG_CFLAGS "`$_pkgconfig --cflags libpng`" 4540else 4541 append_var PNG_LIBS "-lpng -lz" 4542fi 4543if test "$_png" = auto ; then 4544 _png=no 4545 cat > $TMPC << EOF 4546#include <png.h> 4547int main(void) { 4548#if PNG_LIBPNG_VER >= 10208 4549#else 4550 syntax error 4551#endif 4552 return 0; 4553} 4554EOF 4555 cc_check $PNG_CFLAGS $PNG_LIBS && _png=yes 4556fi 4557if test "$_png" = yes ; then 4558 append_var LIBS "$PNG_LIBS" 4559 append_var INCLUDES "$PNG_CFLAGS" 4560fi 4561define_in_config_if_yes "$_png" 'USE_PNG' 4562echo "$_png" 4563 4564# 4565# Check for Theora Decoder 4566# 4567echocheck "libtheoradec >= 1.0" 4568if test "$_vorbis" = no && test "$_tremor" = no ; then 4569 echo "skipping. no vorbis" 4570 _theoradec=notsupported 4571fi 4572if test "$_theoradec" = auto ; then 4573 _theoradec=no 4574 cat > $TMPC << EOF 4575#include <theora/theoradec.h> 4576int main(void) { th_ycbcr_buffer yuv; th_decode_ycbcr_out(NULL, yuv); } 4577EOF 4578 cc_check $THEORADEC_CFLAGS $THEORADEC_LIBS -ltheoradec && _theoradec=yes 4579fi 4580if test "$_theoradec" = yes ; then 4581 append_var LIBS "$THEORADEC_LIBS -ltheoradec" 4582 append_var INCLUDES "$THEORADEC_CFLAGS" 4583fi 4584define_in_config_if_yes "$_theoradec" 'USE_THEORADEC' 4585if test ! "$_theoradec" = notsupported ; then 4586 echo "$_theoradec" 4587fi 4588 4589# 4590# Check for the AAC decoder 4591# 4592echocheck "libfaad" 4593if test "$_faad" = auto ; then 4594 _faad=no 4595 cat > $TMPC << EOF 4596#include <neaacdec.h> 4597int main(void) { NeAACDecGetCapabilities(); return 0; } 4598EOF 4599 cc_check $FAAD_CFLAGS $FAAD_LIBS -lfaad && _faad=yes 4600fi 4601if test "$_faad" = yes ; then 4602 append_var LIBS "$FAAD_LIBS -lfaad" 4603 append_var INCLUDES "$FAAD_CFLAGS" 4604fi 4605define_in_config_if_yes "$_faad" 'USE_FAAD' 4606echo "$_faad" 4607 4608# 4609# Check for SEQ MIDI 4610# 4611echocheck "SEQ MIDI" 4612if test "$_seq_midi" = auto ; then 4613 # TODO: Test for /dev/sequencer presence? Or maybe just for /dev ? 4614 # For now, we just always enable it when "posix" mode is on (backends 4615 # that do not want it can disable it by setting _seq_midi=no). 4616 _seq_midi="$_posix" 4617fi 4618define_in_config_h_if_yes "$_seq_midi" 'USE_SEQ_MIDI' 4619echo "$_seq_midi" 4620 4621# 4622# Check for sndio 4623# 4624echocheck "sndio" 4625if test "$_sndio" = auto ; then 4626 _sndio=no 4627 cat > $TMPC << EOF 4628#include <sndio.h> 4629int main(void) { struct sio_par par; sio_initpar(&par); return 0; } 4630EOF 4631 cc_check $SNDIO_CFLAGS $SNDIO_LIBS -lsndio && _sndio=yes 4632fi 4633if test "$_sndio" = yes ; then 4634 append_var LIBS "$SNDIO_LIBS -lsndio" 4635 append_var INCLUDES "$SNDIO_CFLAGS" 4636fi 4637define_in_config_h_if_yes "$_sndio" 'USE_SNDIO' 4638echo "$_sndio" 4639 4640# 4641# Check for TiMidity(++) 4642# 4643echocheck "TiMidity" 4644if test "$_timidity" = auto ; then 4645 # TODO: Is there a good possibility of auto detecting whether we 4646 # should include TiMidity support? It can only be used on Unix 4647 # currently so we use that as "detection" for now. 4648 _timidity="$_posix" 4649fi 4650define_in_config_h_if_yes "$_timidity" 'USE_TIMIDITY' 4651echo "$_timidity" 4652 4653# 4654# Check for ZLib 4655# 4656echocheck "zlib" 4657if test "$_zlib" = auto ; then 4658 _zlib=no 4659 cat > $TMPC << EOF 4660#include <string.h> 4661#include <zlib.h> 4662int main(void) { return strcmp(ZLIB_VERSION, zlibVersion()); } 4663EOF 4664 cc_check $ZLIB_CFLAGS $ZLIB_LIBS -lz && _zlib=yes 4665fi 4666if test "$_zlib" = yes ; then 4667 append_var ZLIB_LIBS "-lz" 4668 append_var LIBS "$ZLIB_LIBS" 4669 append_var INCLUDES "$ZLIB_CFLAGS" 4670fi 4671define_in_config_if_yes "$_zlib" 'USE_ZLIB' 4672echo "$_zlib" 4673 4674# 4675# Check for LibMPEG2 4676# 4677echocheck "libmpeg2 >= 0.4.0" 4678if test "$_mpeg2" = auto ; then 4679 _mpeg2=no 4680 cat > $TMPC << EOF 4681typedef signed $type_1_byte int8_t; 4682typedef signed $type_2_byte int16_t; 4683typedef signed $type_4_byte int32_t; 4684 4685typedef unsigned $type_1_byte uint8_t; 4686typedef unsigned $type_2_byte uint16_t; 4687typedef unsigned $type_4_byte uint32_t; 4688 4689extern "C" { 4690#include <mpeg2dec/mpeg2.h> 4691} 4692 4693int main(void) { 4694 #if MPEG2_RELEASE < MPEG2_VERSION(0, 4, 0) 4695 #error libmpeg2 version too low 4696 #endif 4697 4698 /* mpeg2_state_t first appears in 0.4.0 */ 4699 mpeg2_state_t state; 4700 4701 return 0; 4702} 4703EOF 4704 4705 if test -n "$_host"; then 4706 # don't execute while cross compiling 4707 cc_check $MPEG2_CFLAGS $MPEG2_LIBS -lmpeg2 && _mpeg2=yes 4708 else 4709 cc_check_no_clean $MPEG2_CFLAGS $MPEG2_LIBS -lmpeg2 && $TMPO$HOSTEXEEXT && _mpeg2=yes 4710 cc_check_clean 4711 fi 4712fi 4713if test "$_mpeg2" = yes ; then 4714 append_var INCLUDES "$MPEG2_CFLAGS" 4715 append_var LIBS "$MPEG2_LIBS -lmpeg2" 4716fi 4717define_in_config_if_yes "$_mpeg2" 'USE_MPEG2' 4718echo "$_mpeg2" 4719 4720# 4721# Check for liba52 4722# 4723echocheck "liba52" 4724if test "$_a52" = auto ; then 4725 _a52=no 4726 cat > $TMPC << EOF 4727typedef signed $type_1_byte int8_t; 4728typedef signed $type_2_byte int16_t; 4729typedef signed $type_4_byte int32_t; 4730 4731typedef unsigned $type_1_byte uint8_t; 4732typedef unsigned $type_2_byte uint16_t; 4733typedef unsigned $type_4_byte uint32_t; 4734 4735extern "C" { 4736#include <a52dec/a52.h> 4737} 4738 4739int main(void) { 4740 a52_state_t *state = a52_init(0); 4741 a52_free(state); 4742 return 0; 4743} 4744EOF 4745 4746 if test -n "$_host"; then 4747 # don't execute while cross compiling 4748 cc_check $A52_CFLAGS $A52_LIBS -la52 && _a52=yes 4749 else 4750 cc_check_no_clean $A52_CFLAGS $A52_LIBS -la52 && $TMPO$HOSTEXEEXT && _a52=yes 4751 cc_check_clean 4752 fi 4753fi 4754if test "$_a52" = yes ; then 4755 INCLUDES="$INCLUDES $A52_FLAGS" 4756 LIBS="$LIBS $A52_LIBS -la52" 4757fi 4758define_in_config_if_yes "$_a52" 'USE_A52' 4759echo "$_a52" 4760 4761# 4762# Check for Sparkle if updates support is enabled 4763# 4764case $_host_os in 4765 darwin*) 4766 echocheck "Sparkle" 4767 if test "$_updates" = no; then 4768 _sparkle=no 4769 else 4770 if test ! -z $_sparklepath ; then 4771 SPARKLE_CFLAGS="-F$_sparklepath" 4772 SPARKLE_LIBS="-F$_sparklepath" 4773 fi 4774 if test "$_sparkle" = auto ; then 4775 _sparkle=no 4776 cat > $TMPC << EOF 4777#include <Cocoa/Cocoa.h> 4778#include <Sparkle/Sparkle.h> 4779int main(void) { SUUpdater *updater = [SUUpdater sharedUpdater]; return 0; } 4780EOF 4781 cc_check $SPARKLE_CFLAGS $SPARKLE_LIBS -framework Sparkle -ObjC++ -lobjc && _sparkle=yes 4782 fi 4783 if test "$_sparkle" = yes ; then 4784 append_var LIBS "$SPARKLE_LIBS -framework Sparkle" 4785 append_var INCLUDES "$SPARKLE_CFLAGS" 4786 fi 4787 define_in_config_if_yes "$_sparkle" 'USE_SPARKLE' 4788 fi 4789 echo "$_sparkle" 4790 ;; 4791 mingw*) 4792 echocheck "Sparkle" 4793 if test "$_updates" = no; then 4794 _sparkle=no 4795 else 4796 if test ! -z $_sparklepath ; then 4797 SPARKLE_CFLAGS="-I$_sparklepath/include" 4798 SPARKLE_LIBS="-L$_sparklepath/Release -L$_sparklepath/x64/Release" 4799 fi 4800 if test "$_sparkle" = auto ; then 4801 _sparkle=no 4802 cat > $TMPC << EOF 4803#include <winsparkle.h> 4804int main(void) { win_sparkle_get_update_check_interval(); return 0; } 4805EOF 4806 cc_check $SPARKLE_CFLAGS $SPARKLE_LIBS -lWinSparkle && _sparkle=yes 4807 fi 4808 if test "$_sparkle" = yes ; then 4809 append_var LIBS "$SPARKLE_LIBS -lWinSparkle" 4810 append_var INCLUDES "$SPARKLE_CFLAGS" 4811 fi 4812 define_in_config_if_yes "$_sparkle" 'USE_SPARKLE' 4813 fi 4814 echo "$_sparkle" 4815 ;; 4816 *) 4817 _sparkle=no 4818 ;; 4819esac 4820 4821# 4822# Check for libcurl to be present 4823# 4824if test "$_libcurl" != "no"; then 4825 4826 # Look for the curl-config script 4827 find_libcurlconfig 4828 4829 if test -z "$_libcurlconfig"; then 4830 _libcurl=no 4831 else 4832 if test -n "$_staticlibpath"; then 4833 LIBCURL_LIBS=`$_libcurlconfig --static-libs` 4834 else 4835 LIBCURL_LIBS=`$_libcurlconfig --libs` 4836 fi 4837 LIBCURL_CFLAGS=`$_libcurlconfig --cflags` 4838 4839 case $_host_os in 4840 amigaos*) 4841 append_var LIBCURL_LIBS "-lpthread" 4842 ;; 4843 # macOS does not allow static libs, overriding 4844 darwin*) 4845 LIBCURL_LIBS=`$_libcurlconfig --libs` 4846 ;; 4847 psp2*) 4848 append_var LIBCURL_LIBS "-lssl -lcrypto" 4849 ;; 4850 esac 4851 4852 if test "$_libcurl" = "auto"; then 4853 _libcurl=no 4854 4855 cat > $TMPC << EOF 4856 #include <curl/curl.h> 4857 int main(int argc, char *argv[]) { 4858 int x; 4859 curl_easy_setopt(NULL,CURLOPT_URL,NULL); 4860 x=CURL_ERROR_SIZE; 4861 x=CURLOPT_WRITEFUNCTION; 4862 x=CURLOPT_WRITEDATA; 4863 x=CURLOPT_ERRORBUFFER; 4864 x=CURLOPT_STDERR; 4865 x=CURLOPT_VERBOSE; 4866 4867 curl_version_info_data *data = curl_version_info(CURLVERSION_NOW); 4868 if (data->features & CURL_VERSION_SSL) 4869 return 0; 4870 return 1; 4871 } 4872EOF 4873 4874 cc_check_no_clean $LIBCURL_CFLAGS $LIBCURL_LIBS 4875 if test "$?" -eq 0; then 4876 if test -n "$_host"; then 4877 # In cross-compiling mode, we cannot run the result, assume SSL is available 4878 _libcurl=yes 4879 else 4880 $TMPO$HOSTEXEEXT 4881 if test "$?" -eq 0; then 4882 _libcurl=yes 4883 else 4884 _libcurl="no SSL support" 4885 fi 4886 fi 4887 fi 4888 cc_check_clean 4889 fi 4890 4891 if test "$_libcurl" = "yes"; then 4892 append_var LIBS "$LIBCURL_LIBS" 4893 append_var INCLUDES "$LIBCURL_CFLAGS" 4894 fi 4895 fi 4896 4897fi 4898 4899echocheck "libcurl" 4900echo "$_libcurl" 4901 4902define_in_config_if_yes "$_libcurl" "USE_LIBCURL" 4903 4904# 4905# Check whether to build cloud integration support 4906# 4907echo_n "Cloud integration... " 4908if test "$_cloud" = "no"; then 4909 echo "no" 4910else 4911 _cloud=no 4912 if test "$_sdlnet" = "yes"; then 4913 _cloud=yes 4914 echo_n "local" 4915 fi 4916 if test "$_libcurl" = "yes"; then 4917 if test "$_cloud" = "yes"; then echo_n ", "; fi 4918 _cloud=yes 4919 echo_n "servers" 4920 fi 4921 if test "$_cloud" = "no"; then 4922 echo_n "no" 4923 fi 4924 echo # newline 4925fi 4926define_in_config_if_yes $_cloud 'USE_CLOUD' 4927 4928# 4929# Check is NSDockTilePlugIn protocol is supported 4930# 4931case $_host_os in 4932 darwin*) 4933 # NSDockTilePlugIn was added in OS X 10.6, so will not be available when compiling on older OS X versions. 4934 echocheck "DockTilePlugin" 4935 if test "$_osxdockplugin" = auto ; then 4936 _osxdockplugin=no 4937 cat > $TMPC << EOF 4938#include <Cocoa/Cocoa.h> 4939@interface ScummVMDockTilePlugIn : NSObject <NSDockTilePlugIn> { 4940} 4941@end 4942EOF 4943 cc_check -c -ObjC++ && _osxdockplugin=yes 4944 fi 4945 define_in_config_if_yes "$_osxdockplugin" 'USE_DOCKTILEPLUGIN' 4946 echo "$_osxdockplugin" 4947 ;; 4948 *) 4949 _osxdockplugin=no 4950 ;; 4951esac 4952 4953# 4954# Check for FluidSynth 4955# 4956echocheck "FluidSynth" 4957 4958append_var FLUIDSYNTH_LIBS "-lfluidsynth" 4959case $_host_os in 4960 mingw*) 4961 FLUIDSYNTH_STATIC_LIBS="$FLUIDSYNTH_LIBS -lglib-2.0 -lintl -liconv -lws2_32 -lole32 -lshlwapi -lpcre -ldsound -lwinmm" 4962 ;; 4963 4964 darwin*) 4965 FLUIDSYNTH_STATIC_LIBS="$FLUIDSYNTH_LIBS -framework Foundation -framework CoreMIDI -framework CoreAudio -lglib-2.0 -lintl -liconv -lreadline" 4966 ;; 4967 4968 iphone) 4969 FLUIDSYNTH_STATIC_LIBS="$FLUIDSYNTH_LIBS -framework Foundation -framework CoreMIDI -lglib-2.0 -lintl -liconv" 4970 ;; 4971 4972 *) 4973 FLUIDSYNTH_STATIC_LIBS="$FLUIDSYNTH_LIBS -lglib-2.0 -lintl -liconv" 4974 ;; 4975esac 4976 4977if test "$_fluidsynth" = auto; then 4978 _fluidsynth=no 4979 cat > $TMPC << EOF 4980#include <fluidsynth.h> 4981int main(void) { delete_fluid_settings(new_fluid_settings()); return 0; } 4982EOF 4983 cc_check_no_clean $FLUIDSYNTH_CFLAGS $FLUIDSYNTH_LIBS && _fluidsynth=yes 4984 if test "$_fluidsynth" != yes; then 4985 FLUIDSYNTH_LIBS="$FLUIDSYNTH_STATIC_LIBS" 4986 cc_check_no_clean $FLUIDSYNTH_CFLAGS $FLUIDSYNTH_LIBS && _fluidsynth=yes 4987 fi 4988 cc_check_clean 4989fi 4990if test "$_fluidsynth" = yes; then 4991 append_var LIBS "$FLUIDSYNTH_LIBS" 4992 append_var INCLUDES "$FLUIDSYNTH_CFLAGS" 4993fi 4994define_in_config_if_yes "$_fluidsynth" 'USE_FLUIDSYNTH' 4995echo "$_fluidsynth" 4996 4997# 4998# Check for readline if text_console is enabled 4999# 5000echocheck "readline" 5001if test "$_text_console" = yes ; then 5002 _READLINE_LIBS="-lreadline" 5003 if test "$_readline" = auto ; then 5004 _readline=no 5005 cat > $TMPC << EOF 5006#include <stdio.h> 5007#include <readline/readline.h> 5008#include <readline/history.h> 5009 5010int main(void) { 5011 char *x = readline(""); 5012} 5013EOF 5014 cc_check_no_clean $READLINE_CFLAGS $READLINE_LIBS $_READLINE_LIBS && _readline=yes 5015 if test "$_readline" = no ; then 5016 _READLINE_LIBS="-lreadline -ltermcap" 5017 cc_check_no_clean $READLINE_CFLAGS $READLINE_LIBS $_READLINE_LIBS && _readline=yes 5018 fi 5019 fi 5020 cc_check_clean 5021 echo "$_readline" 5022else 5023 _readline=no 5024 echo "skipping (text console disabled)" 5025fi 5026 5027if test "$_readline" = yes ; then 5028 append_var LIBS "$READLINE_LIBS $_READLINE_LIBS" 5029 append_var INCLUDES "$READLINE_CFLAGS" 5030 5031 # 5032 # Check the type of rl_completion_entry_function. 5033 # It can be int(*)(const char *, int) or char *(*)(const char *, int). 5034 # 5035 cat > $TMPC << EOF 5036#include <stdio.h> 5037#include <readline/readline.h> 5038#include <readline/history.h> 5039 5040int readline_completionFunction(const char *, int); 5041 5042int main(void) { 5043 char *x = readline(""); 5044 rl_completion_entry_function = &readline_completionFunction; 5045} 5046EOF 5047 cc_check -c && add_line_to_config_h '#define USE_READLINE_INT_COMPLETION' 5048 5049fi 5050define_in_config_h_if_yes "$_readline" 'USE_READLINE' 5051 5052define_in_config_h_if_yes "$_text_console" 'USE_TEXT_CONSOLE_FOR_DEBUGGER' 5053 5054# 5055# Check for Unity if taskbar integration is enabled 5056# 5057echocheck "libunity" 5058if test "$_unix" = no || test "$_taskbar" = no || test "$_pkg_config" = no; then 5059 _libunity=no 5060else 5061if test "$_libunity" = auto ; then 5062 case $_host_os in 5063 mingw*) 5064 # pkgconfig and unity are not supported on mingw 5065 _libunity=no 5066 ;; 5067 *) 5068 # Unity has a lots of dependencies, update the libs and cflags var with them 5069 LIBUNITY_LIBS="$LIBUNITY_LIBS `$_pkgconfig --libs 'unity > 3.8.1' 2>> "$TMPLOG"`" 5070 LIBUNITY_CFLAGS="$LIBUNITY_CFLAGS `$_pkgconfig --cflags 'unity > 3.8.1' 2>> "$TMPLOG"`" 5071 _libunity=no 5072 cat > $TMPC << EOF 5073#include <unity.h> 5074int main(void) { 5075 unity_launcher_entry_get_for_desktop_id("scummvm.desktop"); 5076 return 0; 5077} 5078EOF 5079 cc_check $LIBUNITY_CFLAGS $LIBUNITY_LIBS && _libunity=yes 5080 ;; 5081 esac 5082fi 5083if test "$_libunity" = yes ; then 5084 if test "$LIBUNITY_CFLAGS" = "" || test "$LIBUNITY_LIBS" = ""; then 5085 LIBUNITY_LIBS="$LIBUNITY_LIBS `$_pkgconfig --libs 'unity > 3.8.1' 2>> "$TMPLOG"`" 5086 LIBUNITY_CFLAGS="$LIBUNITY_CFLAGS `$_pkgconfig --cflags 'unity > 3.8.1' 2>> "$TMPLOG"`" 5087 fi 5088 append_var LIBS "$LIBUNITY_LIBS" 5089 append_var CXXFLAGS "$LIBUNITY_CFLAGS" 5090fi 5091define_in_config_h_if_yes "$_libunity" 'USE_UNITY' 5092fi 5093echo "$_libunity" 5094 5095# 5096# Check for FreeType2 to be present 5097# 5098find_freetype() { 5099 # Wrapper function which tries to find freetype 5100 # either by calling freetype-config or by using 5101 # pkg-config. 5102 # As of freetype-2.9.1 the freetype-config file 5103 # no longer gets installed by default. 5104 if test "$_pkg_config" = "yes" && $_pkgconfig --exists freetype2; then 5105 FREETYPE2_LIBS=`$_pkgconfig --libs freetype2` 5106 FREETYPE2_CFLAGS=`$_pkgconfig --cflags freetype2` 5107 FREETYPE2_STATIC_LIBS=`$_pkgconfig --static --libs freetype2` 5108 _freetype_found="true" 5109 else 5110 # Look for the freetype-config script 5111 find_freetypeconfig 5112 if test -n "$_freetypeconfig"; then 5113 # Since 2.3.12, freetype-config prepends $SYSROOT to everything. 5114 # This means we can't pass it a --prefix that includes $SYSROOT. 5115 freetypeprefix="$_freetypepath" 5116 if test -n "$SYSROOT" -a "$SYSROOT" != "/"; then 5117 teststring=VeryImplausibleSysrootX1Y2Z3 5118 if ( env SYSROOT=/$teststring "$_freetypeconfig" --cflags | grep $teststring 2> /dev/null > /dev/null ); then 5119 echo "Adapting FreeType prefix to SYSROOT" >> "$TMPLOG" 5120 freetypeprefix="${freetypeprefix##$SYSROOT}" 5121 fi 5122 fi 5123 FREETYPE2_LIBS=`$_freetypeconfig --prefix="$freetypeprefix" --libs` 5124 FREETYPE2_CFLAGS=`$_freetypeconfig --prefix="$freetypeprefix" --cflags` 5125 FREETYPE2_STATIC_LIBS=`$_freetypeconfig --prefix="$freetypeprefix" --static --libs 2>/dev/null` 5126 _freetype_found="true" 5127 fi 5128 fi 5129} 5130 5131if test "$_freetype2" != "no"; then 5132 find_freetype 5133 if test $_freetype_found != true; then 5134 _freetype2=no 5135 else 5136 if test "$_freetype2" = "auto"; then 5137 _freetype2=no 5138 5139 cat > $TMPC << EOF 5140#include <ft2build.h> 5141#include FT_FREETYPE_H 5142 5143int main(int argc, char *argv[]) { 5144 FT_Library library; 5145 FT_Error error = FT_Init_FreeType(&library); 5146 FT_Done_FreeType(library); 5147} 5148EOF 5149 5150 cc_check_no_clean $FREETYPE2_CFLAGS $FREETYPE2_LIBS && _freetype2=yes 5151 # Modern freetype-config scripts accept --static to get all 5152 # required flags for static linking. We abuse this to detect 5153 # FreeType2 builds which are static themselves. 5154 if test "$_freetype2" != "yes"; then 5155 FREETYPE2_LIBS="$FREETYPE2_STATIC_LIBS" 5156 cc_check_no_clean $FREETYPE2_CFLAGS $FREETYPE2_LIBS && _freetype2=yes 5157 fi 5158 cc_check_clean 5159 fi 5160 5161 if test "$_freetype2" = "yes"; then 5162 append_var LIBS "$FREETYPE2_LIBS" 5163 append_var CXXFLAGS "$FREETYPE2_CFLAGS" 5164 fi 5165 fi 5166 5167fi 5168 5169echocheck "FreeType2" 5170echo "$_freetype2" 5171 5172define_in_config_if_yes "$_freetype2" "USE_FREETYPE2" 5173 5174# 5175# Check for OpenGL (ES) 5176# 5177echocheck "OpenGL" 5178 5179case $_backend in 5180 openpandora) 5181 # Only enable OpenGL ES on the OpanPandora if --opengl-mode=gles is passed in explicitly. 5182 if test "$_opengl_mode" = "gles" ; then 5183 append_var LIBS "-lGLES_CM -lEGL -lX11" 5184 else 5185 _opengl_mode=none 5186 fi 5187 ;; 5188esac 5189 5190if test "$_opengl_mode" = auto ; then 5191 case $_backend in 5192 android) 5193 # Android always runs in GLES mode 5194 _opengl_mode=gles 5195 ;; 5196 sdl) 5197 case $_sdlversion in 5198 1.2.*) 5199 # Stock SDL 1.2 only supports OpenGL contexts. 5200 _opengl_mode=gl 5201 ;; 5202 5203 2.0.*) 5204 # SDL2 supports both OpenGL + OpenGL ES contexts. 5205 # However, Mac OS X only allows OpenGL context creation at 5206 # this time, thus we limit us to OpenGL on that platform. 5207 case $_host_os in 5208 darwin*) 5209 _opengl_mode=gl 5210 ;; 5211 5212 *) 5213 _opengl_mode=any 5214 ;; 5215 esac 5216 ;; 5217 esac 5218 ;; 5219 5220 tizen) 5221 # Tizen always runs in GLES mode 5222 _opengl_mode=gles 5223 ;; 5224 5225 *) 5226 _opengl_mode=none 5227 ;; 5228 esac 5229fi 5230 5231_opengl=yes 5232case $_opengl_mode in 5233 auto) 5234 # This case should never occur but better safe than sorry. 5235 echo "no" 5236 _opengl=no 5237 ;; 5238 5239 none) 5240 echo "no" 5241 _opengl=no 5242 ;; 5243 5244 any) 5245 echo "yes (runtime detection)" 5246 add_line_to_config_h "#undef USE_GLES_MODE" 5247 ;; 5248 5249 gl) 5250 echo "yes (OpenGL)" 5251 add_line_to_config_h "#define USE_GLES_MODE 0" 5252 ;; 5253 5254 gles) 5255 echo "yes (OpenGL ES)" 5256 add_line_to_config_h "#define USE_GLES_MODE 1" 5257 ;; 5258 5259 gles2) 5260 echo "yes (OpenGL ES 2)" 5261 add_line_to_config_h "#define USE_GLES_MODE 2" 5262 ;; 5263 5264 *) 5265 echo "invalid mode specification '$_opengl_mode'. Aborting." 5266 exit 1 5267 ;; 5268esac 5269 5270define_in_config_if_yes "$_opengl" "USE_OPENGL" 5271 5272# 5273# Check for iconv 5274# 5275echo_n "Checking whether iconv.h is present... " 5276if test "$_iconv" = auto ; then 5277 _iconv=no 5278 cat > $TMPC << EOF 5279#include <iconv.h> 5280int main(int, char **) { 5281 return 0; 5282} 5283EOF 5284 cc_check $ICONV_CFLAGS $ICONV_LIBS && _iconv=yes 5285fi 5286 5287create_iconv_test() { 5288 cat > $TMPC << EOF 5289#include <iconv.h> 5290int main(int, char **) { 5291 iconv_t iconv = iconv_open("UTF-32", "SJIS"); 5292 iconv_close(iconv); 5293 return 0; 5294} 5295EOF 5296} 5297echo "$_iconv" 5298 5299if test "$_iconv" = yes ; then 5300 echo_n "Checking whether iconv needs linking against libiconv... " 5301 5302 needs_iconvlib='auto' 5303 create_iconv_test 5304 cc_check $ICONV_CFLAGS $ICONV_LIBS -liconv && needs_iconvlib='yes' 5305 # We do check linking without -liconv here too, just in case 5306 # it would fail otherwise too 5307 create_iconv_test 5308 cc_check $ICONV_CFLAGS $ICONV_LIBS && needs_iconvlib='no' 5309 5310 if test "$needs_iconvlib" = auto ; then 5311 _iconv=no 5312 echo "does not link at all" 5313 else 5314 if test "$needs_iconvlib" = yes ; then 5315 append_var ICONV_LIBS "-liconv" 5316 fi 5317 echo "$needs_iconvlib" 5318 5319 echo_n "Checking signature of iconv... " 5320 uses_const=no 5321 5322 cat > $TMPC << EOF 5323#include <iconv.h> 5324int main(int argc, char **argv) { 5325 iconv_t iconvP; 5326 const char **inbuf = 0; 5327 iconv(iconvP, inbuf, 0, 0, 0); 5328 return 0; 5329} 5330EOF 5331 cc_check $ICONV_CFLAGS $ICONV_LIBS && uses_const=yes 5332 5333 if test "$uses_const" = yes ; then 5334 echo "iconv_t, const char **, size_t *, char **, size_t *" 5335 else 5336 echo "iconv_t, char **, size_t *, char **, size_t *" 5337 fi 5338 5339 define_in_config_if_yes "$uses_const" 'ICONV_USES_CONST' 5340 fi 5341fi 5342 5343if test "$_iconv" = yes ; then 5344 append_var LIBS "$ICONV_LIBS" 5345 append_var INCLUDES "$ICONV_CFLAGS" 5346fi 5347 5348echocheck "iconv" 5349define_in_config_if_yes "$_iconv" 'USE_ICONV' 5350echo "$_iconv" 5351 5352# 5353# Check for Linux CD-ROM support 5354# 5355case $_host_os in 5356 *linux*) 5357 echocheck "Linux CD-ROM" 5358 linuxcd=no 5359 cat > $TMPC << EOF 5360#include <linux/cdrom.h> 5361#include <sys/types.h> 5362int main(void) { 5363 int x = CDROMREADAUDIO; 5364 dev_t dev; 5365 return major(dev) + x; 5366} 5367EOF 5368 cc_check && linuxcd=yes 5369 define_in_config_if_yes "$linuxcd" 'USE_LINUXCD' 5370 echo "$linuxcd" 5371 ;; 5372esac 5373 5374 5375# 5376# Check for nasm 5377# 5378if test "$_have_x86" = yes ; then 5379 echocheck "nasm" 5380 if test "$_nasm" = no ; then 5381 echo "disabled" 5382 else 5383 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$SEPARATOR 5384 5385 for path_dir in $_nasmpath; do 5386 if test -x "$path_dir/nasm$NATIVEEXEEXT" ; then 5387 NASM="$path_dir/nasm$NATIVEEXEEXT" 5388 NASMFLAGS="-O1 -g" 5389 echo $NASM 5390 break 5391 fi 5392 done 5393 5394 # fallback to the nasm compatible yasm 5395 if test x$NASM = x -o x$NASM = x'"$NASM"'; then 5396 for path_dir in $_nasmpath; do 5397 if test -x "$path_dir/yasm$NATIVEEXEEXT" ; then 5398 NASM="$path_dir/yasm$NATIVEEXEEXT" 5399 NASMFLAGS="-a x86 -m x86" 5400 echo $NASM 5401 break 5402 fi 5403 done 5404 fi 5405 5406 IFS="$ac_save_ifs" 5407 5408 if test x$NASM = x -o x$NASM = x'"$NASM"'; then 5409 echo "not found" 5410 _nasm=no 5411 else 5412 case $_host_os in 5413 darwin*) 5414 append_var NASMFLAGS "-f macho" 5415 ;; 5416 mingw*) 5417 append_var NASMFLAGS "-f win32" 5418 ;; 5419 os2-emx*) 5420 append_var NASMFLAGS "-f aout" 5421 ;; 5422 *) 5423 append_var NASMFLAGS "-f elf" 5424 ;; 5425 esac 5426 _nasm=yes 5427 fi 5428 fi 5429fi 5430 5431define_in_config_if_yes $_nasm 'USE_NASM' 5432 5433# 5434# Check for pandoc 5435# 5436if test "$_pandoc" = yes ; then 5437 echocheck "pandoc" 5438 5439 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$SEPARATOR 5440 5441 for path_dir in $_pandocpath; do 5442 if test -x "$path_dir/pandoc$NATIVEEXEEXT" ; then 5443 PANDOC="$path_dir/pandoc$NATIVEEXEEXT" 5444 break 5445 fi 5446 done 5447 5448 IFS="$ac_save_ifs" 5449 5450 if ! test "$PANDOC" ; then 5451 _pandoc=no 5452 fi 5453 5454 echo $_pandoc 5455fi 5456 5457define_in_config_if_yes $_pandoc 'USE_PANDOC' 5458 5459# Default to plain text output for pandoc 5460if test -z "$_pandocformat" -o "$_pandocformat" = "default"; then 5461 _pandocformat="plain" 5462fi 5463 5464if test "$_pandocext" = "default"; then 5465 if test "$_pandocformat" = plain; then 5466 _pandocext="" 5467 else 5468 _pandocext=".$_pandocformat" 5469 fi 5470fi 5471 5472# 5473# Enable vkeybd / keymapper / event recorder 5474# 5475define_in_config_if_yes $_vkeybd 'ENABLE_VKEYBD' 5476define_in_config_if_yes $_keymapper 'ENABLE_KEYMAPPER' 5477define_in_config_if_yes $_eventrec 'ENABLE_EVENTRECORDER' 5478 5479# 5480# Check if the keymapper and the event recorder are enabled simultaneously 5481# 5482if test "$_keymapper" = yes ; then 5483 if test "$_eventrec" = yes ; then 5484 echo "ERROR: The keymapper and the event recorder cannot be enabled simultaneously currently, please disable one of the two" 5485 exit 1 5486 fi 5487fi 5488 5489# Check whether to build translation support 5490# 5491echo_n "Building translation support... " 5492define_in_config_if_yes $_translation 'USE_TRANSLATION' 5493if test "$_translation" = no ; then 5494 echo "no" 5495else 5496 echo_n "yes (" 5497 5498 if test "$_detectlang" != yes ; then 5499 cat > $TMPC << EOF 5500#include <locale.h> 5501int main(void) { setlocale(LC_ALL, ""); return 0; } 5502EOF 5503 _detectlang=no 5504 cc_check && _detectlang=yes 5505 fi 5506 5507 define_in_config_h_if_yes $_detectlang 'USE_DETECTLANG' 5508 if test "$_detectlang" = yes ; then 5509 echo "with runtime language detection)" 5510 else 5511 echo "without runtime language detection)" 5512 fi 5513fi 5514 5515# 5516# Check whether to build taskbar integration support 5517# 5518echo_n "Building taskbar integration support... " 5519if test "$_taskbar" = "no"; then 5520 echo "no" 5521else 5522 case $_host_os in 5523 mingw*) 5524 append_var LIBS "-lole32 -luuid" 5525 echo "win32" 5526 _taskbar=yes 5527 ;; 5528 darwin*) 5529 echo "osx" 5530 _taskbar=yes 5531 ;; 5532 *) 5533 if test "$_libunity" = yes; then 5534 echo "unity" 5535 _taskbar=yes 5536 else 5537 echo "no" 5538 _taskbar=no 5539 fi 5540 ;; 5541 esac 5542fi 5543define_in_config_if_yes $_taskbar 'USE_TASKBAR' 5544 5545# 5546# Check whether to build system dialogs support 5547# 5548echo_n "Building system dialogs support... " 5549if test "$_dialogs" = "no"; then 5550 echo "no" 5551else 5552 case $_host_os in 5553 mingw*) 5554 append_var LIBS "-lole32 -luuid" 5555 echo "win32" 5556 _dialogs=yes 5557 ;; 5558 darwin*) 5559 echo "osx" 5560 _dialogs=yes 5561 ;; 5562 *) 5563 echo "no" 5564 _dialogs=no 5565 ;; 5566 esac 5567fi 5568define_in_config_if_yes $_dialogs 'USE_SYSDIALOGS' 5569 5570# 5571# Check whether to build TTS integration support 5572# 5573echo_n "Building text-to-speech support... " 5574if test "$_tts" = "no"; then 5575 echo "no" 5576else 5577 case $_host_os in 5578 linux*) 5579 echo "linux" 5580 _tts=yes 5581 define_in_config_if_yes $_tts 'USE_SPEECH_DISPATCHER' 5582 append_var LIBS '-lspeechd -lpthread' 5583 ;; 5584 mingw*) 5585 echo "win32" 5586 _tts=yes 5587 append_var LIBS '-lsapi -lole32' 5588 ;; 5589 darwin*) 5590 echo "osx" 5591 _tts=yes 5592 ;; 5593 *) 5594 echo "no" 5595 _tts=no 5596 ;; 5597 esac 5598fi 5599define_in_config_if_yes $_tts 'USE_TTS' 5600 5601# 5602# Check whether to build Bink video support 5603# 5604echo_n "Building Bink video support... " 5605define_in_config_if_yes $_bink 'USE_BINK' 5606echo "$_bink" 5607 5608# 5609# Check whether to build updates support 5610# 5611echo_n "Building updates support... " 5612if test "$_updates" = yes; then 5613 if test "$_sparkle" = yes; then 5614 echo "Sparkle" 5615 else 5616 _updates=no; 5617 echo "$_updates" 5618 fi 5619else 5620 echo "$_updates" 5621fi 5622define_in_config_if_yes $_updates 'USE_UPDATES' 5623 5624# 5625# Figure out installation directories 5626# 5627test "x$prefix" = xNONE && prefix=/usr/local 5628test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' 5629 5630case $_host_os in 5631 mingw*) 5632 # Windows stores all the external data files in executable file. 5633 ;; 5634 *) 5635 append_var DEFINES "-DDATA_PATH=\\\"$datadir\\\"" 5636 ;; 5637esac 5638 5639case $_backend in 5640 3ds) 5641 append_var DEFINES "-DPLUGIN_DIRECTORY=\\\"$datadir/plugins\\\"" 5642 ;; 5643 openpandora) 5644 # Add ../plugins as a path so plugins can be found when running from a .PND. 5645 append_var DEFINES "-DPLUGIN_DIRECTORY=\\\"../plugins\\\"" 5646 ;; 5647 maemo | webos) 5648 # The WebOS and Maemo apps want the plugins in the "lib" directory 5649 # without a scummvm sub directory. 5650 append_var DEFINES "-DPLUGIN_DIRECTORY=\\\"$libdir\\\"" 5651 ;; 5652 ps2) 5653 # PS2 bogus dir: it actually depends on launch medium 5654 append_var DEFINES "-DPLUGIN_DIRECTORY=\\\"host:plugins\\\"" 5655 ;; 5656 *) 5657 append_var DEFINES "-DPLUGIN_DIRECTORY=\\\"$libdir/scummvm\\\"" 5658 ;; 5659esac 5660 5661# 5662# Set variables for profiling. 5663# We need to do it here to prevent mess-ups with the tests e.g. on the PSP 5664# 5665if test "$_enable_prof" = yes ; then 5666 append_var CXXFLAGS "-pg" 5667 append_var LDFLAGS "-pg" 5668 append_var DEFINES "-DENABLE_PROFILING" 5669fi 5670 5671echo_n "Backend... " 5672echo_n "$_backend" 5673 5674if test "$_backend" = "sdl" -a -n "$_sdlversion"; then 5675 echo_n " ($_sdlversion)" 5676fi 5677 5678if test "$_nasm" = yes ; then 5679 echo_n ", assembly routines" 5680fi 5681 5682if test "$_16bit" = yes ; then 5683 echo_n ", 16bit color" 5684fi 5685 5686if test "$_highres" = yes ; then 5687 echo_n ", high resolution" 5688fi 5689 5690if test "$_savegame_timestamp" = yes ; then 5691 echo_n ", savegame timestamp" 5692fi 5693 5694if test "$_build_scalers" = yes ; then 5695 if test "$_build_hq_scalers" = yes ; then 5696 echo_n ", HQ scalers" 5697 else 5698 echo_n ", scalers" 5699 fi 5700fi 5701 5702if test "$_mt32emu" = yes ; then 5703 echo_n ", MT-32 emulator" 5704fi 5705 5706if test "$_lua" = yes ; then 5707 echo_n ", Lua" 5708fi 5709 5710if test "$_nuked_opl" = yes ; then 5711 echo_n ", Nuked OPL emulator" 5712fi 5713 5714if test "$_text_console" = yes ; then 5715 echo_n ", text console" 5716fi 5717 5718if test "$_vkeybd" = yes ; then 5719 echo_n ", virtual keyboard" 5720fi 5721 5722if test "$_keymapper" = yes ; then 5723 echo_n ", keymapper" 5724fi 5725 5726if test "$_eventrec" = yes ; then 5727 echo_n ", event recorder" 5728fi 5729 5730if test "$_cloud" = yes ; then 5731 echo ", cloud" 5732else 5733 echo 5734fi 5735 5736# 5737# Some last-minute backend specific stuff, executed 5738# after all of CXXFLAGS, LDFLAGS, LIBS etc. have been setup 5739# 5740case $_backend in 5741 3ds) 5742 if test "$_freetype2" = yes -a "$_png" = yes; then 5743 append_var LIBS "-lbz2" 5744 append_var LIBS "-lpng" 5745 fi 5746 if test "$_tremor" = yes -o "$_flac" = yes; then 5747 append_var LIBS "-logg" 5748 fi 5749 ;; 5750 android) 5751 # ssp at this point so the cxxtests link 5752 if test "$_debug_build" = yes; then 5753 append_var CXXFLAGS "-fstack-protector" 5754 else 5755 append_var CXXFLAGS "-fno-stack-protector" 5756 fi 5757 5758 static_libs='' 5759 system_libs='' 5760 for lib in $LIBS; do 5761 case $lib in 5762 -lz|-lm|-ldl) 5763 system_libs="$system_libs $lib" 5764 ;; 5765 *) 5766 static_libs="$static_libs $lib" 5767 ;; 5768 esac 5769 done 5770 5771 # -lgcc is carefully placed here - we want to catch 5772 # all toolchain symbols in *our* libraries rather 5773 # than pick up anything unhygenic from the Android libs. 5774 LIBS="-Wl,-Bstatic $static_libs -Wl,-Bdynamic -lgcc $system_libs -llog -landroid -lGLESv1_CM" 5775 ;; 5776 n64) 5777 # Move some libs down here, otherwise some symbols requires by libvorbis aren't found 5778 # during linking stage 5779 append_var LIBS "-lc -lgcc -lnosys" 5780 ;; 5781esac 5782 5783 5784# 5785# Engine selection 5786# 5787_engines_built_static="" 5788_engines_built_dynamic="" 5789_engines_skipped="" 5790 5791# Show a message if looping over engines takes longer than 5 secs 5792sh -c " 5793 touch config.gnomes 5794 sleep 5 5795 if test -f config.gnomes; then 5796 printf 'Employing little gnomes...' 5797 rm -f config.gnomes 5798 fi" 2>/dev/null & 5799 5800for engine in $_engines; do 5801 # Check whether all dependencies are available 5802 check_engine_deps $engine 5803 5804 if test "`get_engine_sub $engine`" = "no" ; then 5805 # It's a main engine 5806 if test `get_engine_build $engine` = no ; then 5807 isbuilt=no 5808 else 5809 # If dynamic plugins aren't supported, mark 5810 # all the engines as static 5811 if test $_dynamic_modules = no ; then 5812 set_var _engine_${engine}_build "static" 5813 else 5814 # If it wasn't explicitly marked as static or 5815 # dynamic, use the configured default 5816 if test `get_engine_build $engine` = yes ; then 5817 set_var _engine_${engine}_build "${_plugins_default}" 5818 fi 5819 fi 5820 5821 # Prepare the defines 5822 if test `get_engine_build $engine` = dynamic ; then 5823 isbuilt=DYNAMIC_PLUGIN 5824 else 5825 set_var _engine_${engine}_build "static" 5826 isbuilt=STATIC_PLUGIN 5827 fi 5828 fi 5829 else 5830 # It's a subengine, just say yes or no 5831 if test "`get_engine_build $engine`" = "no" ; then 5832 isbuilt=no 5833 else 5834 isbuilt=1 5835 fi 5836 fi 5837 5838 # Save the settings 5839 defname="ENABLE_`echo $engine | tr '[a-z]' '[A-Z]'`" 5840 if test "$isbuilt" = "no" ; then 5841 add_line_to_config_mk "# $defname" 5842 else 5843 add_line_to_config_mk "$defname = $isbuilt" 5844 fi 5845done 5846 5847# Sort engines to place our headline engine at start... 5848# No technical reason, just historical convention 5849headline_engine=scumm 5850_sorted_engines="${headline_engine}" 5851for engine in $_engines; do 5852 if test "${engine}" != "${headline_engine}" ; then 5853 _sorted_engines="${_sorted_engines} ${engine}" 5854 fi 5855done 5856 5857# Prepare the information to be shown 5858for engine in $_sorted_engines; do 5859 if test "`get_engine_sub $engine`" = "no" ; then 5860 # It's a main engine 5861 prepare_engine_build_strings $engine 5862 fi 5863done 5864 5865# 5866# Detection of WIP/unstable engines 5867# 5868for engine in $_engines; do 5869 engine_build=`get_engine_build $engine` 5870 engine_build_default=`get_engine_build_default $engine` 5871 if test $engine_build != no -a $engine_build_default = no ; then 5872 set_var _tainted_build "yes" 5873 fi 5874done 5875 5876add_to_config_h_if_yes `get_var _tainted_build` '#define TAINTED_BUILD' 5877 5878# Complete the message on slow systems 5879if test -f config.gnomes ; then 5880 # Kill does not work well here as it produces nasty 'Killed' message 5881 rm -rf config.gnomes 5882else 5883 echo " work is done" 5884fi 5885 5886# 5887# Show which engines ("frontends") are to be built 5888# 5889echo 5890if test -n "$_engines_built_static" ; then 5891 echo "Engines (builtin):" 5892 echo "$_engines_built_static" | sed 's/@/\ 5893/g 5894s/#/ /g' 5895fi 5896 5897if test -n "$_engines_built_dynamic" ; then 5898 echo "Engines (plugins):" 5899 echo "$_engines_built_dynamic" | sed 's/@/\ 5900/g 5901s/#/ /g' 5902fi 5903 5904if test -n "$_engines_skipped" ; then 5905 echo "Engines Skipped:" 5906 echo "$_engines_skipped" | sed 's/@/\ 5907/g 5908s/#/ /g' 5909fi 5910 5911if test -n "$_engines_built_wip" ; then 5912 echo "WARNING: This ScummVM build contains the following UNSTABLE engines:" 5913 echo "$_engines_built_wip" | sed 's/@/\ 5914/g 5915s/#/ /g' 5916fi 5917 5918echo 5919echo "Creating config.h" 5920cat > config.h << EOF 5921/* This file is automatically generated by configure */ 5922/* DO NOT EDIT MANUALLY */ 5923 5924#ifndef CONFIG_H 5925#define CONFIG_H 5926 5927$_config_h_data 5928 5929/* Data types */ 5930#ifndef SCUMMVM_DONT_DEFINE_TYPES 5931typedef unsigned $type_1_byte byte; 5932typedef unsigned int uint; 5933typedef unsigned $type_1_byte uint8; 5934typedef unsigned $type_2_byte uint16; 5935typedef unsigned $type_4_byte uint32; 5936typedef unsigned $type_8_byte uint64; 5937typedef signed $type_1_byte int8; 5938typedef signed $type_2_byte int16; 5939typedef signed $type_4_byte int32; 5940typedef signed $type_8_byte int64; 5941#endif 5942 5943typedef $type_ptr uintptr; 5944 5945#if defined(__APPLE__) && !defined(__ppc__) 5946#ifndef _UINT64 5947#define _UINT64 5948#endif 5949#endif 5950 5951#endif /* CONFIG_H */ 5952EOF 5953 5954echo "Creating config.mk" 5955cat > config.mk << EOF 5956# -------- Generated by configure ----------- 5957 5958CXX := $CXX 5959CXXFLAGS := $CXXFLAGS 5960LD := $LD 5961LIBS += $LIBS 5962RANLIB := $_ranlib 5963STRIP := $_strip 5964AR := $_ar 5965AS := $_as 5966ASFLAGS := $ASFLAGS 5967DWP := $_dwp 5968WINDRES := $_windres 5969WINDRESFLAGS := $WINDRESFLAGS 5970STAGINGPATH=$_stagingpath 5971WIN32PATH=$_win32path 5972AMIGAOSPATH=$_amigaospath 5973STATICLIBPATH=$_staticlibpath 5974XCODETOOLSPATH=$_xcodetoolspath 5975SPARKLEPATH=$_sparklepath 5976SDLCONFIG=$_sdlconfig 5977 5978ABI := $ABI 5979 5980BACKEND := $_backend 5981MODULES += $MODULES 5982MODULE_DIRS += $MODULE_DIRS 5983EXEPRE := $HOSTEXEPRE 5984EXEEXT := $HOSTEXEEXT 5985NASM := $NASM 5986NASMFLAGS := $NASMFLAGS 5987PANDOC := $PANDOC 5988PANDOCFORMAT := $_pandocformat 5989PANDOCEXT := $_pandocext 5990ZLIB_LIBS := $ZLIB_LIBS 5991ZLIB_CFLAGS := $ZLIB_CFLAGS 5992 5993prefix = $prefix 5994exec_prefix = $exec_prefix 5995bindir = $bindir 5996libdir = $libdir 5997datarootdir = $datarootdir 5998datadir = $datadir 5999mandir = $mandir 6000docdir = $docdir 6001 6002$_config_mk_data 6003 6004INCLUDES += $INCLUDES 6005OBJS += $OBJS 6006DEFINES += $DEFINES 6007LDFLAGS += $LDFLAGS 6008 6009$_mak_plugins 6010 6011port_mk = $_port_mk 6012 6013SAVED_CONFIGFLAGS := $SAVED_CONFIGFLAGS 6014SAVED_AR := $SAVED_AR 6015SAVED_AS := $SAVED_AS 6016SAVED_ASFLAGS := $SAVED_ASFLAGS 6017SAVED_CPPFLAGS := $SAVED_CPPFLAGS 6018SAVED_CXX := $SAVED_CXX 6019SAVED_CXXFLAGS := $SAVED_CXXFLAGS 6020SAVED_DWP := $SAVED_DWP 6021SAVED_LD := $SAVED_LD 6022SAVED_LDFLAGS := $SAVED_LDFLAGS 6023SAVED_PKG_CONFIG_LIBDIR := $SAVED_PKG_CONFIG_LIBDIR 6024SAVED_RANLIB := $SAVED_RANLIB 6025SAVED_SDL_CONFIG := $SAVED_SDL_CONFIG 6026SAVED_STRIP := $SAVED_STRIP 6027SAVED_WINDRES := $SAVED_WINDRES 6028SAVED_WINDRESFLAGS := $SAVED_WINDRESFLAGS 6029EOF 6030 6031# 6032# Create a custom Makefile when building outside the source tree 6033# TODO: Add a better check than just looking for 'Makefile' 6034# 6035if test ! -f Makefile.common ; then 6036echo "Creating Makefile" 6037 6038cat > Makefile << EOF 6039# -------- Generated by configure ----------- 6040srcdir = $_srcdir 6041vpath %.h \$(srcdir) 6042vpath %.cpp \$(srcdir) 6043vpath %.c \$(srcdir) 6044vpath %.m \$(srcdir) 6045vpath %.mm \$(srcdir) 6046vpath %.asm \$(srcdir) 6047vpath %.s \$(srcdir) 6048vpath %.S \$(srcdir) 6049vpath %.rc \$(srcdir) 6050vpath %.md \$(srcdir) 6051include \$(srcdir)/Makefile 6052EOF 6053 6054fi 6055 6056# Ensure engines folder exists prior to trying to generate 6057# files into it (used for out-of-tree-builds) 6058mkdir -p engines 6059 6060echo "Creating engines/engines.mk" 6061cat > engines/engines.mk << EOF 6062# This file is automatically generated by configure 6063# DO NOT EDIT MANUALLY 6064# This file is being included by "Makefile.common" 6065EOF 6066 6067for engine in $_sorted_engines; do 6068 j=`echo $engine | tr '[:lower:]' '[:upper:]'` 6069 if test "`get_engine_sub $engine`" = "no" ; then 6070 # main engine 6071 cat >> engines/engines.mk << EOF 6072 6073ifdef ENABLE_$j 6074DEFINES += -DENABLE_$j=\$(ENABLE_$j) 6075MODULES += engines/$engine 6076EOF 6077 6078 for subeng in `get_engine_subengines $engine` ; do 6079 k=`echo $subeng | tr '[:lower:]' '[:upper:]'` 6080 cat >> engines/engines.mk << EOF 6081 6082ifdef ENABLE_$k 6083DEFINES += -DENABLE_$k 6084endif 6085EOF 6086 done 6087 6088 cat >> engines/engines.mk << EOF 6089endif 6090EOF 6091 fi 6092done 6093 6094echo "Creating engines/plugins_table.h" 6095cat > engines/plugins_table.h << EOF 6096/* This file is automatically generated by configure */ 6097/* DO NOT EDIT MANUALLY */ 6098// This file is being included by "base/plugins.cpp" 6099EOF 6100 6101for engine in $_sorted_engines; do 6102 if test "`get_engine_sub $engine`" = "no" ; then 6103 j=`echo $engine | tr '[:lower:]' '[:upper:]'` 6104 cat >> engines/plugins_table.h << EOF 6105#if PLUGIN_ENABLED_STATIC($j) 6106LINK_PLUGIN($j) 6107#endif 6108EOF 6109 fi 6110done 6111