1#!/bin/sh 2# 3# configure -- custom configure script for the ScummVM tools. 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# Save the current environment variables for next runs 25SAVED_CONFIGFLAGS=$@ 26SAVED_LDFLAGS=$LDFLAGS 27SAVED_PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-unset} 28SAVED_CXX=$CXX 29SAVED_CXXFLAGS=$CXXFLAGS 30SAVED_CPPFLAGS=$CPPFLAGS 31SAVED_ASFLAGS=$ASFLAGS 32SAVED_WINDRESFLAGS=$WINDRESFLAGS 33 34# Use environment vars if set 35CXXFLAGS="$CXXFLAGS $CPPFLAGS" 36 37# Backslashes into forward slashes: 38# The following OS/2 specific code is performed to deal with handling of backslashes by ksh. 39# Borrowed from the Sane configure script 40 41if test "$ac_emxsupport" != "no" -a "$ac_emxsupport" != "NO"; then 42 ac_save_IFS="$IFS" 43 IFS="\\" 44 ac_TEMP_PATH= 45 for ac_dir in $PATH; do 46 IFS=$ac_save_IFS 47 if test -z "$ac_TEMP_PATH"; then 48 ac_TEMP_PATH="$ac_dir" 49 else 50 ac_TEMP_PATH="$ac_TEMP_PATH/$ac_dir" 51 fi 52 done 53 PATH="$ac_TEMP_PATH" 54 export PATH 55 unset ac_TEMP_PATH 56fi 57 58set_var() { 59 eval ${1}='${2}' 60} 61 62get_var() { 63 eval echo \$${1} 64} 65 66_srcdir=`dirname $0` 67 68# 69# Default settings 70# 71# Default lib behavior yes/no/auto 72_vorbis=auto 73_tremor=auto 74_flac=auto 75_mad=auto 76_zlib=auto 77_png=auto 78_freetype2=auto 79_wxwidgets=auto 80_iconv=auto 81_boost=auto 82_endian=unknown 83_need_memalign=no 84# Default option behavior yes/no 85_debug_build=auto 86_release_build=auto 87_verbose_build=no 88_enable_prof=no 89_use_cxx11=yes 90# Default commands 91_ranlib=ranlib 92_strip=strip 93_ar="ar cru" 94_as="as" 95_windres=windres 96_pkgconfig=pkg-config 97_wxconfig=wxgtk2u-2.8-config 98_wxpath="$PATH" 99_prefix=/usr/local 100_wxincludes="" 101_wxlibs="" 102_wxstaticlibs="" 103_freetypeconfig=freetype-config 104_freetype_found="false" 105_freetypepath="$PATH" 106_staticlibpath="" 107_xcodetoolspath="" 108_amigaospath="install" 109_morphospath="PROGDIR:" 110# For cross compiling 111_host="" 112_host_cpu="" 113_host_vendor="" 114_host_os="" 115_host_alias="" 116 117# Use temp files in the build directory 118TMPO=./scummvm-tools-conf 119TMPC=${TMPO}.cpp 120TMPLOG=config.log 121 122cc_check_no_clean() { 123 echo >> "$TMPLOG" 124 cat "$TMPC" >> "$TMPLOG" 125 echo >> "$TMPLOG" 126 echo "$CXX $LDFLAGS $CXXFLAGS $TMPC -o $TMPO$HOSTEXEEXT $@" >> "$TMPLOG" 127 rm -f "$TMPO$HOSTEXEEXT" 128 ( $CXX $LDFLAGS $CXXFLAGS "$TMPC" -o "$TMPO$HOSTEXEEXT" "$@" ) >> "$TMPLOG" 2>&1 129 TMPR="$?" 130 echo "return code: $TMPR" >> "$TMPLOG" 131 echo >> "$TMPLOG" 132 return "$TMPR" 133} 134 135cc_check_clean() { 136 rm -rf $TMPC $TMPO $TMPO.o $TMPO.dSYM $TMPO$HOSTEXEEXT "$@" 137} 138 139cc_check() { 140 cc_check_no_clean "$@" 141 TMPR="$?" 142 cc_check_clean 143 return "$TMPR" 144} 145 146cc_check_define() { 147cat > $TMPC << EOF 148int main(void) { 149 #ifndef $1 150 syntax error 151 #endif 152 return 0; 153} 154EOF 155 cc_check -c 156 return $? 157} 158 159gcc_get_define() { 160 echo "" | $CXX -dM -E - | fgrep "$1" | head -n1 | cut -d ' ' -f 3- 161} 162 163# 164# Function to provide echo -n for bourne shells that don't have it 165# 166echo_n() { 167 printf "$@" 168} 169 170echocheck() { 171 echo_n "Checking for $@... " 172} 173 174# Add a line of data to config.mk. 175add_line_to_config_mk() { 176 _config_mk_data="$_config_mk_data"' 177'"$1" 178} 179 180# Add a line of data to config.h. 181add_line_to_config_h() { 182 _config_h_data="$_config_h_data"' 183'"$1" 184} 185 186# Conditionally add a line of data to config.h. Takes two parameters: 187# The first one can be set to 'no' to "comment out" the line, i.e. 188# make it ineffective, use 'yes' otherwise. 189# The second param is the line to insert. 190add_to_config_h_if_yes() { 191 if test "$1" = yes ; then 192 add_line_to_config_h "$2" 193 else 194 add_line_to_config_h "/* $2 */" 195 fi 196} 197 198# Conditionally add a line of data to config.mk. Takes two parameters: 199# The first one can be set to 'no' to "comment out" the line, i.e. 200# make it ineffective, use 'yes' otherwise. 201# The second param is the line to insert. 202add_to_config_mk_if_yes() { 203 if test "$1" = yes ; then 204 add_line_to_config_mk "$2" 205 else 206 add_line_to_config_mk "# $2" 207 fi 208} 209 210# Conditionally add a '#define' line to config.h. Takes two parameters: 211# The first one can be set to 'yes' or 'no'. If 'yes' is used, then 212# the line "#define $2" is added to config.h, otherwise "#undef $2". 213define_in_config_h_if_yes() { 214 if test "$1" = yes ; then 215 add_line_to_config_h "#define $2" 216 else 217 add_line_to_config_h "#undef $2" 218 fi 219} 220 221# Conditionally add definitions to config.h and config.mk. Takes two parameters: 222# The first one can be set to 'yes' or 'no'. If 'yes' is used, then 223# the line "#define $2" is added to config.h and "$2 = 1" to config.mk. 224# Otherwise "#undef $2" is added to config.h and "# $2 = 1" to config.mk 225define_in_config_if_yes() { 226 if test "$1" = yes ; then 227 add_line_to_config_h "#define $2" 228 add_line_to_config_mk "$2 = 1" 229 else 230 add_line_to_config_h "#undef $2" 231 add_line_to_config_mk "# $2 = 1" 232 fi 233} 234 235# 236# Determine wx-config 237# 238# TODO: small bit of code to test wxWidgets usability 239find_wxconfig() { 240 echo_n "Looking for wx-config... " 241 wxconfigs="$_wxconfig:wxgtk2-2.8-config" 242 _wxconfig= 243 244 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$SEPARATOR" 245 for path_dir in $_wxpath; do 246 #reset separator to parse wxconfigs 247 IFS=":" 248 for wxconfig in $wxconfigs; do 249 if test -f "$path_dir/$wxconfig" ; then 250 _wxconfig="$path_dir/$wxconfig" 251 echo $_wxconfig 252 # Save the prefix 253 _wxpath=$path_dir 254 if test `basename $path_dir` = bin ; then 255 _wxpath=`dirname $path_dir` 256 fi 257 # break at first wx-config found in path 258 break 2 259 fi 260 done 261 done 262 263 IFS="$ac_save_ifs" 264 265 if test -z "$_wxconfig"; then 266 echo "none found!" 267 fi 268} 269 270# 271# Determine freetype-config 272# 273find_freetypeconfig() { 274 echo_n "Looking for freetype-config... " 275 freetypeconfigs="$_freetypeconfig" 276 _freetypeconfig= 277 278 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$SEPARATOR" 279 for path_dir in $_freetypepath; do 280 #reset separator to parse freetypeconfigs 281 IFS=":" 282 for freetypeconfig in $freetypeconfigs; do 283 if test -f "$path_dir/$freetypeconfig" ; then 284 _freetypeconfig="$path_dir/$freetypeconfig" 285 echo $_freetypeconfig 286 # Save the prefix 287 _freetypepath=$path_dir 288 if test `basename $path_dir` = bin ; then 289 _freetypepath=`dirname $path_dir` 290 fi 291 # break at first freetype-config found in path 292 break 2 293 fi 294 done 295 done 296 297 IFS="$ac_save_ifs" 298 299 if test -z "$_freetypeconfig"; then 300 echo "none found!" 301 fi 302} 303 304# 305# Determine extension used for executables 306# 307get_system_exe_extension() { 308 case $1 in 309 riscos) 310 _exeext=",e1f" 311 ;; 312 dreamcast | ds | gamecube | n64 | ps2 | psp | wii) 313 _exeext=".elf" 314 ;; 315 gph-linux) 316 _exeext=".gph" 317 ;; 318 mingw* | *os2-emx | wince) 319 _exeext=".exe" 320 ;; 321 *) 322 _exeext="" 323 ;; 324 esac 325} 326 327# 328# Generic options functions 329# 330 331# Show the configure help line for an option 332option_help() { 333 tmpopt=`echo $1 | sed 's/_/-/g'` 334 option=`echo "--${tmpopt} " | sed "s/\(.\{23\}\).*/\1/"` 335 echo " ${option} ${2}" 336} 337 338# Show an error about an unknown option 339option_error() { 340 echo "error: unrecognized option: $ac_option 341Try \`$0 --help' for more information." >&2 342 exit 1 343} 344 345 346# 347# Greet user 348# 349echo "Running ScummVM Tools configure..." 350echo "Configure run on" `date` > $TMPLOG 351 352# 353# Check any parameters we received 354# 355 356for parm in "$@" ; do 357 if test "$parm" = "--help" || test "$parm" = "-help" || test "$parm" = "-h" ; then 358 cat << EOF 359 360Usage: $0 [OPTIONS]... 361 362Configuration: 363 -h, --help display this help and exit 364 365Installation directories: 366 --prefix=DIR use this prefix for installing the ScummVM Tools [/usr/local] 367 --bindir=DIR directory to install the tool binaries in [PREFIX/bin] 368 --datadir=DIR directory to install the GUI tool media files in [PREFIX/share] 369 --mandir=DIR directory to install the manpage in [PREFIX/share/man] 370 --libdir=DIR directory to install the plugins in [PREFIX/lib] 371 372Special configuration feature: 373 --host=HOST cross-compile to target HOST (arm-linux, ...) 374 375Optional Features: 376 --disable-c++11 disable building as C++11 when the compiler allows that 377 --disable-debug disable building with debugging symbols 378 --enable-Werror treat warnings as errors 379 --enable-profiling enable profiling 380 --enable-verbose-build enable regular echoing of commands during build 381 process 382 383Optional Libraries: 384 --with-ogg-prefix=DIR Prefix where libogg is installed (optional) 385 --with-vorbis-prefix=DIR Prefix where libvorbis is installed (optional) 386 --disable-vorbis disable Ogg Vorbis support [autodetect] 387 388 --with-tremor-prefix=DIR Prefix where tremor is installed (optional) 389 --disable-tremor disable tremor support [autodetect] 390 391 --with-mad-prefix=DIR Prefix where libmad is installed (optional) 392 --disable-mad disable libmad (MP3) support [autodetect] 393 394 --with-flac-prefix=DIR Prefix where libFLAC is installed (optional) 395 --disable-flac disable FLAC support [autodetect] 396 397 --with-zlib-prefix=DIR Prefix where zlib is installed (optional) 398 --disable-zlib disable zlib (compression) support [autodetect] 399 400 --with-png-prefix=DIR Prefix where libpng is installed (optional) 401 --disable-png disable libpng (compression) support [autodetect] 402 403 --with-freetype2-prefix=DIR prefix where the freetype-config script is 404 installed (optional) 405 --disable-freetype2 disable freetype2 TTF library usage [autodetect] 406 407 --with-wx-prefix=DIR Prefix where wxwidgets is installed (optional) 408 --disable-wxwidgets disable wxwidgets (GUI) support [autodetect] 409 410 --disable-iconv disable iconv (Japanese font) support [autodetect] 411 412 --with-boost-prefix=DIR Prefix where Boost is installed (optional) 413 --disable-boost disable Boost support [autodetect] 414 415Some influential environment variables: 416 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a 417 nonstandard directory <lib dir> 418 CXX C++ compiler command 419 CXXFLAGS C++ compiler flags 420 CONFIGURE_NO_HOST Ignore the cross-compile target set by the --host= option 421 CPPFLAGS C++ preprocessor flags, e.g. -I<include dir> if you have 422 headers in a nonstandard directory <include dir> 423 PKG_CONFIG_LIBDIR list of directories where pkg-config ‘.pc’ files are 424 looked up 425 426EOF 427 exit 0 428 fi 429done # for parm in ... 430 431for ac_option in $@; do 432 case "$ac_option" in 433 # Silently ignore options valid for Autotools configure. 434 --build=*) ;; 435 --exec-prefix=*) ;; 436 --program-prefix=*) ;; 437 --sbindir=*) ;; 438 --sysconfdir=*) ;; 439 --includedir=*) ;; 440 --libexecdir=*) ;; 441 --localstatedir=*) ;; 442 --sharedstatedir=*) ;; 443 --infodir=*) ;; 444 --disable-dependency-tracking) ;; 445 --enable-dependency-tracking) ;; 446 # End of ignored options. 447 --enable-vorbis) _vorbis=yes ;; 448 --disable-vorbis) _vorbis=no ;; 449 --enable-tremor) _tremor=yes ;; 450 --disable-tremor) _tremor=no ;; 451 --enable-flac) _flac=yes ;; 452 --disable-flac) _flac=no ;; 453 --enable-mad) _mad=yes ;; 454 --disable-mad) _mad=no ;; 455 --enable-zlib) _zlib=yes ;; 456 --disable-zlib) _zlib=no ;; 457 --enable-png) _png=yes ;; 458 --disable-png) _png=no ;; 459 --enable-freetype2) _freetype2=yes ;; 460 --disable-freetype2) _freetype2=no ;; 461 --enable-wxwidgets) _wxwidgets=yes ;; 462 --disable-wxwidgets) _wxwidgets=no ;; 463 --enable-iconv) _iconv=yes ;; 464 --disable-iconv) _iconv=no ;; 465 --enable-boost) _boost=yes ;; 466 --disable-boost) _boost=no ;; 467 --enable-verbose-build) _verbose_build=yes ;; 468 --with-ogg-prefix=*) 469 arg=`echo $ac_option | cut -d '=' -f 2` 470 OGG_CFLAGS="-I$arg/include" 471 OGG_LIBS="-L$arg/lib" 472 ;; 473 --with-vorbis-prefix=*) 474 arg=`echo $ac_option | cut -d '=' -f 2` 475 VORBIS_CFLAGS="-I$arg/include" 476 VORBIS_LIBS="-L$arg/lib" 477 ;; 478 --with-tremor-prefix=*) 479 arg=`echo $ac_option | cut -d '=' -f 2` 480 TREMOR_CFLAGS="-I$arg/include" 481 TREMOR_LIBS="-L$arg/lib" 482 ;; 483 --with-flac-prefix=*) 484 arg=`echo $ac_option | cut -d '=' -f 2` 485 FLAC_CFLAGS="-I$arg/include" 486 FLAC_LIBS="-L$arg/lib" 487 ;; 488 --with-mad-prefix=*) 489 arg=`echo $ac_option | cut -d '=' -f 2` 490 MAD_CFLAGS="-I$arg/include" 491 MAD_LIBS="-L$arg/lib" 492 ;; 493 --with-zlib-prefix=*) 494 arg=`echo $ac_option | cut -d '=' -f 2` 495 ZLIB_CFLAGS="-I$arg/include" 496 ZLIB_LIBS="-L$arg/lib" 497 ;; 498 --with-png-prefix=*) 499 arg=`echo $ac_option | cut -d '=' -f 2` 500 PNG_CFLAGS="-I$arg/include" 501 PNG_LIBS="-L$arg/lib" 502 ;; 503 --with-freetype2-prefix=*) 504 arg=`echo $ac_option | cut -d '=' -f 2` 505 _freetypepath="$arg:$arg/bin" 506 ;; 507 --with-wx-prefix=*) 508 arg=`echo $ac_option | cut -d '=' -f 2` 509 _wxpath="$arg:$arg/bin" 510 ;; 511 --with-boost-prefix=*) 512 arg=`echo $ac_option | cut -d '=' -f 2` 513 BOOST_CFLAGS="-I$arg/include" 514 BOOST_LIBS="-L$arg/lib" 515 ;; 516 --with-staticlib-prefix=*) 517 _staticlibpath=`echo $ac_option | cut -d '=' -f 2` 518 ;; 519 --with-xcodetools-path=*) 520 _xcodetoolspath=`echo $ac_option | cut -d '=' -f 2` 521 ;; 522 --enable-debug) 523 _debug_build=yes 524 ;; 525 --disable-debug) 526 _debug_build=no 527 ;; 528 --enable-c++11) 529 _use_cxx11=yes 530 ;; 531 --disable-c++11) 532 _use_cxx11=no 533 ;; 534 --enable-Werror) 535 CXXFLAGS="$CXXFLAGS -Werror" 536 ;; 537 --enable-release) 538 _release_build=yes 539 ;; 540 --disable-release) 541 _release_build=no 542 ;; 543 --enable-profiling) 544 _enable_prof=yes 545 ;; 546 --host=*) 547 if test -z "$CONFIGURE_NO_HOST"; then 548 _host=`echo $ac_option | cut -d '=' -f 2` 549 else 550 echo "Ignoring --host option!" >&2 551 fi 552 ;; 553 --prefix=*) 554 _prefix=`echo $ac_option | cut -d '=' -f 2` 555 ;; 556 --bindir=*) 557 _bindir=`echo $ac_option | cut -d '=' -f 2` 558 ;; 559 --datadir=*) 560 _datadir=`echo $ac_option | cut -d '=' -f 2` 561 ;; 562 --mandir=*) 563 _mandir=`echo $ac_option | cut -d '=' -f 2` 564 ;; 565 --libdir=*) 566 _libdir=`echo $ac_option | cut -d '=' -f 2` 567 ;; 568 *) 569 option_error 570 ;; 571 esac; 572done; 573 574guessed_host=`$_srcdir/config.guess` 575get_system_exe_extension $guessed_host 576NATIVEEXEEXT=$_exeext 577 578case $_host in 579android | android-v7a) 580 _host_os=android 581 _host_cpu=arm 582 _host_alias=arm-linux-androideabi 583 ;; 584bada) 585 _host_os=bada 586 if test "$_debug_build" = yes; then 587 _host_cpu=i686 588 _host_alias=i686-mingw32 589 else 590 _host_cpu=arm 591 _host_alias=arm-samsung-nucleuseabi 592 fi 593 ;; 594caanoo) 595 _host_os=gph-linux 596 _host_cpu=arm 597 _host_alias=arm-none-linux-gnueabi 598 ;; 599dingux) 600 _host_os=linux 601 _host_cpu=mipsel 602 _host_alias=mipsel-linux 603 ;; 604dreamcast) 605 _host_os=dreamcast 606 _host_cpu=sh 607 _host_alias=sh-elf 608 CXXFLAGS="$CXXFLAGS -ml -m4-single-only" 609 LDFLAGS="$LDFLAGS -ml -m4-single-only" 610 ;; 611ds) 612 _host_os=ds 613 _host_cpu=arm 614 _host_alias=arm-eabi 615 ;; 616gamecube) 617 _host_os=gamecube 618 _host_cpu=ppc 619 _host_alias=powerpc-gekko 620 ;; 621gp2x) 622 _host_os=gph-linux 623 _host_cpu=arm 624 _host_alias=arm-open2x-linux 625 ;; 626gp2xwiz) 627 _host_os=gph-linux 628 _host_cpu=arm 629 _host_alias=arm-open2x-linux 630 ;; 631i586-mingw32msvc) 632 _host_os=mingw32msvc 633 _host_cpu=i586 634 ;; 635iphone) 636 _host_os=iphone 637 _host_cpu=arm 638 _host_alias=arm-apple-darwin9 639 ;; 640linupy) 641 _host_os=linux 642 _host_cpu=arm 643 ;; 644maemo) 645 _host_os=maemo 646 _host_cpu=arm 647 _host_alias=arm-linux 648 649 # The prefix is always the same on Maemo so we hardcode the default 650 # here. It is still possible to define a custom prefix which is 651 # needed when packaging the app with a user-specific app ID. 652 test "x$prefix" = xNONE && prefix=/opt/scummvm 653 # Maemo apps are installed into app-specific directories. The 654 # default directory structure of ScummVM makes no sense here so we 655 # hardcode Maemo specific directories here. 656 datarootdir='${prefix}/share' 657 datadir=/opt/scummvm/share 658 docdir='${datarootdir}/doc/scummvm' 659 ;; 660motoezx) 661 _host_os=linux 662 _host_cpu=arm 663 _host_alias=arm-linux-gnu 664 ;; 665motomagx) 666 _host_os=linux 667 _host_cpu=arm 668 _host_alias=arm-linux-gnueabi 669 ;; 670n64) 671 _host_os=n64 672 _host_cpu=mips 673 _host_alias=mips64 674 ;; 675neuros) 676 _host_os=linux 677 _host_cpu=arm 678 ;; 679openpandora) 680 _host_os=linux 681 _host_cpu=arm 682 _host_alias=arm-angstrom-linux-gnueabi 683 ;; 684ppc-amigaos) 685 _host_os=amigaos 686 _host_cpu=ppc 687 ;; 688ppc-morphos) 689 _host_os=morphos 690 _host_cpu=ppc 691 ;; 692ps2) 693 _host_os=ps2 694 _host_cpu=mips64r5900el 695 _host_alias=ee 696 ;; 697ps3) 698 _host_os=ps3 699 _host_cpu=ppc 700 _host_alias=powerpc64-ps3-elf 701 702 # The prefix is always the same on PS3 so we hardcode the default 703 # here. It is still possible to define a custom prefix which is 704 # needed when packaging the app with a user-specific app ID. 705 test "x$prefix" = xNONE && prefix=/dev_hdd0/game/SCUM12000/USRDIR 706 # PS3 apps are installed into app-specific directories. The 707 # default directory structure of ScummVM makes no sense here so we 708 # hardcode PS3 specific directories here. 709 datarootdir='${prefix}/data' 710 datadir='${datarootdir}' 711 docdir='${prefix}/doc' 712 ;; 713psp) 714 _host_os=psp 715 _host_cpu=mipsallegrexel 716 _host_alias=psp 717 ;; 718raspberrypi) 719 _host_os=linux 720 _host_cpu=arm 721 # This tuple is the one used by the official Rpi toolchain. 722 # It may change in the future. 723 _host_alias=arm-linux-gnueabihf 724 ;; 725samsungtv) 726 _host_os=linux 727 _host_cpu=arm 728 _host_alias=arm-linux-gnueabi 729 ;; 730webos) 731 _host_os=webos 732 _host_cpu=arm 733 _host_alias=arm-none-linux-gnueabi 734 # The prefix is always the same on WebOS so we hardcode the default 735 # here. It is still possible to define a custom prefix which is 736 # needed when packaging the app with a user-specific app ID. 737 test "x$prefix" = xNONE && prefix=/media/cryptofs/apps/usr/palm/applications/org.scummvm.scummvm 738 # WebOS apps are installed into app-specific directories. The 739 # default directory structure of ScummVM makes no sense here so we 740 # hardcode WebOS specific directories here. 741 datarootdir='${prefix}/data' 742 datadir='${datarootdir}' 743 docdir='${prefix}/doc' 744 ;; 745wii) 746 _host_os=wii 747 _host_cpu=ppc 748 _host_alias=powerpc-gekko 749 ;; 750wince) 751 _host_os=wince 752 _host_cpu=arm 753 _host_alias=arm-mingw32ce 754 ;; 755*) 756 if test -n "$_host"; then 757 guessed_host=`$_srcdir/config.sub $_host` 758 fi 759 _host_cpu=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` 760 _host_vendor=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` 761 _host_os=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` 762 ;; 763esac 764 765if test -z "$_host_alias"; then 766 _host_alias="$_host_cpu-$_host_os" 767else 768 # if _host_alias was set, default to the standard GNU tools 769 _ranlib=$_host_alias-ranlib 770 _strip=$_host_alias-strip 771 _ar="$_host_alias-ar cru" 772 _as="$_host_alias-as" 773 _windres=$_host_alias-windres 774fi 775 776# 777# Determine extra build flags for debug and/or release builds 778# 779 780if test "$_debug_build" != no; then 781 # debug mode not explicitly disabled -> compile with -g 782 CXXFLAGS="$CXXFLAGS -g" 783fi 784 785if test "$_release_build" = yes; then 786 # Release mode enabled: enable optimizations. This also 787 # makes it possible to use -Wuninitialized, so let's do that. 788 CXXFLAGS="$CXXFLAGS -O2" 789 CXXFLAGS="$CXXFLAGS -Wuninitialized" 790fi 791 792 793# 794# Determine extension used for executables 795# 796get_system_exe_extension $_host_os 797HOSTEXEEXT=$_exeext 798 799# 800# Determine separator used for $PATH 801# 802case $_host_os in 803os2-emx*) 804 SEPARATOR=";" 805 ;; 806*) 807 SEPARATOR=":" 808 ;; 809esac 810 811# 812# Determine the C++ compiler 813# 814echo_n "Looking for C++ compiler... " 815 816# Check whether the given command is a working C++ compiler 817test_compiler() { 818 cat > tmp_cxx_compiler.cpp << EOF 819 class Foo { int a; }; 820 int main(int argc, char **argv) { 821 Foo *a = new Foo(); delete a; return 0; 822 } 823EOF 824 825 echo "testing compiler: $1" >> "$TMPLOG" 826 827 if test -n "$_host"; then 828 # In cross-compiling mode, we cannot run the result 829 eval "$1 $CXXFLAGS $LDFLAGS -o $TMPO.o -c tmp_cxx_compiler.cpp" 2> /dev/null && cc_check_clean tmp_cxx_compiler.cpp 830 else 831 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 832 fi 833} 834 835# Prepare a list of candidates for the C++ compiler 836if test -n "$CXX" && test_compiler "$CXX"; then 837 # Use the compiler specified in CXX 838 echo $CXX 839else 840 if test -n "$_host"; then 841 compilers="$_host_alias-g++ $_host_alias-c++ $_host-g++ $_host-c++" 842 else 843 compilers="g++ c++ CC" 844 fi 845 846 # Iterate over all candidates, pick the first working one 847 CXX= 848 for compiler in $compilers; do 849 if test_compiler $compiler; then 850 echo "success testing compiler: $compiler" >> "$TMPLOG" 851 CXX=$compiler 852 echo $CXX 853 break 854 else 855 echo "failure testing compiler: $compiler" >> "$TMPLOG" 856 fi 857 done 858fi 859 860if test -z "$CXX"; then 861 echo "none found!" 862 exit 1 863fi 864 865# By default, use the C++ compiler as linker 866LD=$CXX 867 868# 869# Determine the compiler version 870# 871echocheck "compiler version" 872 873have_gcc=no 874cc_check_define __GNUC__ && have_gcc=yes 875 876if test "$have_gcc" = yes; then 877 add_line_to_config_mk 'HAVE_GCC = 1' 878 _cxx_major=`gcc_get_define __GNUC__` 879 _cxx_minor=`gcc_get_define __GNUC_MINOR__` 880 cxx_version="`( $CXX -dumpversion ) 2>&1`" 881 882 if test -n "`gcc_get_define __clang__`"; then 883 add_line_to_config_mk 'HAVE_CLANG = 1' 884 fi 885 886 if test "$_cxx_major" -eq 2 && test "$_cxx_minor" -ge 95 || \ 887 test "$_cxx_major" -gt 2 ; then 888 cxx_version="$cxx_version, ok" 889 cxx_verc_fail=no 890 else 891 cxx_version="$cxx_version, bad" 892 cxx_verc_fail=yes 893 fi 894else 895 # TODO: Big scary warning about unsupported compilers 896 cxx_version=`( $CXX -version ) 2>&1` 897 if test "$?" -eq 0; then 898 cxx_version="`echo "${cxx_version}" | sed -ne 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/gp'`" 899 if test -z "${cxx_version}"; then 900 cxx_version="not found" 901 cxx_verc_fail=yes 902 fi 903 else 904 cxx_version="not found" 905 cxx_verc_fail=yes 906 fi 907 908 case $_host_os in 909 irix*) 910 case $cxx_version in 911 7.4.4*) 912 # We just assume this is SGI MIPSpro 913 _cxx_major=7 914 _cxx_minor=4 915 cxx_verc_fail=no 916 add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MDupdate "$(*D)/$(DEPDIR)/$(*F).d"' 917 add_line_to_config_mk '-include Makedepend' 918 ;; 919 *) 920 cxx_version="$cxx_version, bad" 921 cxx_verc_fail=yes 922 ;; 923 esac 924 ;; 925 solaris*) 926 cxx_version=`( $CXX -V ) 2>&1` 927 cxx_version="`echo "${cxx_version}" | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`" 928 929 case $cxx_version in 930 5.1[0-2]) 931 cxx_verc_fail=no 932 ;; 933 *) 934 cxx_version="$cxx_version, bad" 935 cxx_verc_fail=yes 936 ;; 937 esac 938 ;; 939 *) 940 cxx_version="$cxx_version, bad" 941 cxx_verc_fail=yes 942 ;; 943 esac 944fi 945 946echo "$cxx_version" 947 948if test "$cxx_verc_fail" = yes ; then 949 echo 950 echo "The version of your compiler is not supported at this time" 951 echo "Please ensure you are using GCC >= 2.95" 952 exit 1 953else 954 echo found non-gcc compiler version ${cxx_version} 955fi 956 957# 958# Check whether the compiler supports C++11 959# 960have_cxx11=no 961cat > $TMPC << EOF 962int main(int argc, char *argv[]) { if (argv == nullptr) return -1; else return 0; } 963EOF 964cc_check -std=c++11 && have_cxx11=yes 965if test "$_use_cxx11" = "yes" ; then 966 _use_cxx11=$have_cxx11 967fi 968 969# 970# Setup compiler specific CXXFLAGS now that we know the compiler version. 971# Foremost, this means enabling various warnings. 972# In addition, we set CXX_UPDATE_DEP_FLAG for GCC >= 3.0 and for ICC. 973# 974if test "$have_gcc" = yes ; then 975 if test "$_cxx_major" -ge "3" ; then 976 # Try to use ANSI mode when C++11 is disabled. 977 if test "$_use_cxx11" = "no" ; then 978 case $_host_os in 979 # newlib-based system include files suppress non-C89 function 980 # declarations under __STRICT_ANSI__ 981 amigaos* | android | dreamcast | ds | gamecube | mingw* | morphos* |n64 | psp | ps2 | wii | wince ) 982 ;; 983 *) 984 CXXFLAGS="$CXXFLAGS -ansi" 985 ;; 986 esac 987 fi 988 CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter" 989 add_line_to_config_mk 'HAVE_GCC3 = 1' 990 add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP' 991 fi 992 993 if test "$_cxx_major" -eq 4 && test "$_cxx_minor" -ge 3 || \ 994 test "$_cxx_major" -gt 4 ; then 995 CXXFLAGS="$CXXFLAGS -Wno-empty-body" 996 else 997 CXXFLAGS="$CXXFLAGS -Wconversion" 998 fi 999fi 1000 1001echo_n "Building as C++11... " 1002if test "$_use_cxx11" = "yes" ; then 1003 case $_host_os in 1004 # newlib-based system include files suppress non-C89 function 1005 # declarations under __STRICT_ANSI__ 1006 amigaos* | android | dreamcast | ds | gamecube | mingw* | morphos* | n64 | psp | ps2 | wii | wince ) 1007 _use_cxx11=no 1008 ;; 1009 *) 1010 CXXFLAGS="$CXXFLAGS -std=c++11" 1011 ;; 1012 esac 1013fi 1014echo $_use_cxx11 1015 1016 1017# By default, we add -pedantic to the CXXFLAGS to catch some potentially 1018# non-portable constructs, like use of GNU extensions. 1019# However, some platforms use GNU extensions in system header files, so 1020# for these we must not use -pedantic. 1021case $_host_os in 1022android | gamecube | psp | wii) 1023 ;; 1024*) 1025 # ICC does not support pedantic, while GCC and clang do. 1026 if test "$have_icc" = no ; then 1027 CXXFLAGS="$CXXFLAGS -pedantic" 1028 fi 1029 ;; 1030esac 1031 1032if test -n "$STRINGS"; then 1033 _strings=$STRINGS 1034else 1035 echo_n "Checking for $_host_alias-strings... " >> "$TMPLOG" 1036 if `which $_host_alias-strings >/dev/null 2>&1`; then 1037 _strings=$_host_alias-strings 1038 echo yes >> "$TMPLOG" 1039 else 1040 _strings=strings 1041 echo no >> "$TMPLOG" 1042 fi 1043fi 1044 1045# 1046# Check for endianness 1047# 1048echo_n "Checking endianness... " 1049cat > tmp_endianness_check.cpp << EOF 1050unsigned short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; 1051unsigned short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; 1052void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; } 1053unsigned short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; 1054unsigned short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; 1055void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; } 1056int main() { _ascii (); _ebcdic (); return 0; } 1057EOF 1058$CXX $CXXFLAGS -c -o $TMPO.o tmp_endianness_check.cpp 1059if $_strings $TMPO.o | grep BIGenDianSyS >/dev/null; then 1060 _endian=big 1061elif $_strings $TMPO.o | grep LiTTleEnDian >/dev/null; then 1062 _endian=little 1063fi 1064echo $_endian; 1065cc_check_clean tmp_endianness_check.cpp 1066 1067case $_endian in 1068 big) 1069 add_line_to_config_h '#undef SCUMM_LITTLE_ENDIAN' 1070 add_line_to_config_h '#define SCUMM_BIG_ENDIAN' 1071 ;; 1072 little) 1073 add_line_to_config_h '#define SCUMM_LITTLE_ENDIAN' 1074 add_line_to_config_h '#undef SCUMM_BIG_ENDIAN' 1075 ;; 1076 *) 1077 exit 1 1078 ;; 1079esac 1080 1081# 1082# Determine a data type with the given length 1083# 1084find_type_with_size() { 1085 for datatype in int short char long unknown; do 1086 cat > tmp_find_type_with_size.cpp << EOF 1087typedef $datatype ac__type_sizeof_; 1088int main() { 1089 static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) == $1)]; 1090 test_array [0] = 0; 1091 return 0; 1092} 1093EOF 1094 if $CXX $CXXFLAGS -c -o $TMPO.o tmp_find_type_with_size.cpp 2>/dev/null ; then 1095 break 1096 else 1097 if test "$datatype" = "unknown"; then 1098 echo "couldn't find data type with $1 bytes" 1099 exit 1 1100 fi 1101 continue 1102 fi 1103 done 1104 cc_check_clean tmp_find_type_with_size.cpp 1105 echo $datatype 1106} 1107 1108# 1109# Determine data type sizes 1110# 1111echo_n "Type with 1 byte... " 1112type_1_byte=`find_type_with_size 1` 1113TMPR="$?" 1114echo "$type_1_byte" 1115test $TMPR -eq 0 || exit 1 # check exit code of subshell 1116 1117echo_n "Type with 2 bytes... " 1118type_2_byte=`find_type_with_size 2` 1119TMPR="$?" 1120echo "$type_2_byte" 1121test $TMPR -eq 0 || exit 1 # check exit code of subshell 1122 1123echo_n "Type with 4 bytes... " 1124type_4_byte=`find_type_with_size 4` 1125TMPR="$?" 1126echo "$type_4_byte" 1127test $TMPR -eq 0 || exit 1 # check exit code of subshell 1128 1129# 1130# Check whether memory alignment is required 1131# 1132# For some CPU types, unaligned memory access is either not supported at 1133# all (and so leads to a crash), requires a super-slow emulation via an 1134# exception handler, or just results in incorrect results. 1135# On the other hand, accessing data in a manner that works regardless of 1136# alignment can be a lot slower than regular access, so we don't want 1137# to use it if we don't have to. 1138# 1139# So we do the following: For CPU families where we know whether unaligned 1140# access is safe & fast, we enable / disable unaligned access accordingly. 1141# Otherwise, we just disable memory alignment. 1142# 1143# NOTE: In the past, for non-cross compiled builds, we would also run some code 1144# which would try to test whether unaligned access worked or not. But this test 1145# could not reliably determine whether unaligned access really worked in all 1146# situations (and across different implementations of the target CPU arch), nor 1147# whether it was fast (as opposed to slowly emulated by fault handlers). Hence, 1148# we do not use this approach anymore. 1149# 1150# NOTE: The only kinds of unaligned access we allow are for 2 byte and 4 1151# byte loads / stores. No promises are made for bigger sizes, such as 8 1152# or 16 byte loads, for which architectures may behave differently than 1153# for the smaller sizes. 1154echo_n "Alignment required... " 1155case $_host_cpu in 1156 i[3-6]86 | x86_64 | ppc*) 1157 # Unaligned access should work 1158 _need_memalign=no 1159 ;; 1160 alpha* | arm* | bfin* | hp* | mips* | sh* | sparc* | ia64 | nv1*) 1161 # Unaligned access is not supported or extremely slow. 1162 _need_memalign=yes 1163 ;; 1164 *) 1165 # Status of unaligned access is unknown, so assume the worst. 1166 _need_memalign=yes 1167 ;; 1168esac 1169echo "$_need_memalign" 1170 1171define_in_config_h_if_yes $_need_memalign 'SCUMM_NEED_ALIGNMENT' 1172 1173# 1174# Determine build settings 1175# 1176echo_n "Checking hosttype... " 1177echo $_host_os 1178case $_host_os in 1179 amigaos*) 1180 LDFLAGS="$LDFLAGS -L/sdk/local/newlib/lib" 1181 # We have to use 'long' for our 4 byte typedef because AmigaOS already typedefs (u)int32 1182 # as (unsigned) long, and consequently we'd get a compiler error otherwise. 1183 type_4_byte='long' 1184 add_line_to_config_mk 'AMIGAOS = 1' 1185 ;; 1186 beos*) 1187 DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" 1188 # Needs -lbind -lsocket for the timidity MIDI driver 1189 LDFLAGS="-L/boot/home/config/lib" 1190 CFLAGS="-I/boot/home/config/include" 1191 CXXFLAGS="$CXXFLAGS -fhuge-objects" 1192 LIBS="$LIBS -lbind -lsocket" 1193 _seq_midi=no 1194 ;; 1195 cygwin*) 1196 echo ERROR: Cygwin building is not supported by ScummVM anymore. Consider using MinGW. 1197 exit 1 1198 ;; 1199 darwin*) 1200 DEFINES="$DEFINES -DMACOSX" 1201 LIBS="$LIBS -framework AudioUnit -framework AudioToolbox -framework Carbon -framework CoreMIDI" 1202 add_line_to_config_mk 'MACOSX = 1' 1203 1204 # Now we may have MacPorts or Fink installed 1205 # Which put libraries and headers in non-standard places 1206 # Checking them here 1207 1208 # MacPorts 1209 # There is no way to get the prefix, so implementing a hack here 1210 macport_version=`port version 2>/dev/null` 1211 if test "$?" -eq 0; then 1212 macport_version="`echo "${macport_version}" | sed -ne 's/Version: \([0-9]\.[0-9]\.[0-9]\)/\1/gp'`" 1213 echo_n "You seem to be running MacPorts version ${macport_version}..." 1214 1215 macport_prefix=`which port` 1216 # strip off /bin/port from /opt/local/bin/port 1217 macport_prefix=`dirname ${macport_prefix}` 1218 macport_prefix=`dirname ${macport_prefix}` 1219 1220 echo "adding ${macport_prefix} to paths" 1221 1222 LDFLAGS="-L${macport_prefix}/lib $LDFLAGS" 1223 CXXFLAGS="-I${macport_prefix}/include $CXXFLAGS" 1224 1225 if test -z "$_staticlibpath"; then 1226 _staticlibpath=${macport_prefix} 1227 echo "Set staticlib-prefix to ${_staticlibpath}" 1228 fi 1229 fi 1230 1231 # Fink 1232 # There is no way to get the prefix, so implementing a hack here 1233 fink_version=`fink -V 2>/dev/null` 1234 if test "$?" -eq 0; then 1235 fink_version="`echo "${fink_version}" | sed -ne 's/Package manager version: \([0-9.]*\)/\1/gp'`" 1236 echo_n "You seem to be running Fink version ${fink_version}..." 1237 1238 fink_prefix=`which fink` 1239 # strip off /bin/fink from /sw/bin/port 1240 fink_prefix=`dirname ${fink_prefix}` 1241 fink_prefix=`dirname ${fink_prefix}` 1242 1243 echo "adding ${fink_prefix} to paths" 1244 1245 LDFLAGS="-L${fink_prefix}/lib $LDFLAGS" 1246 CXXFLAGS="-I${fink_prefix}/include $CXXFLAGS" 1247 1248 if test -z "$_staticlibpath"; then 1249 _staticlibpath=${fink_prefix} 1250 echo "Set staticlib-prefix to ${_staticlibpath}" 1251 fi 1252 fi 1253 1254 # Homebrew 1255 brew_version=`brew -v 2>/dev/null` 1256 if test "$?" -eq 0; then 1257 brew_version="`echo "${brew_version}" | sed -ne 's/Homebrew \([0-9.]*\)/\1/gp'`" 1258 echo_n "You seem to be running Homebrew version ${brew_version}..." 1259 1260 brew_prefix=`brew --prefix` 1261 1262 echo "adding ${brew_prefix} to paths" 1263 1264 LDFLAGS="-L${brew_prefix}/lib $LDFLAGS" 1265 CXXFLAGS="-I${brew_prefix}/include $CXXFLAGS" 1266 1267 if test -z "$_staticlibpath"; then 1268 _staticlibpath=${brew_prefix} 1269 echo "Set staticlib-prefix to ${_staticlibpath}" 1270 fi 1271 fi 1272 1273 # If _staticlibpath is not set yet try first /sw (fink) then /usr/local 1274 # (the macports case is handled above). 1275 if test -z "$_staticlibpath"; then 1276 if test -d "/sw"; then 1277 _staticlibpath=/sw 1278 echo "Set staticlib-prefix to ${_staticlibpath}" 1279 elif test -d "/usr/local"; then 1280 _staticlibpath=/usr/local 1281 echo "Set staticlib-prefix to ${_staticlibpath}" 1282 else 1283 echo "Could not determine prefix for static libraries" 1284 fi 1285 fi 1286 1287 # If _xcodetoolspath is not set yet use xcode-select to get the path 1288 if test -z "$_xcodetoolspath"; then 1289 _xcodetoolspath=`xcode-select -print-path`/Tools 1290 if test -d "$_xcodetoolspath"; then 1291 echo "Set xcodetools-path to ${_xcodetoolspath}" 1292 else 1293 _xcodetoolspath= 1294 echo "Could not determine path for Xcode Tools" 1295 fi 1296 fi 1297 ;; 1298 dragonfly*|freebsd*) 1299 LDFLAGS="$LDFLAGS -L/usr/local/lib" 1300 CXXFLAGS="$CXXFLAGS -I/usr/local/include" 1301 ;; 1302 haiku*) 1303 DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" 1304 # Needs -lnetwork for the timidity MIDI driver 1305 LIBS="$LIBS -lnetwork" 1306 _seq_midi=no 1307 ;; 1308 irix*) 1309 DEFINES="$DEFINES -DIRIX" 1310 DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" 1311 LIBS="$LIBS -lmd -lfastm -lm" 1312 _ranlib=: 1313 ;; 1314 linux* | uclinux*) 1315 # When not cross-compiling, enable large file support, but don't 1316 # care if getconf doesn't exist or doesn't recognize LFS_CFLAGS. 1317 if test -z "$_host"; then 1318 CXXFLAGS="$CXXFLAGS $(getconf LFS_CFLAGS 2>/dev/null)" 1319 fi 1320 ;; 1321 mingw*) 1322 DEFINES="$DEFINES -DWIN32" 1323 # append_var DEFINES "-D__USE_MINGW_ANSI_STDIO=0" # Modern MinGW does not need it 1324 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++" 1325 LIBS="$LIBS -lmingw32 -lwinmm" 1326 OBJS="$OBJS scummvmtoolswinres.o" 1327 add_line_to_config_mk 'WIN32 = 1' 1328 ;; 1329 mint*) 1330 DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" 1331 ;; 1332 morphos*) 1333 LDFLAGS="$LDFLAGS -L/usr/local/lib -noixemul" 1334 CXXFLAGS="$CXXFLAGS -D__MORPHOS_SHAREDLIBS" 1335 # We have to use 'long' for our 4 byte typedef because MorphOS already typedefs (u)int32 1336 # as (unsigned) long, and consequently we'd get a compiler error otherwise. 1337 type_4_byte='long' 1338 add_line_to_config_mk 'MORPHOS = 1' 1339 ;; 1340 riscos) 1341 DEFINES="$DEFINES -DRISCOS" 1342 add_line_to_config_mk 'RISCOS = 1' 1343 LDFLAGS="$LDFLAGS -L$GCCSDK_INSTALL_ENV/lib" 1344 CXXFLAGS="$CXXFLAGS -I$GCCSDK_INSTALL_ENV/include" 1345 _pkgconfig=$GCCSDK_INSTALL_ENV/ro-pkg-config 1346 _wxconfig=$GCCSDK_INSTALL_ENV/bin/wx-config 1347 _freetypepath=$GCCSDK_INSTALL_ENV/bin 1348 LDFLAGS="$LDFLAGS -static" 1349 ;; 1350 solaris*) 1351 DEFINES="$DEFINES -DSOLARIS" 1352 DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" 1353 # Needs -lbind -lsocket for the timidity MIDI driver 1354 LIBS="$LIBS -lnsl -lsocket" 1355 ;; 1356esac 1357 1358if test -n "$_host"; then 1359 # Cross-compiling mode - add your target here if needed 1360 echo "Cross-compiling to $_host" 1361 case "$_host" in 1362 arm-linux|arm*-linux-gnueabi|arm-*-linux) 1363 ;; 1364 arm-*riscos) 1365 # toolchain binaries prefixed by host 1366 _ranlib=$_host-ranlib 1367 _strip=$_host-strip 1368 _ar="$_host-ar cru" 1369 _as="$_host-as" 1370 ;; 1371 *darwin*) 1372 _ranlib=$_host-ranlib 1373 _strip=$_host-strip 1374 ;; 1375 linupy) 1376 DEFINES="$DEFINES -DLINUPY" 1377 ;; 1378 m68k-atari-mint) 1379 DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" 1380 _ranlib=m68k-atari-mint-ranlib 1381 _ar="m68k-atari-mint-ar cru" 1382 ;; 1383 *mingw32*) 1384 _windres=$_host-windres 1385 _ar="$_host-ar cru" 1386 _ranlib=$_host-ranlib 1387 ;; 1388 mips-sgi*) 1389 LDFLAGS="$LDFLAGS -static-libgcc" 1390 LIBS="$LIBS -laudio" 1391 ;; 1392 ppc-amigaos|ppc-morphos) 1393 # Only static builds link successfully on buildbot 1394 LDFLAGS=`echo $LDFLAGS | sed 's/-use-dynld//'` 1395 LDFLAGS="$LDFLAGS -static" 1396 1397 # toolchain binaries prefixed by host 1398 _ranlib=$_host-ranlib 1399 _strip=$_host-strip 1400 _ar="$_host-ar cru" 1401 _as="$_host-as" 1402 _windres=$_host-windres 1403 ;; 1404 raspberrypi) 1405 # This is needed because the official cross compiler doesn't have multiarch enabled 1406 # but Raspbian does. 1407 # Be careful as it's the linker (LDFLAGS) which must know about sysroot. 1408 # These are needed to build against Raspbian's libSDL. 1409 LDFLAGS="$LDFLAGS --sysroot=$RPI_ROOT" 1410 LDFLAGS="$LDFLAGS -B$RPI_ROOT/usr/lib/arm-linux-gnueabihf" 1411 LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/usr/lib/arm-linux-gnueabihf/pulseaudio" 1412 LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/usr/lib/arm-linux-gnueabihf" 1413 LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/lib/arm-linux-gnueabihf" 1414 LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/opt/vc/lib" 1415 LDFLAGS="$LDFLAGS -L$RPI_ROOT/opt/vc/lib" 1416 CXXFLAGS="$CXXFLAGS -isystem $RPI_ROOT/usr/include/arm-linux-gnueabihf" 1417 CXXFLAGS="$CXXFLAGS -I$RPI_ROOT/usr/include" 1418 # This is so optional OpenGL ES includes are found. 1419 CXXFLAGS="$CXXFLAGS -I$RPI_ROOT/opt/vc/include" 1420 ;; 1421 *) 1422 echo "WARNING: Unknown target, continuing with auto-detected values" 1423 ;; 1424 esac 1425fi 1426 1427# 1428# Determine whether host is POSIX compliant, or at least POSIX 1429# compatible enough to support our POSIX code (including dlsym(), 1430# mkdir() and some other APIs). 1431# 1432# TODO: Instead of basing this on the host name, we should really base 1433# this on the presence of features (such as the dlsym and mkdir APIs). 1434# 1435echo_n "Checking if host is POSIX compliant... " 1436case $_host_os in 1437 amigaos* | cygwin* | dreamcast | ds | gamecube | mingw* | morphos* | n64 | ps2 | psp | wii | wince) 1438 _posix=no 1439 ;; 1440 android | beos* | bsd* | darwin* | freebsd* | gph-linux | haiku* | hpux* | iphone | irix* | linux* | mint* | netbsd* | openbsd* | riscos | solaris* | sunos* | uclinux* | webos) 1441 _posix=yes 1442 ;; 1443 dragonfly*) 1444 _posix=yes 1445 ;; 1446 os2-emx*) 1447 _posix=yes # FIXME: Really??? 1448 ;; 1449 *) 1450 # given this is a shell script, we might assume some type of posix. 1451 # However, the host system might be a totally different one, so 1452 # we can assume nothing about it. 1453 # Indeed, as mentioned further above, we really should test for the 1454 # presences of relevant APIs on the host anyway... 1455 _posix=no 1456 ;; 1457esac 1458echo $_posix 1459 1460if test "$_posix" = yes ; then 1461 DEFINES="$DEFINES -DPOSIX" 1462 add_line_to_config_mk 'POSIX = 1' 1463fi 1464 1465# 1466# Check whether to enable a verbose build 1467# 1468echo_n "Checking whether to have a verbose build... " 1469echo "$_verbose_build" 1470add_to_config_mk_if_yes "$_verbose_build" 'VERBOSE_BUILD = 1' 1471 1472# 1473# Check for math lib 1474# 1475cat > $TMPC << EOF 1476int main(void) { return 0; } 1477EOF 1478cc_check -lm && LDFLAGS="$LDFLAGS -lm" 1479 1480# 1481# Check for pkg-config 1482# 1483echocheck "pkg-config" 1484_pkg_config=no 1485command -v $_pkgconfig >/dev/null 2>&1 && _pkg_config=yes 1486echo "$_pkg_config" 1487 1488if test "$_pkg_config" = yes && test -n "$_host" && test -z "$PKG_CONFIG_LIBDIR"; then 1489 echo "WARNING: When cross-compiling PKG_CONFIG_LIBDIR must be set to the location of the .pc files for the target" 1490fi 1491 1492# 1493# Check for Ogg Vorbis 1494# 1495echocheck "Ogg Vorbis" 1496if test "$_vorbis" = auto ; then 1497 _vorbis=no 1498 cat > $TMPC << EOF 1499#include <vorbis/codec.h> 1500int main(void) { vorbis_packet_blocksize(0,0); return 0; } 1501EOF 1502 cc_check $OGG_CFLAGS $OGG_LIBS $VORBIS_CFLAGS $VORBIS_LIBS \ 1503 -lvorbisfile -lvorbis -logg && _vorbis=yes 1504fi 1505if test "$_vorbis" = yes ; then 1506 LIBS="$LIBS $OGG_LIBS $VORBIS_LIBS -lvorbisfile -lvorbis -lvorbisenc -logg" 1507 INCLUDES="$INCLUDES $OGG_CFLAGS $VORBIS_CFLAGS" 1508fi 1509define_in_config_if_yes "$_vorbis" 'USE_VORBIS' 1510echo "$_vorbis" 1511 1512# 1513# Check for Tremor 1514# 1515echocheck "Tremor" 1516if test "$_tremor" = auto ; then 1517 _tremor=no 1518 cat > $TMPC << EOF 1519#include <tremor/ivorbiscodec.h> 1520int main(void) { vorbis_info_init(0); return 0; } 1521EOF 1522 cc_check $TREMOR_CFLAGS $TREMOR_LIBS -lvorbisidec && \ 1523 _tremor=yes 1524fi 1525if test "$_tremor" = yes && test "$_vorbis" = no; then 1526 add_line_to_config_h '#define USE_TREMOR' 1527 add_line_to_config_h '#define USE_VORBIS' 1528 LIBS="$LIBS $TREMOR_LIBS -lvorbisenc" 1529 INCLUDES="$INCLUDES $TREMOR_CFLAGS" 1530else 1531 if test "$_vorbis" = yes; then 1532 _tremor="no (Ogg Vorbis/Tremor support is mutually exclusive)" 1533 fi 1534 add_line_to_config_h '#undef USE_TREMOR' 1535fi 1536add_to_config_mk_if_yes "$_tremor" 'USE_TREMOR = 1' 1537echo "$_tremor" 1538 1539# 1540# Check for FLAC 1541# 1542echocheck "FLAC >= 1.1.3" 1543if test "$_flac" = auto ; then 1544 _flac=no 1545 cat > $TMPC << EOF 1546#include <FLAC/format.h> 1547#include <FLAC/stream_encoder.h> 1548FLAC__StreamEncoderInitStatus x; 1549int main(void) { return FLAC__STREAM_SYNC_LEN >> 30; /* guaranteed to be 0 */ } 1550EOF 1551 if test "$_vorbis" = yes ; then 1552 cc_check $FLAC_CFLAGS $FLAC_LIBS $OGG_CFLAGS $OGG_LIBS \ 1553 -lFLAC -logg && _flac=yes 1554 else 1555 cc_check $FLAC_CFLAGS $FLAC_LIBS \ 1556 -lFLAC && _flac=yes 1557 fi 1558fi 1559if test "$_flac" = yes ; then 1560 if test "$_vorbis" = yes ; then 1561 LIBS="$LIBS $FLAC_LIBS $OGG_LIBS -lFLAC -logg" 1562 else 1563 LIBS="$LIBS $FLAC_LIBS -lFLAC" 1564 fi 1565 INCLUDES="$INCLUDES $FLAC_CFLAGS" 1566fi 1567define_in_config_if_yes "$_flac" 'USE_FLAC' 1568echo "$_flac" 1569 1570# 1571# Check for MAD (MP3 library) 1572# 1573echocheck "MAD" 1574if test "$_mad" = auto ; then 1575 _mad=no 1576 cat > $TMPC << EOF 1577#include <mad.h> 1578int main(void) { return 0; } 1579EOF 1580 cc_check $MAD_CFLAGS $MAD_LIBS -lmad && _mad=yes 1581fi 1582if test "$_mad" = yes ; then 1583 LIBS="$LIBS $MAD_LIBS -lmad" 1584 INCLUDES="$INCLUDES $MAD_CFLAGS" 1585fi 1586define_in_config_if_yes "$_mad" 'USE_MAD' 1587echo "$_mad" 1588 1589# 1590# Check for PNG 1591# 1592echocheck "PNG >= 1.2.8" 1593if test "$_pkg_config" = "yes" && $_pkgconfig --exists libpng; then 1594 PNG_LIBS="$PNG_LIBS `$_pkgconfig --libs libpng`" 1595 PNG_CFLAGS="$PNG_CFLAGS `$_pkgconfig --cflags libpng`" 1596else 1597 PNG_LIBS="$PNG_LIBS -lpng -lz" 1598fi 1599if test "$_png" = auto ; then 1600 _png=no 1601 cat > $TMPC << EOF 1602#include <png.h> 1603int main(void) { 1604#if PNG_LIBPNG_VER >= 10208 1605#else 1606 syntax error 1607#endif 1608 return 0; 1609} 1610EOF 1611 cc_check $PNG_CFLAGS $PNG_LIBS && _png=yes 1612fi 1613if test "$_png" = yes ; then 1614 LIBS="$LIBS $PNG_LIBS" 1615 INCLUDES="$INCLUDES $PNG_CFLAGS" 1616fi 1617define_in_config_if_yes "$_png" 'USE_PNG' 1618echo "$_png" 1619 1620# 1621# Check for ZLib 1622# 1623echocheck "zlib" 1624if test "$_zlib" = auto ; then 1625 _zlib=no 1626 cat > $TMPC << EOF 1627#include <string.h> 1628#include <zlib.h> 1629int main(void) { return strcmp(ZLIB_VERSION, zlibVersion()); } 1630EOF 1631 cc_check $ZLIB_CFLAGS $ZLIB_LIBS -lz && _zlib=yes 1632fi 1633if test "$_zlib" = yes ; then 1634 LIBS="$LIBS $ZLIB_LIBS -lz" 1635 INCLUDES="$INCLUDES $ZLIB_CFLAGS" 1636fi 1637define_in_config_if_yes "$_zlib" 'USE_ZLIB' 1638echo "$_zlib" 1639 1640# 1641# Check for FreeType2 to be present 1642# 1643find_freetype() { 1644 # Wrapper function which tries to find freetype 1645 # either by calling freetype-config or by using 1646 # pkg-config. 1647 # As of freetype-2.9.1 the freetype-config file 1648 # no longer gets installed by default. 1649 if test "$_pkg_config" = "yes" && $_pkgconfig --exists freetype2; then 1650 FREETYPE2_LIBS=`$_pkgconfig --libs freetype2` 1651 FREETYPE2_CFLAGS=`$_pkgconfig --cflags freetype2` 1652 FREETYPE2_STATIC_LIBS=`$_pkgconfig --static --libs freetype2` 1653 _freetype_found="true" 1654 else 1655 # Look for the freetype-config script 1656 find_freetypeconfig 1657 if test -n "$_freetypeconfig"; then 1658 # Since 2.3.12, freetype-config prepends $SYSROOT to everything. 1659 # This means we can't pass it a --prefix that includes $SYSROOT. 1660 freetypeprefix="$_freetypepath" 1661 if test -n "$SYSROOT" -a "$SYSROOT" != "/"; then 1662 teststring=VeryImplausibleSysrootX1Y2Z3 1663 if ( env SYSROOT=/$teststring "$_freetypeconfig" --cflags | grep $teststring 2> /dev/null > /dev/null ); then 1664 echo "Adapting FreeType prefix to SYSROOT" >> "$TMPLOG" 1665 freetypeprefix="${freetypeprefix##$SYSROOT}" 1666 fi 1667 fi 1668 FREETYPE2_LIBS=`$_freetypeconfig --prefix="$freetypeprefix" --libs` 1669 FREETYPE2_CFLAGS=`$_freetypeconfig --prefix="$freetypeprefix" --cflags` 1670 FREETYPE2_STATIC_LIBS=`$_freetypeconfig --prefix="$freetypeprefix" --static --libs 2>/dev/null` 1671 _freetype_found="true" 1672 fi 1673 fi 1674} 1675 1676if test "$_freetype2" != "no"; then 1677 find_freetype 1678 if test $_freetype_found != true; then 1679 _freetype2=no 1680 else 1681 if test "$_freetype2" = "auto"; then 1682 _freetype2=no 1683 1684 cat > $TMPC << EOF 1685#include <ft2build.h> 1686#include FT_FREETYPE_H 1687 1688int main(int argc, char *argv[]) { 1689 FT_Library library; 1690 FT_Error error = FT_Init_FreeType(&library); 1691 FT_Done_FreeType(library); 1692} 1693EOF 1694 1695 cc_check_no_clean $FREETYPE2_CFLAGS $FREETYPE2_LIBS && _freetype2=yes 1696 # Modern freetype-config scripts accept --static to get all 1697 # required flags for static linking. We abuse this to detect 1698 # FreeType2 builds which are static themselves. 1699 if test "$_freetype2" != "yes"; then 1700 FREETYPE2_LIBS="$FREETYPE2_STATIC_LIBS" 1701 cc_check_no_clean $FREETYPE2_CFLAGS $FREETYPE2_LIBS && _freetype2=yes 1702 fi 1703 cc_check_clean 1704 fi 1705 1706 if test "$_freetype2" = "yes"; then 1707 LIBS="$LIBS $FREETYPE2_LIBS" 1708 CXXFLAGS="$CXXFLAGS $FREETYPE2_CFLAGS" 1709 fi 1710 fi 1711 1712fi 1713 1714echocheck "FreeType2" 1715echo "$_freetype2" 1716 1717define_in_config_if_yes "$_freetype2" "USE_FREETYPE2" 1718 1719# 1720# Check for Boost 1721# 1722echocheck "Boost => 1.32.0" 1723if test "$_boost" = auto ; then 1724 _boost=no 1725 cat > $TMPC << EOF 1726#include <iostream> 1727#include <boost/version.hpp> 1728int main(void) { if (BOOST_VERSION < 103200) return 1; return 0; } 1729EOF 1730 cc_check $BOOST_CFLAGS $BOOST_LIBS && _boost=yes 1731fi 1732echo "$_boost" 1733 1734if test "$_boost" = yes ; then 1735 _boost=no 1736 echo_n "Checking whether Boost.ProgramOptions has been compiled... " 1737 cat > $TMPC << EOF 1738#include <boost/program_options.hpp> 1739int main(void) { boost::program_options::options_description generic("Generic options"); return 0; } 1740EOF 1741 cc_check $BOOST_CFLAGS $BOOST_LIBS -lboost_program_options && _boost=yes 1742 add_to_config_mk_if_yes "$_boost" 'BOOST_SUFFIX = ' 1743 1744 # If not working without suffix, try -mt suffix 1745 if test "$_boost" = no ; then 1746 cc_check $BOOST_CFLAGS $BOOST_LIBS -lboost_program_options-mt && _boost=yes 1747 add_to_config_mk_if_yes "$_boost" 'BOOST_SUFFIX = -mt' 1748 fi 1749 add_to_config_mk_if_yes "$_boost" 'USE_BOOST = 1' 1750 echo "$_boost" 1751fi 1752 1753# 1754# Check for iconv 1755# 1756echo_n "Checking whether iconv.h is present... " 1757if test "$_iconv" = auto ; then 1758 _iconv=no 1759 cat > $TMPC << EOF 1760#include <iconv.h> 1761int main(int, char **) { 1762 return 0; 1763} 1764EOF 1765 cc_check && _iconv=yes 1766fi 1767 1768create_iconv_test() { 1769 cat > $TMPC << EOF 1770#include <iconv.h> 1771int main(int, char **) { 1772 iconv_t iconv = iconv_open("UTF-32", "SJIS"); 1773 iconv_close(iconv); 1774 return 0; 1775} 1776EOF 1777} 1778echo "$_iconv" 1779 1780if test "$_iconv" = yes ; then 1781 echo_n "Checking whether iconv needs linking against libiconv... " 1782 1783 needs_iconvlib='auto' 1784 create_iconv_test 1785 cc_check -liconv && needs_iconvlib='yes' 1786 # We do check linking without -liconv here too, just in case 1787 # it would fail otherwise too 1788 create_iconv_test 1789 cc_check && needs_iconvlib='no' 1790 1791 if test "$needs_iconvlib" = auto ; then 1792 _iconv=no 1793 echo "does not link at all" 1794 else 1795 if test "$needs_iconvlib" = yes ; then 1796 _iconvlibs='-liconv' 1797 else 1798 _iconvlibs='' 1799 fi 1800 echo "$needs_iconvlib" 1801 1802 echo_n "Checking signature of iconv... " 1803 uses_const=no 1804 1805 cat > $TMPC << EOF 1806#include <iconv.h> 1807int main(int argc, char **argv) { 1808 iconv_t iconvP; 1809 const char **inbuf = 0; 1810 iconv(iconvP, inbuf, 0, 0, 0); 1811 return 0; 1812} 1813EOF 1814 cc_check $_iconvlibs && uses_const=yes 1815 1816 if test "$uses_const" = yes ; then 1817 echo "iconv_t, const char **, size_t *, char **, size_t *" 1818 _iconvcflags='-DICONV_USES_CONST' 1819 else 1820 echo "iconv_t, char **, size_t *, char **, size_t *" 1821 _iconvcflags='-UICONV_USES_CONST' 1822 fi 1823 fi 1824fi 1825 1826echocheck "iconv" 1827define_in_config_if_yes "$_iconv" 'USE_ICONV' 1828echo "$_iconv" 1829 1830# 1831# Check for wxWidgets 1832# 1833if test "$_wxwidgets" = auto ; then 1834 _wxwidgets=no 1835 find_wxconfig 1836 if test -n "$_wxconfig"; then 1837 _wxwidgets=yes 1838 fi 1839fi 1840 1841if test "$_wxwidgets" = yes ; then 1842 _wxincludes="`$_wxconfig --cflags`" 1843 _wxlibs="`$_wxconfig --libs`" 1844 _wxstaticlibs="`$_wxconfig --static --libs 2> /dev/null`" 1845 _wxstaticlibs=`echo $_wxstaticlibs | sed 's|-lpng||' | sed 's|-lz||'` 1846 # _wxstaticlibs may contain non-static libraries that we also have in _wxstaticlibs. 1847 # remove those to avoid dependency on non-static libraries 1848 1849 # Use the compiler specified by wx-config when not cross-compiling. This is needed on some systems to get a working executable. 1850 if test -z "$_host"; then 1851 CXX="`$_wxconfig --cxx`" 1852 LD=$CXX 1853 fi 1854 1855echo_n "Checking for wxwidgets gui dev component... " 1856 has_wx_gui_dev=no 1857 1858 cat > $TMPC << EOF 1859#include <wx/wx.h> 1860 1861class Foo : public wxFrame { 1862public: 1863 Foo(const wxString& title) : wxFrame(NULL, wxID_ANY, title) {} 1864}; 1865 1866class FooApp : public wxApp { 1867public: 1868 virtual bool OnInit(); 1869}; 1870 1871IMPLEMENT_APP(FooApp) 1872 1873bool FooApp::OnInit() { 1874 Foo *foo = new Foo(wxT("Foo")); 1875 foo->Show(true); 1876 return true; 1877} 1878EOF 1879 cc_check $_wxincludes $_wxlibs && has_wx_gui_dev=yes 1880 1881 if test "$has_wx_gui_dev" = no ; then 1882 _wxincludes="" 1883 _wxlibs="" 1884 _wxstaticlibs="" 1885 _wxwidgets=no 1886 echo "not found" 1887 else 1888 echo "found" 1889 fi 1890 1891fi 1892add_to_config_mk_if_yes "$_wxwidgets" 'USE_WXWIDGETS = 1' 1893 1894 1895# 1896# Figure out installation directories 1897# 1898test -z "$_bindir" && _bindir="$_prefix/bin" 1899test -z "$_datadir" && _datadir="$_prefix/share" 1900test -z "$_mandir" && _mandir="$_prefix/share/man" 1901test -z "$_libdir" && _libdir="$_prefix/lib" 1902 1903# 1904# Set variables for profiling. 1905# We need to do it here to prevent mess-ups with the tests e.g. on the PSP 1906# 1907if test "$_enable_prof" = yes ; then 1908 CXXFLAGS="$CXXFLAGS -pg" 1909 LDFLAGS="$LDFLAGS -pg" 1910fi 1911 1912_def_media_path='#define APP_MEDIA_PATH "'$_datadir'"' 1913 1914echo 1915echo "Creating config.h" 1916cat > config.h << EOF 1917/* This file is automatically generated by configure */ 1918/* DO NOT EDIT MANUALLY */ 1919 1920#ifndef CONFIG_H 1921#define CONFIG_H 1922 1923$_config_h_data 1924 1925/* paths */ 1926$_def_media_path 1927 1928/* Data types */ 1929typedef unsigned $type_1_byte byte; 1930typedef unsigned int uint; 1931typedef unsigned $type_1_byte uint8; 1932typedef unsigned $type_2_byte uint16; 1933typedef unsigned $type_4_byte uint32; 1934typedef signed $type_1_byte int8; 1935typedef signed $type_2_byte int16; 1936typedef signed $type_4_byte int32; 1937 1938#endif /* CONFIG_H */ 1939EOF 1940 1941echo "Creating config.mk" 1942cat > config.mk << EOF 1943# -------- Generated by configure ----------- 1944 1945CXX := $CXX 1946CXXFLAGS := $CXXFLAGS 1947LD := $LD 1948LIBS += $LIBS 1949RANLIB := $_ranlib 1950STRIP := $_strip 1951AR := $_ar 1952AS := $_as 1953ASFLAGS := $ASFLAGS 1954WINDRES := $_windres 1955WINDRESFLAGS := $WINDRESFLAGS 1956WIN32PATH=$_win32path 1957AMIGAOSPATH=$_amigaospath 1958MORPHOSPATH=$_morphospath 1959STATICLIBPATH=$_staticlibpath 1960XCODETOOLSPATH=$_xcodetoolspath 1961 1962EXEEXT := $HOSTEXEEXT 1963 1964PREFIX := $_prefix 1965BINDIR := $_bindir 1966DATADIR := $_datadir 1967MANDIR := $_mandir 1968LIBDIR := $_libdir 1969 1970$_config_mk_data 1971 1972INCLUDES += $INCLUDES 1973OBJS += $OBJS 1974DEFINES += $DEFINES 1975LDFLAGS += $LDFLAGS 1976 1977WXINCLUDES := $_wxincludes 1978WXLIBS := $_wxlibs 1979WXSTATICLIBS := $_wxstaticlibs 1980 1981FREETYPE2_CFLAGS := $FREETYPE2_CFLAGS 1982FREETYPE2_LIBS := $FREETYPE2_LIBS 1983 1984ICONVLIBS := $_iconvlibs 1985ICONVCFLAGS := $_iconvcflags 1986 1987SAVED_CONFIGFLAGS := $SAVED_CONFIGFLAGS 1988SAVED_LDFLAGS := $SAVED_LDFLAGS 1989SAVED_PKG_CONFIG_LIBDIR := $SAVED_PKG_CONFIG_LIBDIR 1990SAVED_CXX := $SAVED_CXX 1991SAVED_CXXFLAGS := $SAVED_CXXFLAGS 1992SAVED_CPPFLAGS := $SAVED_CPPFLAGS 1993SAVED_ASFLAGS := $SAVED_ASFLAGS 1994SAVED_WINDRESFLAGS := $SAVED_WINDRESFLAGS 1995EOF 1996 1997# 1998# Create a custom Makefile when building outside the source tree 1999# TODO: Add a better check than just looking for 'Makefile' 2000# 2001if test ! -f Makefile.common ; then 2002echo "Creating Makefile" 2003 2004cat > Makefile << EOF 2005# -------- Generated by configure ----------- 2006srcdir = $_srcdir 2007vpath %.h \$(srcdir) 2008vpath %.cpp \$(srcdir) 2009vpath %.c \$(srcdir) 2010vpath %.m \$(srcdir) 2011vpath %.mm \$(srcdir) 2012vpath %.asm \$(srcdir) 2013vpath %.s \$(srcdir) 2014vpath %.S \$(srcdir) 2015include \$(srcdir)/Makefile 2016EOF 2017 2018fi 2019