3 # configure -- custom configure script for ScummVM.
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.
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.
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.
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.
23 # $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/base/main.cpp $
26 # Save the current environment variables for next runs
28 SAVED_LDFLAGS
=$LDFLAGS
30 SAVED_CXXFLAGS
=$CXXFLAGS
31 SAVED_CPPFLAGS
=$CPPFLAGS
33 # Use environment vars if set
34 CXXFLAGS
="$CXXFLAGS $CPPFLAGS"
36 # Backslashes into forward slashes:
37 # The following OS/2 specific code is performed to deal with handling of backslashes by ksh.
38 # Borrowed from the Sane configure script
40 if test "$ac_emxsupport" != "no" -a "$ac_emxsupport" != "NO"; then
44 for ac_dir
in $PATH; do
46 if test -z "$ac_TEMP_PATH"; then
47 ac_TEMP_PATH
="$ac_dir"
49 ac_TEMP_PATH
="$ac_TEMP_PATH/$ac_dir"
58 # Add an engine: id name build subengines
60 _engines
="${_engines} ${1}"
61 eval _engine_
${1}_name
='${2}'
62 eval _engine_
${1}_build
='${3}'
63 eval _engine_
${1}_subengines
='${4}'
65 eval _engine_
${sub}_sub
=yes
69 add_engine scumm
"SCUMM" yes "scumm_7_8 he"
70 add_engine scumm_7_8
"v7 & v8 games" yes
71 add_engine he
"HE71+ games" yes
72 add_engine agi
"AGI" yes
73 add_engine agos
"AGOS" yes "pn"
74 add_engine pn
"Personal Nightmare" no
75 add_engine cine
"Cinematique evo 1" yes
76 add_engine cruise
"Cinematique evo 2" yes
77 add_engine drascula
"Drascula: The Vampire Strikes Back" yes
78 add_engine gob
"Gobli*ns" yes
79 add_engine groovie
"Groovie" yes
80 add_engine igor
"Igor: Objective Uikokahonia" no
81 add_engine kyra
"Legend of Kyrandia" yes "lol"
82 add_engine lol
"Lands of Lore" no
83 add_engine lure
"Lure of the Temptress" yes
84 add_engine
m4 "M4/MADS" no
85 add_engine made
"MADE" yes
86 add_engine parallaction
"Parallaction" yes
87 add_engine queen
"Flight of the Amazon Queen" yes
88 add_engine saga
"SAGA" yes "ihnm saga2"
89 add_engine ihnm
"IHNM" yes
90 add_engine saga2
"SAGA 2 games" no
91 add_engine sci
"SCI" yes "sci32"
92 add_engine sci32
"SCI32 games" no
93 add_engine sky
"Beneath a Steel Sky" yes
94 add_engine sword1
"Broken Sword 1" yes
95 add_engine sword2
"Broken Sword 2" yes
96 add_engine tinsel
"Tinsel" yes
97 add_engine touche
"Touche: The Adventures of the Fifth Musketeer" yes
98 add_engine tucker
"Bud Tucker in Double Trouble" yes
99 add_engine innocent
"Innocent Until Caught" no
105 # Default lib behaviour yes/no/auto
115 # Default option behaviour yes/no
118 _build_hq_scalers
=yes
120 # Default vkeybd/keymapper options
123 # Default platform settings
129 _plugins_default
=static
136 _win32path
="C:/scummvm"
137 _aos4path
="Games:ScummVM"
139 _sdlconfig
=sdl-config
145 # For cross compiling
154 # Determine a tmp file name, using mktemp(1) when available.
155 if type mktemp
> /dev
/null
2>&1 ; then
156 TMPO
=`mktemp /tmp/scummvm-conf.XXXXXXXXXX`
165 cat "$TMPC" >> "$TMPLOG"
167 echo "$CXX $TMPC -o $TMPO$HOSTEXEEXT $@" >> "$TMPLOG"
168 rm -f "$TMPO$HOSTEXEEXT"
169 ( $CXX $CXXFLAGS "$TMPC" -o "$TMPO$HOSTEXEEXT" "$@" ) >> "$TMPLOG" 2>&1
176 # Function to provide echo -n for bourne shells that don't have it
183 echo_n
"Checking for $@... "
186 # Add a line of data to config.mk.
187 add_line_to_config_mk
() {
188 _config_mk_data
="$_config_mk_data"'
192 # Add a line of data to config.h.
193 add_line_to_config_h
() {
194 _config_h_data
="$_config_h_data"'
198 add_to_config_h_if_yes
() {
199 if test "$1" = yes ; then
200 add_line_to_config_h
"$2"
202 add_line_to_config_h
"/* $2 */"
206 # Conditionally add a line of data to config.mk. Takes two parameters:
207 # The first one can be set to 'no' to "comment out" the line, i.e.
208 # make it ineffective, use 'yes' otherwise.
209 # The second param is the line to insert.
210 add_to_config_mk_if_yes
() {
211 if test "$1" = yes ; then
212 add_line_to_config_mk
"$2"
214 add_line_to_config_mk
"# $2"
218 # Conditionally add a line of data to config.mk. Takes two parameters:
219 # The first one can be set to 'yes' to "comment out" the line, i.e.
220 # make it ineffective, use 'no' otherwise.
221 # The second param is the line to insert.
222 add_to_config_mk_if_no
() {
223 if test "$1" = no
; then
224 add_line_to_config_mk
"$2"
226 add_line_to_config_mk
"# $2"
231 # Determine sdl-config
233 # TODO: small bit of code to test sdl useability
235 echo_n
"Looking for sdl-config... "
236 sdlconfigs
="$_sdlconfig:sdl-config:sdl11-config:sdl12-config"
239 IFS
="${IFS= }"; ac_save_ifs
="$IFS"; IFS
="$SEPARATOR"
240 for path_dir
in $_sdlpath; do
241 #reset separator to parse sdlconfigs
243 for sdlconfig
in $sdlconfigs; do
244 if test -f "$path_dir/$sdlconfig" ; then
245 _sdlconfig
="$path_dir/$sdlconfig"
249 if test `basename $path_dir` = bin
; then
250 _sdlpath
=`dirname $path_dir`
252 # break at first sdl-config found in path
260 if test -z "$_sdlconfig"; then
267 # Determine extension used for executables
269 get_system_exe_extension
() {
271 mingw
* |
*os2-emx | wince
)
283 dreamcast | wii | gamecube | nds | psp
)
293 # Generic options functions
296 # Show the configure help line for an option
298 tmpopt
=`echo $1 | sed 's/_/-/g'`
299 option
=`echo "--${tmpopt} " | sed "s/\(.\{23\}\).*/\1/"`
300 echo " ${option} ${2}"
303 # Show an error about an unknown option
305 echo "error: unrecognised option: $ac_option
306 Try \`$0 --help' for more information." >&2
312 # Engine handling functions
315 # Get the name of the engine
317 eval echo \
$_engine_$1_name
320 # Will this engine be built?
322 eval echo \
$_engine_$1_build
326 get_engine_subengines
() {
327 eval echo \
$_engine_$1_subengines
330 # Ask if this is a subengine
332 sub
=`eval echo \\$_engine_$1_sub`
333 if test -z "$sub" ; then
339 # Enable *all* engines
340 engine_enable_all
() {
341 for engine
in $_engines; do
342 eval _engine_
${engine}_build
=yes
346 # Disable *all* engines
347 engine_disable_all
() {
348 for engine
in $_engines; do
349 eval _engine_
${engine}_build
=no
353 # Enable the given engine
356 if ( echo $1 |
grep '=' ) 2> /dev
/null
> /dev
/null
; then
357 eng
=`echo $1 | cut -d '=' -f 1`
358 opt
=`echo $1 | cut -d '=' -f 2`
363 engine
=`echo $eng | sed 's/-/_/g'`
365 # Filter the parameter for the subengines
366 if test "`get_engine_sub ${engine}`" != "no" -a "$opt" != "yes" ; then
371 if test "$opt" = "static" -o "$opt" = "dynamic" -o "$opt" = "yes" ; then
372 if test "`get_engine_name ${engine}`" != "" ; then
373 eval _engine_
${engine}_build
=$opt
382 # Disable the given engine
384 # Filter malformed options
385 if ( echo $1 |
grep '=' ) 2> /dev
/null
> /dev
/null
; then
390 engine
=`echo $1 | sed 's/-/_/g'`
391 if test "`get_engine_name ${engine}`" != "" ; then
392 eval _engine_
${engine}_build
=no
398 # Show the configure help line for a given engine
400 if test `get_engine_build $1` = yes ; then
407 name
=`get_engine_name $1`
408 option_help
${option}-${1} "${do}build the ${name} engine
"
409 for sub in `get_engine_subengines $1`; do
410 show_subengine_help $sub $1
414 # Show the configure help line for a given subengine
415 show_subengine_help() {
416 if test `get_engine_build $1` = yes ; then
423 name=`get_engine_name $1`
424 parent=`get_engine_name $2`
425 option_help ${option}-${1} "${do} the ${name} in ${parent} engine"
428 # Prepare the strings about the engines to build
429 prepare_engine_build_strings
() {
430 string
=`get_engine_build_string $1 static`
431 if test -n "$string" ; then
432 _engines_built_static
="${_engines_built_static}#$string@"
435 string
=`get_engine_build_string $1 dynamic`
436 if test -n "$string" ; then
437 _engines_built_dynamic
="${_engines_built_dynamic}#$string@"
440 string
=`get_engine_build_string $1 no`
441 if test -n "$string" ; then
442 _engines_skipped
="${_engines_skipped}#$string@"
446 # Get the string about building an engine
447 get_engine_build_string
() {
449 engine_build
=`get_engine_build $1`
452 # Check if the current engine should be shown for the current status
453 if test $engine_build = $2 ; then
456 # Test for disabled sub-engines
457 if test $2 = no
; then
458 for subeng
in `get_engine_subengines $1` ; do
459 if test `get_engine_build $subeng` = no
; then
467 # Convert static/dynamic to yes to ease the check of subengines
468 if test $engine_build != no
; then
472 # The engine should be shown, build the string
473 if test $show = yes ; then
474 build_string_func
=get_
${1}_build_string
475 if ( type $build_string_func |
grep function ) 2> /dev
/null
> /dev
/null
; then
476 engine_string
=`$build_string_func $1 $engine_build`
478 engine_string
=`get_subengines_build_string $1 $engine_build`
481 engine_string
="`get_engine_name $1` $engine_string"
487 # Get the string about building subengines
488 get_subengines_build_string
() {
491 for subeng
in `get_engine_subengines $1` ; do
492 if test `get_engine_build $subeng` = $2 ; then
493 subengine_string
="$subengine_string [`get_engine_name $subeng`]"
498 if test $2 != no
; then
499 if test -n "$subengine_string" ; then
500 if test $all = yes ; then
501 subengine_string
="[all games]"
506 echo $subengine_string
509 # Engine specific build strings
510 get_scumm_build_string
() {
511 if test `get_engine_build $1` != no
; then
512 if test $2 != no
; then
515 get_subengines_build_string
$1 $2 "$base"
519 get_saga_build_string
() {
520 if test `get_engine_build $1` != no
; then
521 if test $2 != no
; then
524 get_subengines_build_string
$1 $2 "$base"
531 echo "Running ScummVM configure..."
532 echo "Configure run on" `date` > $TMPLOG
535 # Check any parameters we received
538 # * Change --disable-mad / --enable-mad to the way it's done in autoconf:
539 # That is, --without-mad / --with-mad=/prefix/to/mad. Useful for people
540 # who have Mad/Vorbis/ALSA installed in a non-standard locations.
543 for parm
in "$@" ; do
544 if test "$parm" = "--help" ||
test "$parm" = "-help" ||
test "$parm" = "-h" ; then
545 for engine
in $_engines; do
546 if test `get_engine_sub $engine` = no
; then
547 engines_help
="$engines_help`show_engine_help $engine`
553 Usage: $0 [OPTIONS]...
556 -h, --help display this help and exit
557 --backend=BACKEND backend to build (sdl, dc, gp2x, gp2xwiz, iphone, morphos, nds, psp, wii, wince, null) [sdl]
559 Installation directories:
560 --prefix=DIR use this prefix for installing ScummVM [/usr/local]
561 --bindir=DIR directory to install the scummvm binary in [PREFIX/bin]
562 --mandir=DIR directory to install the manpage in [PREFIX/share/man]
563 --datadir=DIR directory to install the data files in [PREFIX/share]
564 --libdir=DIR directory to install the plugins in [PREFIX/lib]
566 Special configuration feature:
567 --host=HOST cross-compile to target HOST (arm-linux, ...)
568 special targets: linupy for Yopy PDA
569 dreamcast for Sega Dreamcast
571 gamecube for Nintendo Gamecube
573 iphone for Apple iPhone
575 psp for PlayStation Portable
578 --disable-debug disable building with debugging symbols
579 --enable-Werror treat warnings as errors
580 --enable-all-engines enable all engines
581 --disable-all-engines disable all engines
583 --enable-plugins enable the support for dynamic plugins
584 --default-dynamic make plugins dynamic by default
585 --disable-mt32emu don't enable the integrated MT-32 emulator
586 --disable-hq-scalers exclude HQ2x and HQ3x scalers
587 --disable-scalers exclude scalers
588 --enable-text-console use text console instead of graphical console
591 --with-alsa-prefix=DIR Prefix where alsa is installed (optional)
592 --disable-alsa disable ALSA midi sound support [autodetect]
594 --with-ogg-prefix=DIR Prefix where libogg is installed (optional)
595 --with-vorbis-prefix=DIR Prefix where libvorbis is installed (optional)
596 --disable-vorbis disable Ogg Vorbis support [autodetect]
598 --with-tremor-prefix=DIR Prefix where tremor is installed (optional)
599 --disable-tremor disable tremor support [autodetect]
601 --with-mad-prefix=DIR Prefix where libmad is installed (optional)
602 --disable-mad disable libmad (MP3) support [autodetect]
604 --with-flac-prefix=DIR Prefix where libFLAC is installed (optional)
605 --disable-flac disable FLAC support [autodetect]
607 --with-zlib-prefix=DIR Prefix where zlib is installed (optional)
608 --disable-zlib disable zlib (compression) support [autodetect]
610 --with-mpeg2-prefix=DIR Prefix where libmpeg2 is installed (optional)
611 --enable-mpeg2 enable mpeg2 codec for cutscenes [no]
613 --with-fluidsynth-prefix=DIR Prefix where libfluidsynth is installed (optional)
614 --disable-fluidsynth disable fluidsynth MIDI driver [autodetect]
616 --with-sdl-prefix=DIR Prefix where the sdl-config script is installed (optional)
618 --with-nasm-prefix=DIR Prefix where nasm executable is installed (optional)
619 --disable-nasm disable assembly language optimizations [autodetect]
621 --with-readline-prefix=DIR Prefix where readline is installed (optional)
622 --disable-readline disable readline support in text console [autodetect]
624 Some influential environment variables:
625 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
626 nonstandard directory <lib dir>
627 CXX C++ compiler command
628 CXXFLAGS C++ compiler flags
629 CPPFLAGS C++ preprocessor flags, e.g. -I<include dir> if you have
630 headers in a nonstandard directory <include dir>
635 done # for parm in ...
639 for ac_option
in $@
; do
641 --disable-hq-scalers) _build_hq_scalers
=no
;;
642 --disable-scalers) _build_scalers
=no
;;
643 --enable-alsa) _alsa
=yes ;;
644 --disable-alsa) _alsa
=no
;;
645 --enable-vorbis) _vorbis
=yes ;;
646 --disable-vorbis) _vorbis
=no
;;
647 --enable-tremor) _tremor
=yes ;;
648 --disable-tremor) _tremor
=no
;;
649 --enable-flac) _flac
=yes ;;
650 --disable-flac) _flac
=no
;;
651 --enable-mad) _mad
=yes ;;
652 --disable-mad) _mad
=no
;;
653 --enable-zlib) _zlib
=yes ;;
654 --disable-zlib) _zlib
=no
;;
655 --enable-nasm) _nasm
=yes ;;
656 --disable-nasm) _nasm
=no
;;
657 --enable-mpeg2) _mpeg2
=yes ;;
658 --disable-fluidsynth) _fluidsynth
=no
;;
659 --enable-readline) _readline
=yes ;;
660 --disable-readline) _readline
=no
;;
661 --enable-plugins) _dynamic_modules
=yes ;;
662 --default-dynamic) _plugins_default
=dynamic
;;
663 --enable-mt32emu) _mt32emu
=yes ;;
664 --disable-mt32emu) _mt32emu
=no
;;
665 --enable-vkeybd) _vkeybd
=yes ;;
666 --disable-vkeybd) _vkeybd
=no
;;
667 --enable-keymapper) _keymapper
=yes ;;
668 --disable-keymapper) _keymapper
=no
;;
669 --enable-text-console) _text_console
=yes ;;
670 --disable-text-console) _text_console
=no
;;
671 --with-fluidsynth-prefix=*)
672 arg
=`echo $ac_option | cut -d '=' -f 2`
673 FLUIDSYNTH_CFLAGS
="-I$arg/include"
674 FLUIDSYNTH_LIBS
="-L$arg/lib"
676 --with-mpeg2-prefix=*)
677 arg
=`echo $ac_option | cut -d '=' -f 2`
678 MPEG2_CFLAGS
="-I$arg/include"
679 MPEG2_LIBS
="-L$arg/lib"
681 --with-alsa-prefix=*)
682 arg
=`echo $ac_option | cut -d '=' -f 2`
683 ALSA_CFLAGS
="-I$arg/include"
684 ALSA_LIBS
="-L$arg/lib"
687 arg
=`echo $ac_option | cut -d '=' -f 2`
688 OGG_CFLAGS
="-I$arg/include"
689 OGG_LIBS
="-L$arg/lib"
691 --with-vorbis-prefix=*)
692 arg
=`echo $ac_option | cut -d '=' -f 2`
693 VORBIS_CFLAGS
="-I$arg/include"
694 VORBIS_LIBS
="-L$arg/lib"
696 --with-tremor-prefix=*)
697 arg
=`echo $ac_option | cut -d '=' -f 2`
698 TREMOR_CFLAGS
="-I$arg/include"
699 TREMOR_LIBS
="-L$arg/lib"
701 --with-flac-prefix=*)
702 arg
=`echo $ac_option | cut -d '=' -f 2`
703 FLAC_CFLAGS
="-I$arg/include"
704 FLAC_LIBS
="-L$arg/lib"
707 arg
=`echo $ac_option | cut -d '=' -f 2`
708 MAD_CFLAGS
="-I$arg/include"
709 MAD_LIBS
="-L$arg/lib"
711 --with-zlib-prefix=*)
712 arg
=`echo $ac_option | cut -d '=' -f 2`
713 ZLIB_CFLAGS
="-I$arg/include"
714 ZLIB_LIBS
="-L$arg/lib"
716 --with-readline-prefix=*)
717 arg
=`echo $ac_option | cut -d '=' -f 2`
718 READLINE_CFLAGS
="-I$arg/include"
719 READLINE_LIBS
="-L$arg/lib"
722 _backend
=`echo $ac_option | cut -d '=' -f 2`
725 # debug is enabled by default
731 CXXFLAGS
="$CXXFLAGS -Werror"
734 DEBFLAGS
="-O2 -Wuninitialized"
737 CXXFLAGS
="$CXXFLAGS -pg"
738 LDFLAGS
="$LDFLAGS -pg"
741 arg
=`echo $ac_option | cut -d '=' -f 2`
742 _sdlpath
="$arg:$arg/bin"
744 --with-nasm-prefix=*)
745 arg
=`echo $ac_option | cut -d '=' -f 2`
746 _nasmpath
="$arg:$arg/bin"
748 --with-staticlib-prefix=*)
749 _staticlibpath
=`echo $ac_option | cut -d '=' -f 2`
752 _host
=`echo $ac_option | cut -d '=' -f 2`
755 _prefix
=`echo $ac_option | cut -d '=' -f 2`
758 _bindir
=`echo $ac_option | cut -d '=' -f 2`
761 _mandir
=`echo $ac_option | cut -d '=' -f 2`
764 _datadir
=`echo $ac_option | cut -d '=' -f 2`
767 _libdir
=`echo $ac_option | cut -d '=' -f 2`
769 --enable-all-engines)
772 --disable-all-engines)
776 engine_enable
`echo $ac_option | cut -d '-' -f 4-`
779 engine_disable
`echo $ac_option | cut -d '-' -f 4-`
787 CXXFLAGS
="$CXXFLAGS $DEBFLAGS"
789 guessed_host
=`$_srcdir/config.guess`
790 get_system_exe_extension
$guessed_host
791 NATIVEEXEEXT
=$_exeext
807 _host_os
=gp2xwiz-linux
809 _host_alias
=arm-open2x-linux
814 _host_alias
=arm-open2x-linux
823 _host_alias
=arm-apple-darwin9
828 _host_alias
=arm-wince-mingw32ce
838 CXXFLAGS
="$CXXFLAGS -ml -m4-single-only"
839 LDFLAGS
="$LDFLAGS -ml -m4-single-only"
844 _host_alias
=powerpc-gekko
849 _host_alias
=powerpc-gekko
858 _host_cpu
=mipsallegrexel
860 LDFLAGS
="$LDFLAGS -L$PSPDEV/psp/sdk/lib -specs=$_srcdir/backends/platform/psp/psp.spec"
863 if test -n "$_host"; then
864 guessed_host
=`$_srcdir/config.sub $_host`
866 _host_cpu
=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
867 _host_vendor
=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
868 _host_os
=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
872 if test -z "$_host_alias"; then
873 _host_alias
="$_host_cpu-$_host_os"
877 # Determine extension used for executables
879 get_system_exe_extension
$_host_os
883 # Determine separator used for $PATH
895 # Platform specific sanity checks
898 wii | gamecube | nds
)
899 if test -z "$DEVKITPRO"; then
900 echo "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to devkitPRO>"
905 if test -z "$PSPDEV"; then
906 echo "Please set PSPDEV in your environment. export PSPDEV=<path to psp toolchain>"
915 # Determine the C++ compiler
917 echo_n
"Looking for C++ compiler... "
919 # Check whether the given command is a working C++ compiler
921 cat <<EOF >tmp_cxx_compiler.cpp
922 class Foo { int a; };
923 int main(int argc, char **argv) {
924 Foo *a = new Foo(); delete a; return 0;
928 if test -n "$_host"; then
929 # In cross-compiling mode, we cannot run the result
930 eval "$1 $CXXFLAGS $LDFLAGS -o tmp_cxx_compiler$HOSTEXEEXT tmp_cxx_compiler.cpp" 2> /dev
/null
&& rm -f tmp_cxx_compiler
$HOSTEXEEXT tmp_cxx_compiler.cpp
932 eval "$1 $CXXFLAGS $LDFLAGS -o tmp_cxx_compiler$HOSTEXEEXT tmp_cxx_compiler.cpp" 2> /dev
/null
&& eval "./tmp_cxx_compiler$HOSTEXEEXT 2> /dev/null" && rm -rf tmp_cxx_compiler
$HOSTEXEEXT tmp_cxx_compiler.dSYM tmp_cxx_compiler.cpp
936 # Prepare a list of candidates for the C++ compiler
937 if test -n "$CXX" && test_compiler
"$CXX"; then
938 # Use the compiler specified in CXX
941 if test -n "$_host"; then
942 compilers
="$_host_alias-g++ $_host_alias-c++ $_host-g++ $_host-c++"
947 # Iterate over all candidates, pick the first working one
949 for compiler
in $compilers; do
950 if test_compiler
$compiler; then
958 if test -z "$CXX"; then
964 # Determine the compiler version
966 echocheck
"compiler version"
968 cxx_version
=`( $CXX -dumpversion ) 2>&1`
969 if test "$?" -gt 0; then
970 cxx_version
="not found"
974 2.95.
[2-9]|
2.95.
[2-9][-.
]*|
3.
[0-9]|
3.
[0-9].
[0-9]|
3.
[0-9].
[0-9][-.
]*|
4.
[0-9]|
4.
[0-9].
[0-9]|
4.
[0-9].
[0-9][-.
]*)
975 _cxx_major
=`echo $cxx_version | cut -d '.' -f 1`
976 _cxx_minor
=`echo $cxx_version | cut -d '.' -f 2`
977 cxx_version
="$cxx_version, ok"
980 # whacky beos version strings
981 2.9-beos-991026*|
2.9-beos-000224*)
984 cxx_version
="$cxx_version, ok"
995 cxx_version
="$cxx_version, bad"
1002 if test "$cxx_verc_fail" = yes ; then
1004 echo "The version of your compiler is not supported at this time"
1005 echo "Please ensure you are using GCC >= 2.95"
1010 # Check for endianness
1012 echo_n
"Checking endianness... "
1013 cat <<EOF >tmp_endianness_check.cpp
1014 short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
1015 short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
1016 void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; }
1017 short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
1018 short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
1019 void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; }
1020 int main() { _ascii (); _ebcdic (); return 0; }
1022 $CXX $CXXFLAGS -c -o tmp_endianness_check.o tmp_endianness_check.cpp
1023 if strings tmp_endianness_check.o |
grep BIGenDianSyS
>/dev
/null
; then
1029 rm -f tmp_endianness_check.o tmp_endianness_check.cpp
1032 # Determine a data type with the given length
1034 find_type_with_size
() {
1035 for datatype
in int short char long unknown
; do
1036 cat <<EOF >tmp_find_type_with_size.cpp
1037 typedef $datatype ac__type_sizeof_;
1039 static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) == $1)];
1044 if $CXX $CXXFLAGS -c -o tmp_find_type_with_size
$HOSTEXEEXT tmp_find_type_with_size.cpp
2>/dev
/null
; then
1047 if test "$datatype" = "unknown"; then
1048 echo "couldn't find data type with $1 bytes"
1054 rm -f tmp_find_type_with_size
$HOSTEXEEXT tmp_find_type_with_size.cpp
1059 # Determine data type sizes
1061 echo_n
"Type with 1 byte... "
1062 type_1_byte
=`find_type_with_size 1`
1065 test $TMP -eq 0 ||
exit 1 # check exit code of subshell
1067 echo_n
"Type with 2 bytes... "
1068 type_2_byte
=`find_type_with_size 2`
1071 test $TMP -eq 0 ||
exit 1 # check exit code of subshell
1073 echo_n
"Type with 4 bytes... "
1074 type_4_byte
=`find_type_with_size 4`
1077 test $TMP -eq 0 ||
exit 1 # check exit code of subshell
1080 # Check whether we can use x86 asm routines
1082 echo_n
"Compiling for x86... "
1084 i386|i486|i586|i686
)
1094 # Determine build settings
1096 echo_n
"Checking hosttype... "
1099 linux
* | uclinux
* | openbsd
* | netbsd
* | bsd
* | sunos
* | hpux
*)
1100 DEFINES
="$DEFINES -DUNIX"
1103 DEFINES
="$DEFINES -DUNIX"
1104 LDFLAGS
="$LDFLAGS -L/usr/local/lib"
1105 CXXFLAGS
="$CXXFLAGS -I/usr/local/include"
1108 DEFINES
="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
1109 # Needs -lbind -lsocket for the timidity MIDI driver
1110 LDFLAGS
="-L/boot/home/config/lib"
1111 CFLAGS
="-I/boot/home/config/include"
1112 CXXFLAGS
="$CXXFLAGS -fhuge-objects"
1113 LIBS
="$LIBS -lbind -lsocket"
1119 DEFINES
="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
1120 # Needs -lnetwork for the timidity MIDI driver
1121 LIBS
="$LIBS -lnetwork"
1122 CXXFLAGS
="$CXXFLAGS -fhuge-objects"
1128 DEFINES
="$DEFINES -DUNIX -DSOLARIS -DSYSTEM_NOT_SUPPORTING_D_TYPE"
1129 # Needs -lbind -lsocket for the timidity MIDI driver
1130 LIBS
="$LIBS -lnsl -lsocket"
1133 DEFINES
="$DEFINES -DUNIX -DIRIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
1138 DEFINES
="$DEFINES -DUNIX -DMACOSX"
1139 LIBS
="$LIBS -framework QuickTime -framework AudioUnit -framework AudioToolbox -framework Carbon -framework CoreMIDI"
1142 DEFINES
="$DEFINES -DWIN32 -D__USE_MINGW_ANSI_STDIO=0"
1143 LIBS
="$LIBS -lmingw32 -lwinmm"
1144 OBJS
="$OBJS scummvmico.o"
1147 echo ERROR
: Cygwin building is not supported by ScummVM anymore. Consider using MinGW.
1151 DEFINES
="$DEFINES -DUNIX"
1154 DEFINES
="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
1157 CXXFLAGS
="$CXXFLAGS -mcrt=newlib -mstrict-align -mcpu=750 -mtune=7400"
1158 LDFLAGS
="$LDFLAGS -mcrt=newlib -use-dynld -Lsobjs:"
1164 DEFINES
="$DEFINES -D__DC__ -DNONSTANDARD_PORT"
1167 CXXFLAGS
="$CXXFLAGS -Os -mrvl -mcpu=750 -meabi -mhard-float"
1168 CXXFLAGS
="$CXXFLAGS -ffunction-sections -fdata-sections -fmodulo-sched"
1169 CXXFLAGS
="$CXXFLAGS -I$DEVKITPRO/libogc/include"
1170 LDFLAGS
="$LDFLAGS -mrvl -mcpu=750 -L$DEVKITPRO/libogc/lib/wii"
1173 CXXFLAGS
="$CXXFLAGS -Os -mogc -mcpu=750 -meabi -mhard-float"
1174 CXXFLAGS
="$CXXFLAGS -ffunction-sections -fdata-sections -fmodulo-sched"
1175 CXXFLAGS
="$CXXFLAGS -I$DEVKITPRO/libogc/include"
1176 LDFLAGS
="$LDFLAGS -mogc -mcpu=750 -L$DEVKITPRO/libogc/lib/cube"
1182 CXXFLAGS
="$CXXFLAGS -O2 -G0 -I$PSPDEV/psp/sdk/include -D_PSP_FW_VERSION=150"
1185 CXXFLAGS
="$CXXFLAGS -O3 -march=armv4 -mtune=xscale -D_WIN32_WCE=300 -D__ARM__ -D_ARM_ -DUNICODE -DFPM_DEFAULT -DNONSTANDARD_PORT"
1186 CXXFLAGS
="$CXXFLAGS -DWIN32 -Dcdecl= -D__cdecl__= -Wno-multichar"
1188 # given this is a shell script assume some type of unix
1190 echo "WARNING: could not establish system type, assuming unix like"
1191 DEFINES
="$DEFINES -DUNIX"
1195 if test -n "$_host"; then
1196 # Cross-compiling mode - add your target here if needed
1199 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1200 DEFINES
="$DEFINES -DUNIX"
1203 add_line_to_config_h
"#define LINUPY"
1208 arm-linux|arm
*-linux-gnueabi|arm-
*-linux|
*-angstrom-linux)
1209 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1210 DEFINES
="$DEFINES -DUNIX -DUSE_ARM_SMUSH_ASM"
1211 #not true for all ARM systems, but the interesting ones are all LE. Most (if not all) BE arm devices don't have a screen
1217 add_line_to_config_mk
'USE_ARM_SOUND_ASM = 1'
1218 add_line_to_config_mk
'USE_ARM_SMUSH_ASM = 1'
1224 _ranlib
=$_host-ranlib
1228 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1229 DEFINES
="$DEFINES -DUNIX -DGP2XWIZ -DNDEBUG -DUSE_ARM_SMUSH_ASM -DUSE_ARM_GFX_ASM -DUSE_ARM_SCALER_ASM -DUSE_ARM_COSTUME_ASM"
1230 CXXFLAGS
="$CXXFLAGS -mcpu=arm926ej-s -mtune=arm926ej-s"
1237 _ar
="$_host_alias-ar cru"
1238 _ranlib
=$_host_alias-ranlib
1239 add_line_to_config_mk
'USE_ARM_SOUND_ASM = 1'
1240 add_line_to_config_mk
'USE_ARM_SMUSH_ASM = 1'
1241 add_line_to_config_mk
'USE_ARM_GFX_ASM = 1'
1242 add_line_to_config_mk
'USE_ARM_SCALER_ASM = 1'
1243 add_line_to_config_mk
'USE_ARM_COSTUME_ASM = 1'
1245 _build_hq_scalers
="no"
1249 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1250 DEFINES
="$DEFINES -DUNIX -DGP2X -DNDEBUG -DUSE_ARM_SMUSH_ASM -DUSE_ARM_GFX_ASM -DUSE_ARM_SCALER_ASM -DUSE_ARM_COSTUME_ASM"
1251 CXXFLAGS
="$CXXFLAGS -march=armv4t"
1252 LDFLAGS
="$LDFLAGS -static"
1258 _ar
="$_host_alias-ar cru"
1259 _ranlib
=$_host_alias-ranlib
1260 add_line_to_config_mk
'USE_ARM_SOUND_ASM = 1'
1261 add_line_to_config_mk
'USE_ARM_SMUSH_ASM = 1'
1262 add_line_to_config_mk
'USE_ARM_GFX_ASM = 1'
1263 add_line_to_config_mk
'USE_ARM_SCALER_ASM = 1'
1264 add_line_to_config_mk
'USE_ARM_COSTUME_ASM = 1'
1266 _build_hq_scalers
="no"
1270 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1271 DEFINES
="$DEFINES -DUNIX"
1274 add_line_to_config_h
"#define NEUROS"
1279 _build_hq_scalers
="no"
1283 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1291 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1292 DEFINES
="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
1298 _ranlib
=m68k-atari-mint-ranlib
1299 _ar
="m68k-atari-mint-ar cru"
1302 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1307 _sdlconfig
=$_host-sdl-config
1308 _windres
=$_host-windres
1310 _ranlib
=$_host-ranlib
1313 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1314 DEFINES
="$DEFINES -DIPHONE -DUNIX -DUSE_ARM_SMUSH_ASM"
1320 add_line_to_config_mk
'USE_ARM_SOUND_ASM = 1'
1321 add_line_to_config_mk
'USE_ARM_SMUSH_ASM = 1'
1323 _build_hq_scalers
="no"
1324 _ar
="$_host_alias-ar cru"
1325 _ranlib
=$_host_alias-ranlib
1326 _strip
=$_host_alias-strip
1329 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1330 LDFLAGS
="$LDFLAGS -Wl,-Map,scummvm.exe.map -Wl,--stack,65536"
1336 add_line_to_config_mk
'USE_TREMOLO = 1'
1337 add_line_to_config_mk
'USE_ARM_SOUND_ASM = 1'
1338 add_line_to_config_mk
'USE_ARM_SMUSH_ASM = 1'
1339 add_line_to_config_mk
'USE_ARM_GFX_ASM = 1'
1340 add_line_to_config_mk
'USE_ARM_COSTUME_ASM = 1'
1341 add_line_to_config_mk
'USE_ARM_SCALER_ASM = 1'
1343 _ar
="$_host_alias-ar cru"
1344 _ranlib
=$_host_alias-ranlib
1345 _strip
=$_host_alias-strip
1346 _windres
=$_host_alias-windres
1348 add_line_to_config_mk
'include $(srcdir)/backends/platform/wince/wince.mk'
1351 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1352 DEFINES
="$DEFINES -DDISABLE_DEFAULT_SAVEFILEMANAGER -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE"
1353 CXXFLAGS
="$CXXFLAGS -O3 -Wno-multichar -funroll-loops -fschedule-insns2 -fomit-frame-pointer -fdelete-null-pointer-checks -fno-exceptions"
1361 _build_hq_scalers
="no"
1364 _ar
="$_host_alias-ar cru"
1365 _ranlib
=$_host_alias-ranlib
1366 add_line_to_config_mk
'include $(srcdir)/backends/platform/dc/dreamcast.mk'
1369 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1375 _ar
="$_host_alias-ar cru"
1376 _ranlib
=$_host_alias-ranlib
1377 _strip
=$_host_alias-strip
1379 _build_hq_scalers
="no"
1380 add_line_to_config_mk
'GAMECUBE = 0'
1381 add_line_to_config_mk
'include $(srcdir)/backends/platform/wii/wii.mk'
1382 add_line_to_config_h
"#define DEBUG_WII_USBGECKO"
1383 add_line_to_config_h
"/* #define DEBUG_WII_MEMSTATS */"
1384 add_line_to_config_h
"/* #define DEBUG_WII_GDB */"
1385 add_line_to_config_h
"#define USE_WII_DI"
1386 add_line_to_config_h
"#define USE_WII_KBD"
1389 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1395 _ar
="$_host_alias-ar cru"
1396 _ranlib
=$_host_alias-ranlib
1397 _strip
=$_host_alias-strip
1399 _build_hq_scalers
="no"
1401 add_line_to_config_mk
'GAMECUBE = 1'
1402 add_line_to_config_mk
'include $(srcdir)/backends/platform/wii/wii.mk'
1403 add_line_to_config_h
'#define GAMECUBE'
1404 add_line_to_config_h
"/* #define DEBUG_WII_USBGECKO */"
1405 add_line_to_config_h
"/* #define DEBUG_WII_MEMSTATS */"
1406 add_line_to_config_h
"/* #define DEBUG_WII_GDB */"
1409 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1410 # TODO: complete this
1411 # TODO: Maybe rename nds -> ds (would be more consistent with other backends)
1412 DEFINES
="$DEFINES -DUSE_ARM_SMUSH_ASM"
1419 _build_hq_scalers
="no"
1421 add_line_to_config_mk
'include $(srcdir)/backends/platform/ds/ds.mk'
1422 # TODO: Enable more ARM optimizations -- requires testing!
1423 add_line_to_config_mk
'USE_ARM_SOUND_ASM = 1'
1424 add_line_to_config_mk
'USE_ARM_SMUSH_ASM = 1'
1427 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1433 _ar
="$_host_alias-ar cru"
1434 _ranlib
=$_host_alias-ranlib
1437 _build_hq_scalers
="no"
1439 add_line_to_config_mk
'include $(srcdir)/backends/platform/psp/psp.mk'
1442 echo "Continuing with auto-detected values ... if you have problems, please add your target to configure."
1448 # Check whether memory alignment is required
1450 echo_n
"Alignment required... "
1456 # Hardcode alignment requirements for Alpha processsors
1460 # Hardcode alignment requirements for SH processsors.
1461 # While these can emulate unaligned memory access, this
1462 # emulation is rather slow.
1466 # Hardcode alignment requirements for MIPS processsors.
1467 # While these can emulate unaligned memory access, this
1468 # emulation is rather slow.
1472 # Try to auto-detect....
1476 int main(int argc, char **argv) {
1477 unsigned char test[8] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 };
1478 signal(SIGBUS, exit);
1479 signal(SIGABRT, exit);
1480 signal(SIGSEGV, exit);
1481 if (*((unsigned int *)(test + 1)) != 0x55443322 && *((unsigned int *)(test + 1)) != 0x22334455) {
1488 cc_check
&& $TMPO$HOSTEXEEXT && _need_memalign
=no
1491 echo "$_need_memalign"
1495 # Add the results of the above checks to config.h
1499 add_line_to_config_h
'/* #define SCUMM_LITTLE_ENDIAN */'
1500 add_line_to_config_h
'#define SCUMM_BIG_ENDIAN'
1503 add_line_to_config_h
'#define SCUMM_LITTLE_ENDIAN'
1504 add_line_to_config_h
'/* #define SCUMM_BIG_ENDIAN */'
1511 add_to_config_h_if_yes
$_have_x86 '#define HAVE_X86'
1513 add_to_config_h_if_yes
$_need_memalign '#define SCUMM_NEED_ALIGNMENT'
1517 # Check whether plugin support is requested and possible
1519 echo_n
"Checking whether building plugins was requested... "
1520 echo "$_dynamic_modules"
1522 _def_plugin
="/* -> plugins disabled */"
1524 if test "$_dynamic_modules" = yes ; then
1525 echo_n
"Checking whether building plugins is supported... "
1529 #define PLUGIN_PREFIX "lib"
1530 #define PLUGIN_SUFFIX ".so"
1533 DYNAMIC_MODULES := 1
1534 PLUGIN_PREFIX := lib
1535 PLUGIN_SUFFIX := .so
1537 CXXFLAGS += -DDYNAMIC_MODULES
1539 PLUGIN_LDFLAGS += -shared
1540 PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive
1541 POST_OBJS_FLAGS := -Wl,-no-whole-archive
1547 #define PLUGIN_PREFIX "lib"
1548 #define PLUGIN_SUFFIX ".so"
1551 DYNAMIC_MODULES := 1
1552 PLUGIN_PREFIX := lib
1553 PLUGIN_SUFFIX := .so
1555 CXXFLAGS += -DDYNAMIC_MODULES
1557 PLUGIN_LDFLAGS += -shared
1558 PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive
1559 POST_OBJS_FLAGS := -Wl,-no-whole-archive
1564 #define PLUGIN_PREFIX ""
1565 #define PLUGIN_SUFFIX ".plugin"
1568 DYNAMIC_MODULES := 1
1570 PLUGIN_SUFFIX := .plugin
1571 PLUGIN_EXTRA_DEPS = $(EXECUTABLE)
1572 CXXFLAGS += -DDYNAMIC_MODULES
1573 PLUGIN_LDFLAGS += -bundle -bundle_loader $(EXECUTABLE) -exported_symbols_list "$(srcdir)/plugin.exp"
1574 PRE_OBJS_FLAGS := -all_load
1581 #define PLUGIN_PREFIX ""
1582 #define PLUGIN_SUFFIX ".dll"
1585 DYNAMIC_MODULES := 1
1587 PLUGIN_SUFFIX := .dll
1588 PLUGIN_EXTRA_DEPS = $(EXECUTABLE)
1589 CXXFLAGS += -DDYNAMIC_MODULES
1590 PLUGIN_LDFLAGS := -Wl,--enable-auto-import -shared ./libscummvm.a
1591 PRE_OBJS_FLAGS := -Wl,--whole-archive
1592 POST_OBJS_FLAGS := -Wl,--export-all-symbols -Wl,--no-whole-archive -Wl,--out-implib,./libscummvm.a
1597 #define PLUGIN_PREFIX ""
1598 #define PLUGIN_SUFFIX ".plugin"
1601 DYNAMIC_MODULES := 1
1603 PLUGIN_SUFFIX := .plugin
1604 PLUGIN_EXTRA_DEPS = $(EXECUTABLE)
1605 CXXFLAGS += -DDYNAMIC_MODULES
1607 PLUGIN_LDFLAGS += -shared
1608 PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive
1609 POST_OBJS_FLAGS := -Wl,-no-whole-archive
1615 #define PLUGIN_PREFIX ""
1616 #define PLUGIN_SUFFIX ".plg"
1619 DYNAMIC_MODULES := 1
1621 PLUGIN_SUFFIX := .plg
1622 PLUGIN_EXTRA_DEPS = $(abspath $(srcdir)/backends/platform/dc/plugin.x $(srcdir)/backends/platform/dc/plugin.syms) $(EXECUTABLE)
1623 CXXFLAGS += -DDYNAMIC_MODULES
1624 PLUGIN_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 -L$(ronindir)/lib
1625 PRE_OBJS_FLAGS := -Wl,--whole-archive
1626 POST_OBJS_FLAGS := -Wl,--no-whole-archive
1635 echo "$_dynamic_modules"
1640 # Check whether integrated MT-32 emulator support is requested
1642 if test "$_mt32emu" = no
; then
1643 _def_mt32emu
='#undef USE_MT32EMU'
1645 _def_mt32emu
='#define USE_MT32EMU'
1647 add_to_config_mk_if_yes
"$_mt32emu" 'USE_MT32EMU = 1'
1650 # Check whether to enable the (hq) scalers
1652 add_to_config_mk_if_no
$_build_hq_scalers 'DISABLE_HQ_SCALERS = 1'
1653 add_to_config_mk_if_no
$_build_scalers 'DISABLE_SCALERS = 1'
1656 # Check for math lib
1659 int main(void) { return 0; }
1661 cc_check
$LDFLAGS $CXXFLAGS -lm && LDFLAGS
="$LDFLAGS -lm"
1664 # Check for Ogg Vorbis
1666 echocheck
"Ogg Vorbis"
1667 if test "$_vorbis" = auto
; then
1670 #include <vorbis/codec.h>
1671 int main(void) { vorbis_packet_blocksize(0,0); return 0; }
1673 cc_check
$LDFLAGS $CXXFLAGS $OGG_CFLAGS $OGG_LIBS $VORBIS_CFLAGS $VORBIS_LIBS \
1674 -lvorbisfile -lvorbis -logg && _vorbis
=yes
1676 if test "$_vorbis" = yes ; then
1677 _def_vorbis
='#define USE_VORBIS'
1678 LIBS
="$LIBS $OGG_LIBS $VORBIS_LIBS -lvorbisfile -lvorbis -logg"
1679 INCLUDES
="$INCLUDES $OGG_CFLAGS $VORBIS_CFLAGS"
1681 _def_vorbis
='#undef USE_VORBIS'
1683 add_to_config_mk_if_yes
"$_vorbis" 'USE_VORBIS = 1'
1690 if test "$_tremor" = auto
; then
1693 #include <tremor/ivorbiscodec.h>
1694 int main(void) { vorbis_info_init(0); return 0; }
1696 cc_check
$LDFLAGS $CXXFLAGS $TREMOR_CFLAGS $TREMOR_LIBS -lvorbisidec && \
1699 if test "$_tremor" = yes && test "$_vorbis" = no
; then
1700 _def_tremor
='#define USE_TREMOR'
1701 _def_vorbis
='#define USE_VORBIS'
1702 LIBS
="$LIBS $TREMOR_LIBS -lvorbisidec"
1703 INCLUDES
="$INCLUDES $TREMOR_CFLAGS"
1705 if test "$_vorbis" = yes; then
1706 _tremor
="no (Ogg Vorbis/Tremor support is mutually exclusive)"
1708 _def_tremor
='#undef USE_TREMOR'
1710 add_to_config_mk_if_yes
"$_tremor" 'USE_TREMOR = 1'
1716 echocheck
"FLAC >= 1.0.1"
1717 if test "$_flac" = auto
; then
1720 #include <FLAC/format.h>
1721 int main(void) { return FLAC__STREAM_SYNC_LEN >> 30; /* guaranteed to be 0 */ }
1723 if test "$_vorbis" = yes ; then
1724 cc_check
$LDFLAGS $CXXFLAGS $FLAC_CFLAGS $FLAC_LIBS $OGG_CFLAGS $OGG_LIBS \
1725 -lFLAC -logg && _flac
=yes
1727 cc_check
$LDFLAGS $CXXFLAGS $FLAC_CFLAGS $FLAC_LIBS \
1731 if test "$_flac" = yes ; then
1732 _def_flac
='#define USE_FLAC'
1733 if test "$_vorbis" = yes ; then
1734 LIBS
="$LIBS $FLAC_LIBS $OGG_LIBS -lFLAC -logg"
1736 LIBS
="$LIBS $FLAC_LIBS -lFLAC"
1738 INCLUDES
="$INCLUDES $FLAC_CFLAGS"
1740 _def_flac
='#undef USE_FLAC'
1742 add_to_config_mk_if_yes
"$_flac" 'USE_FLAC = 1'
1746 # Check for MAD (MP3 library)
1749 if test "$_mad" = auto
; then
1753 int main(void) { return 0; }
1755 cc_check
$LDFLAGS $CXXFLAGS $MAD_CFLAGS $MAD_LIBS -lmad && _mad
=yes
1757 if test "$_mad" = yes ; then
1758 _def_mad
='#define USE_MAD'
1759 LIBS
="$LIBS $MAD_LIBS -lmad"
1760 INCLUDES
="$INCLUDES $MAD_CFLAGS"
1762 _def_mad
='#undef USE_MAD'
1764 add_to_config_mk_if_yes
"$_mad" 'USE_MAD = 1'
1770 echocheck
"ALSA >= 0.9"
1771 if test "$_alsa" = auto
; then
1774 #include <alsa/asoundlib.h>
1775 int main(void) { return (!(SND_LIB_MAJOR==0 && SND_LIB_MINOR==9)); }
1777 cc_check
$LDFLAGS $CXXFLAGS $ALSA_CFLAGS $ALSA_LIBS -lasound && _alsa
=yes
1779 if test "$_alsa" = yes ; then
1780 _def_alsa
='#define USE_ALSA'
1781 LIBS
="$LIBS $ALSA_LIBS -lasound"
1782 INCLUDES
="$INCLUDES $ALSA_CFLAGS"
1784 _def_alsa
='#undef USE_ALSA'
1792 if test "$_zlib" = auto
; then
1797 int main(void) { return strcmp(ZLIB_VERSION, zlibVersion()); }
1799 cc_check
$LDFLAGS $CXXFLAGS $ZLIB_CFLAGS $ZLIB_LIBS -lz && _zlib
=yes
1801 if test "$_zlib" = yes ; then
1802 _def_zlib
='#define USE_ZLIB'
1803 LIBS
="$LIBS $ZLIB_LIBS -lz"
1804 INCLUDES
="$INCLUDES $ZLIB_CFLAGS"
1806 _def_zlib
='#undef USE_ZLIB'
1808 add_to_config_mk_if_yes
"$_zlib" 'USE_ZLIB = 1'
1812 # Check for LibMPEG2
1814 echocheck
"libmpeg2 >= 0.3.2"
1815 if test "$_mpeg2" = auto
; then
1818 typedef signed $type_1_byte int8_t;
1819 typedef signed $type_2_byte int16_t;
1820 typedef signed $type_4_byte int32_t;
1822 typedef unsigned $type_1_byte uint8_t;
1823 typedef unsigned $type_2_byte uint16_t;
1824 typedef unsigned $type_4_byte uint32_t;
1826 #include <mpeg2dec/mpeg2.h>
1828 /* mpeg2_state_t first appears in 0.4.0 */
1829 mpeg2_state_t state;
1831 #ifdef MPEG2_RELEASE
1832 if (MPEG2_RELEASE >= MPEG2_VERSION(0, 3, 2))
1839 if test -n "$_host"; then
1840 # don't execute while cross compiling
1841 cc_check
$LDFLAGS $CXXFLAGS $MPEG2_CFLAGS $MPEG2_LIBS -lmpeg2 && _mpeg2
=yes
1843 cc_check
$LDFLAGS $CXXFLAGS $MPEG2_CFLAGS $MPEG2_LIBS -lmpeg2 && $TMPO$HOSTEXEEXT && _mpeg2
=yes
1846 if test "$_mpeg2" = yes ; then
1847 _def_mpeg2
='#define USE_MPEG2'
1848 INCLUDES
="$INCLUDES $MPEG2_CFLAGS"
1849 LIBS
="$LIBS $MPEG2_LIBS -lmpeg2"
1851 _def_mpeg2
='#undef USE_MPEG2'
1853 add_to_config_mk_if_yes
"$_mpeg2" 'USE_MPEG2 = 1'
1857 # Check for libfluidsynth
1859 echocheck
"libfluidsynth"
1860 if test "$_fluidsynth" = auto
; then
1863 #include <fluidsynth.h>
1864 int main(void) { return 0; }
1866 cc_check
$LDFLAGS $CXXFLAGS $FLUIDSYNTH_CFLAGS $FLUIDSYNTH_LIBS -lfluidsynth && _fluidsynth
=yes
1868 if test "$_fluidsynth" = yes ; then
1869 _def_fluidsynth
='#define USE_FLUIDSYNTH'
1872 LIBS
="$LIBS $FLUIDSYNTH_LIBS -lfluidsynth -ldsound -lwinmm"
1875 LIBS
="$LIBS $FLUIDSYNTH_LIBS -lfluidsynth"
1878 INCLUDES
="$INCLUDES $FLUIDSYNTH_CFLAGS"
1880 _def_fluidsynth
='#undef USE_FLUIDSYNTH'
1883 rm -rf $TMPC $TMPO$HOSTEXEEXT $TMPO.dSYM
1886 # Check for readline if text_console is enabled
1888 echocheck
"readline"
1889 if test "$_text_console" = yes ; then
1890 if test "$_readline" = auto
; then
1894 #include <readline/readline.h>
1895 #include <readline/history.h>
1898 char *x = readline("");
1901 cc_check
$LDFLAGS $CXXFLAGS $READLINE_CFLAGS $READLINE_LIBS -lreadline && _readline
=yes
1904 rm -rf $TMPC $TMPO$HOSTEXEEXT $TMPO.dSYM
1907 echo "skipping (text console disabled)"
1910 if test "$_readline" = yes ; then
1911 _def_readline
='#define USE_READLINE'
1912 LIBS
="$LIBS $READLINE_LIBS -lreadline"
1913 INCLUDES
="$INCLUDES $READLINE_CFLAGS"
1915 _def_readline
='#undef USE_READLINE'
1918 if test "$_text_console" = yes ; then
1919 _def_text_console
='#define USE_TEXT_CONSOLE'
1921 _def_text_console
='#undef USE_TEXT_CONSOLE'
1927 if test "$_have_x86" = yes ; then
1929 if test "$_nasm" = no
; then
1932 IFS
="${IFS= }"; ac_save_ifs
="$IFS"; IFS
=$SEPARATOR
1934 for path_dir
in $_nasmpath; do
1935 if test -x "$path_dir/nasm$NATIVEEXEEXT" ; then
1936 NASM
="$path_dir/nasm$NATIVEEXEEXT"
1944 if test x
$NASM = x
-o x
$NASM = x
'"$NASM"'; then
1953 NASMFLAGS
="-f win32"
1956 NASMFLAGS
="-f macho"
1967 add_to_config_h_if_yes
$_nasm '#define USE_NASM'
1968 add_to_config_mk_if_yes
$_nasm 'HAVE_NASM = 1'
1971 # Enable vkeybd / keymapper
1973 if test "$_vkeybd" = yes ; then
1974 DEFINES
="$DEFINES -DENABLE_VKEYBD"
1976 if test "$_keymapper" = yes ; then
1977 DEFINES
="$DEFINES -DENABLE_KEYMAPPER"
1981 # Figure out installation directories
1983 test -z "$_bindir" && _bindir
="$_prefix/bin"
1984 test -z "$_mandir" && _mandir
="$_prefix/share/man"
1985 test -z "$_datadir" && _datadir
="$_prefix/share"
1986 test -z "$_libdir" && _libdir
="$_prefix/lib"
1988 DEFINES
="$DEFINES -DDATA_PATH=\\\"$_datadir/scummvm\\\""
1989 DEFINES
="$DEFINES -DPLUGIN_DIRECTORY=\\\"$_libdir/scummvm\\\""
1992 echo_n
"Backend... "
1995 if test "$_nasm" = yes ; then
1996 echo_n
", assembly routines"
1999 if test "$_build_hq_scalers" = yes ; then
2000 echo_n
", HQ scalers"
2003 if test "$_mt32emu" = yes ; then
2004 echo_n
", MT-32 emu"
2007 if test "$_text_console" = yes ; then
2008 echo_n
", text console"
2011 if test "$_vkeybd" = yes ; then
2012 echo_n
", virtual keyboard"
2015 if test "$_keymapper" = yes ; then
2022 # Backend related stuff
2026 DEFINES
="$DEFINES -DUSE_NULL_DRIVER"
2030 INCLUDES
="$INCLUDES `$_sdlconfig --prefix="$_sdlpath" --cflags`"
2031 LIBS
="$LIBS `$_sdlconfig --prefix="$_sdlpath" --libs`"
2032 DEFINES
="$DEFINES -DSDL_BACKEND"
2036 INCLUDES
="$INCLUDES `$_sdlconfig --prefix="$_sdlpath" --cflags`"
2037 LIBS
="$LIBS `$_sdlconfig --prefix="$_sdlpath" --libs`"
2038 LDFLAGS
="$LDFLAGS -static"
2039 CXXFLAGS
="$CXXFLAGS -march=armv4t"
2043 INCLUDES
="$INCLUDES `$_sdlconfig --prefix="$_sdlpath" --cflags`"
2044 LIBS
="$LIBS `$_sdlconfig --prefix="$_sdlpath" --libs`"
2046 CXXFLAGS
="$CXXFLAGS -mcpu=arm926ej-s -mtune=arm926ej-s"
2049 OBJCFLAGS
="$OBJCFLAGS --std=c99"
2050 LIBS
="$LIBS -lobjc -framework UIKit -framework CoreGraphics -framework OpenGLES -framework QuartzCore -framework GraphicsServices -framework CoreFoundation -framework Foundation -framework AudioToolbox -framework CoreAudio"
2053 INCLUDES
="$INCLUDES "'-I$(srcdir) -I$(srcdir)/backends/platform/wince -I$(srcdir)/engines -I$(srcdir)/backends/platform/wince/missing/gcc -I$(srcdir)/backends/platform/wince/CEgui -I$(srcdir)/backends/platform/wince/CEkeys'
2054 LIBS
="$LIBS -static -lSDL"
2057 INCLUDES
="$INCLUDES "'-I$(srcdir)/backends/platform/dc -isystem $(ronindir)/include'
2058 LDFLAGS
="$LDFLAGS -Wl,-Ttext,0x8c010000 -nostartfiles "'$(ronindir)/lib/crt0.o -L$(ronindir)/lib'
2059 LIBS
="$LIBS -lronin -lm"
2062 DEFINES
="$DEFINES -D__WII__ -DGEKKO"
2065 LIBS
="$LIBS -lfat -logc -ldb"
2068 LIBS
="$LIBS -ldi -lfat -lwiiuse -lbte -logc -lwiikeyboard -ldb"
2076 DEFINES
="$DEFINES -D__PSP__ -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE"
2077 INCLUDES
="$INCLUDES -I$PSPDEV/psp/include/SDL"
2081 echo "support for $_backend backend not implemented in configure script yet"
2085 MODULES
="$MODULES backends/platform/$_backend"
2088 # Do CXXFLAGS now we know the compiler version
2090 if test "$_cxx_major" -ge "3" ; then
2092 # newlib-based system include files suppress non-C89 function
2093 # declarations under __STRICT_ANSI__
2094 mingw
* | dreamcast | wii | gamecube | psp | wince | amigaos
*)
2095 CXXFLAGS
="$CXXFLAGS -W -Wno-unused-parameter"
2098 CXXFLAGS
="$CXXFLAGS -ansi -W -Wno-unused-parameter"
2101 add_line_to_config_mk
'HAVE_GCC3 = 1'
2104 if test "$_cxx_major" -ge "4" && test "$_cxx_minor" -ge "3" ; then
2105 CXXFLAGS
="$CXXFLAGS -Wno-empty-body"
2107 CXXFLAGS
="$CXXFLAGS -Wconversion"
2110 # Some platforms use certain GNU extensions in header files
2112 wii | gamecube | psp
)
2115 CXXFLAGS
="$CXXFLAGS -pedantic"
2122 _engines_built_static
=""
2123 _engines_built_dynamic
=""
2126 for engine
in $_engines; do
2127 if test "`get_engine_sub $engine`" = "no" ; then
2128 # It's a main engine
2129 if test `get_engine_build $engine` = no
; then
2132 # If dynamic plugins aren't supported, mark
2133 # all the engines as static
2134 if test $_dynamic_modules = no
; then
2135 eval _engine_
${engine}_build
=static
2137 # If it wasn't explicitly marked as static or
2138 # dynamic, use the configured default
2139 if test `get_engine_build $engine` = yes ; then
2140 eval _engine_
${engine}_build
=${_plugins_default}
2144 # Prepare the defines
2145 if test `get_engine_build $engine` = dynamic
; then
2146 isbuilt
=DYNAMIC_PLUGIN
2148 eval _engine_
${engine}_build
=static
2149 isbuilt
=STATIC_PLUGIN
2153 # Prepare the information to be shown
2154 prepare_engine_build_strings
$engine
2156 # It's a subengine, just say yes or no
2157 if test "`get_engine_build $engine`" = "no" ; then
2165 defname
="ENABLE_`echo $engine | tr '[a-z]' '[A-Z]'`"
2166 if test "$isbuilt" = "no" ; then
2167 add_line_to_config_mk
"# $defname"
2169 add_line_to_config_mk
"$defname = $isbuilt"
2174 # Show which engines ("frontends") are to be built
2177 if test -n "$_engines_built_static" ; then
2178 echo "Engines (builtin):"
2179 echo $_engines_built_static |
sed 's/@/\
2184 if test -n "$_engines_built_dynamic" ; then
2185 echo "Engines (plugins):"
2186 echo $_engines_built_dynamic |
sed 's/@/\
2191 if test -n "$_engines_skipped" ; then
2192 echo "Engines Skipped:"
2193 echo $_engines_skipped |
sed 's/@/\
2200 echo "Creating config.h"
2201 cat > config.h
<< EOF
2202 /* This file is automatically generated by configure */
2203 /* DO NOT EDIT MANUALLY */
2211 typedef unsigned $type_1_byte byte;
2212 typedef unsigned int uint;
2213 typedef unsigned $type_1_byte uint8;
2214 typedef unsigned $type_2_byte uint16;
2215 typedef unsigned $type_4_byte uint32;
2216 typedef signed $type_1_byte int8;
2217 typedef signed $type_2_byte int16;
2218 typedef signed $type_4_byte int32;
2235 /* Plugin settings */
2238 #endif /* CONFIG_H */
2241 echo "Creating config.mk"
2242 cat > config.mk
<< EOF
2243 # -------- Generated by configure -----------
2246 CXXFLAGS := $CXXFLAGS
2251 WINDRES := $_windres
2252 WIN32PATH=$_win32path
2254 STATICLIBPATH=$_staticlibpath
2256 BACKEND := $_backend
2258 MODULE_DIRS += $MODULE_DIRS
2259 EXEEXT := $HOSTEXEEXT
2261 NASMFLAGS := $NASMFLAGS
2266 DATADIR := $_datadir
2271 INCLUDES += $INCLUDES
2278 SAVED_CONFIGFLAGS := $SAVED_CONFIGFLAGS
2279 SAVED_LDFLAGS := $SAVED_LDFLAGS
2280 SAVED_CXX := $SAVED_CXX
2281 SAVED_CXXFLAGS := $SAVED_CXXFLAGS
2282 SAVED_CPPFLAGS := $SAVED_CPPFLAGS
2286 # Create a custom Makefile when building outside the source tree
2287 # TODO: Add a better check than just looking for 'Makefile'
2289 if test ! -f Makefile
; then
2290 echo "Creating Makefile"
2292 cat > Makefile
<< EOF
2293 # -------- Generated by configure -----------
2295 vpath %.h \$(srcdir)
2296 vpath %.cpp \$(srcdir)
2297 vpath %.c \$(srcdir)
2298 vpath %.m \$(srcdir)
2299 vpath %.asm \$(srcdir)
2300 vpath %.s \$(srcdir)
2301 vpath %.S \$(srcdir)
2302 include \$(srcdir)/Makefile