animation opcode to set sprite done
[scummvm-innocent.git] / configure
blob387319b15d32fdde4263ea6796b9b794a0638aa4
1 #!/bin/sh
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 $
24 # $Id$
26 # Save the current environment variables for next runs
27 SAVED_CONFIGFLAGS=$@
28 SAVED_LDFLAGS=$LDFLAGS
29 SAVED_CXX=$CXX
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
41 ac_save_IFS="$IFS"
42 IFS="\\"
43 ac_TEMP_PATH=
44 for ac_dir in $PATH; do
45 IFS=$ac_save_IFS
46 if test -z "$ac_TEMP_PATH"; then
47 ac_TEMP_PATH="$ac_dir"
48 else
49 ac_TEMP_PATH="$ac_TEMP_PATH/$ac_dir"
51 done
52 PATH="$ac_TEMP_PATH"
53 export PATH
54 unset ac_TEMP_PATH
58 # Add an engine: id name build subengines
59 add_engine() {
60 _engines="${_engines} ${1}"
61 eval _engine_${1}_name='${2}'
62 eval _engine_${1}_build='${3}'
63 eval _engine_${1}_subengines='${4}'
64 for sub in ${4}; do
65 eval _engine_${sub}_sub=yes
66 done
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
103 # Default settings
105 # Default lib behaviour yes/no/auto
106 _vorbis=auto
107 _tremor=auto
108 _flac=auto
109 _mad=auto
110 _alsa=auto
111 _zlib=auto
112 _mpeg2=no
113 _fluidsynth=auto
114 _readline=auto
115 # Default option behaviour yes/no
116 _text_console=no
117 _mt32emu=yes
118 _build_hq_scalers=yes
119 _build_scalers=yes
120 # Default vkeybd/keymapper options
121 _vkeybd=no
122 _keymapper=no
123 # Default platform settings
124 _backend=sdl
125 _endian=unknown
126 _need_memalign=no
127 _have_x86=no
128 _dynamic_modules=no
129 _plugins_default=static
130 _nasm=auto
131 # Default commands
132 _ranlib=ranlib
133 _strip=strip
134 _ar="ar cru"
135 _windres=windres
136 _win32path="C:/scummvm"
137 _aos4path="Games:ScummVM"
138 _staticlibpath=/sw
139 _sdlconfig=sdl-config
140 _sdlpath="$PATH"
141 _nasmpath="$PATH"
142 NASMFLAGS=""
143 NASM=""
144 _prefix=/usr/local
145 # For cross compiling
146 _host=""
147 _host_cpu=""
148 _host_vendor=""
149 _host_os=""
150 _host_alias=""
152 _srcdir=`dirname $0`
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`
157 else
158 TMPO=./scummvm-conf
160 TMPC=${TMPO}.cpp
161 TMPLOG=config.log
163 cc_check() {
164 echo >> "$TMPLOG"
165 cat "$TMPC" >> "$TMPLOG"
166 echo >> "$TMPLOG"
167 echo "$CXX $TMPC -o $TMPO$HOSTEXEEXT $@" >> "$TMPLOG"
168 rm -f "$TMPO$HOSTEXEEXT"
169 ( $CXX $CXXFLAGS "$TMPC" -o "$TMPO$HOSTEXEEXT" "$@" ) >> "$TMPLOG" 2>&1
170 TMP="$?"
171 echo >> "$TMPLOG"
172 return "$TMP"
176 # Function to provide echo -n for bourne shells that don't have it
178 echo_n() {
179 printf "$@"
182 echocheck() {
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"'
189 '"$1"
192 # Add a line of data to config.h.
193 add_line_to_config_h() {
194 _config_h_data="$_config_h_data"'
195 '"$1"
198 add_to_config_h_if_yes() {
199 if test "$1" = yes ; then
200 add_line_to_config_h "$2"
201 else
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"
213 else
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"
225 else
226 add_line_to_config_mk "# $2"
231 # Determine sdl-config
233 # TODO: small bit of code to test sdl useability
234 find_sdlconfig() {
235 echo_n "Looking for sdl-config... "
236 sdlconfigs="$_sdlconfig:sdl-config:sdl11-config:sdl12-config"
237 _sdlconfig=
239 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$SEPARATOR"
240 for path_dir in $_sdlpath; do
241 #reset separator to parse sdlconfigs
242 IFS=":"
243 for sdlconfig in $sdlconfigs; do
244 if test -f "$path_dir/$sdlconfig" ; then
245 _sdlconfig="$path_dir/$sdlconfig"
246 echo $_sdlconfig
247 # Save the prefix
248 _sdlpath=$path_dir
249 if test `basename $path_dir` = bin ; then
250 _sdlpath=`dirname $path_dir`
252 # break at first sdl-config found in path
253 break 2
255 done
256 done
258 IFS="$ac_save_ifs"
260 if test -z "$_sdlconfig"; then
261 echo "none found!"
262 exit 1
267 # Determine extension used for executables
269 get_system_exe_extension() {
270 case $1 in
271 mingw* | *os2-emx | wince)
272 _exeext=".exe"
274 arm-riscos)
275 _exeext=",ff8"
277 gp2xwiz-linux)
278 _exeext=".wiz"
280 gp2x-linux)
281 _exeext=".gp2x"
283 dreamcast | wii | gamecube | nds | psp)
284 _exeext=".elf"
287 _exeext=""
289 esac
293 # Generic options functions
296 # Show the configure help line for an option
297 option_help() {
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
304 option_error() {
305 echo "error: unrecognised option: $ac_option
306 Try \`$0 --help' for more information." >&2
307 exit 1
312 # Engine handling functions
315 # Get the name of the engine
316 get_engine_name() {
317 eval echo \$_engine_$1_name
320 # Will this engine be built?
321 get_engine_build() {
322 eval echo \$_engine_$1_build
325 # Get the subengines
326 get_engine_subengines() {
327 eval echo \$_engine_$1_subengines
330 # Ask if this is a subengine
331 get_engine_sub() {
332 sub=`eval echo \\$_engine_$1_sub`
333 if test -z "$sub" ; then
334 sub=no
336 echo $sub
339 # Enable *all* engines
340 engine_enable_all() {
341 for engine in $_engines; do
342 eval _engine_${engine}_build=yes
343 done
346 # Disable *all* engines
347 engine_disable_all() {
348 for engine in $_engines; do
349 eval _engine_${engine}_build=no
350 done
353 # Enable the given engine
354 engine_enable() {
355 # Get the parameter
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`
359 else
360 eng=$1
361 opt=yes
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
367 option_error
368 return
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
374 else
375 option_error
377 else
378 option_error
382 # Disable the given engine
383 engine_disable() {
384 # Filter malformed options
385 if ( echo $1 | grep '=' ) 2> /dev/null > /dev/null ; then
386 option_error
387 return
390 engine=`echo $1 | sed 's/-/_/g'`
391 if test "`get_engine_name ${engine}`" != "" ; then
392 eval _engine_${engine}_build=no
393 else
394 option_error
398 # Show the configure help line for a given engine
399 show_engine_help() {
400 if test `get_engine_build $1` = yes ; then
401 option="disable"
402 do="don't "
403 else
404 option="enable"
405 do=""
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
411 done
414 # Show the configure help line for a given subengine
415 show_subengine_help() {
416 if test `get_engine_build $1` = yes ; then
417 option="disable"
418 do="exclude"
419 else
420 option="enable"
421 do="include"
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() {
448 engine_string=""
449 engine_build=`get_engine_build $1`
450 show=no
452 # Check if the current engine should be shown for the current status
453 if test $engine_build = $2 ; then
454 show=yes
455 else
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
460 engine_build=no
461 show=yes
463 done
467 # Convert static/dynamic to yes to ease the check of subengines
468 if test $engine_build != no ; then
469 engine_build=yes
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`
477 else
478 engine_string=`get_subengines_build_string $1 $engine_build`
481 engine_string="`get_engine_name $1` $engine_string"
484 echo $engine_string
487 # Get the string about building subengines
488 get_subengines_build_string() {
489 all=yes
490 subengine_string=$3
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`]"
494 else
495 all=no
497 done
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
513 base="[v0-v6 games]"
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
522 base="[ITE]"
524 get_subengines_build_string $1 $2 "$base"
529 # Greet user
531 echo "Running ScummVM configure..."
532 echo "Configure run on" `date` > $TMPLOG
535 # Check any parameters we received
537 # TODO:
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`
550 done
551 cat << EOF
553 Usage: $0 [OPTIONS]...
555 Configuration:
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
570 wii for Nintendo Wii
571 gamecube for Nintendo Gamecube
572 nds for Nintendo DS
573 iphone for Apple iPhone
574 wince for Windows CE
575 psp for PlayStation Portable
577 Optional Features:
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
582 $engines_help
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
590 Optional Libraries:
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>
633 exit 0
635 done # for parm in ...
637 DEBFLAGS="-g"
639 for ac_option in $@; do
640 case "$ac_option" in
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"
686 --with-ogg-prefix=*)
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"
706 --with-mad-prefix=*)
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"
721 --backend=*)
722 _backend=`echo $ac_option | cut -d '=' -f 2`
724 --enable-debug)
725 # debug is enabled by default
727 --disable-debug)
728 DEBFLAGS=""
730 --enable-Werror)
731 CXXFLAGS="$CXXFLAGS -Werror"
733 --enable-release)
734 DEBFLAGS="-O2 -Wuninitialized"
736 --enable-profiling)
737 CXXFLAGS="$CXXFLAGS -pg"
738 LDFLAGS="$LDFLAGS -pg"
740 --with-sdl-prefix=*)
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`
751 --host=*)
752 _host=`echo $ac_option | cut -d '=' -f 2`
754 --prefix=*)
755 _prefix=`echo $ac_option | cut -d '=' -f 2`
757 --bindir=*)
758 _bindir=`echo $ac_option | cut -d '=' -f 2`
760 --mandir=*)
761 _mandir=`echo $ac_option | cut -d '=' -f 2`
763 --datadir=*)
764 _datadir=`echo $ac_option | cut -d '=' -f 2`
766 --libdir=*)
767 _libdir=`echo $ac_option | cut -d '=' -f 2`
769 --enable-all-engines)
770 engine_enable_all
772 --disable-all-engines)
773 engine_disable_all
775 --enable-*)
776 engine_enable `echo $ac_option | cut -d '-' -f 4-`
778 --disable-*)
779 engine_disable `echo $ac_option | cut -d '-' -f 4-`
782 option_error
784 esac;
785 done;
787 CXXFLAGS="$CXXFLAGS $DEBFLAGS"
789 guessed_host=`$_srcdir/config.guess`
790 get_system_exe_extension $guessed_host
791 NATIVEEXEEXT=$_exeext
793 case $_host in
794 linupy)
795 _host_os=linux
796 _host_cpu=arm
798 arm-riscos)
799 _host_os=riscos
800 _host_cpu=arm
802 ppc-amigaos)
803 _host_os=amigaos
804 _host_cpu=ppc
806 gp2xwiz)
807 _host_os=gp2xwiz-linux
808 _host_cpu=arm
809 _host_alias=arm-open2x-linux
811 gp2x)
812 _host_os=gp2x-linux
813 _host_cpu=arm
814 _host_alias=arm-open2x-linux
816 i586-mingw32msvc)
817 _host_os=mingw32msvc
818 _host_cpu=i586
820 iphone)
821 _host_os=iphone
822 _host_cpu=arm
823 _host_alias=arm-apple-darwin9
825 wince)
826 _host_os=wince
827 _host_cpu=arm
828 _host_alias=arm-wince-mingw32ce
830 neuros)
831 _host_os=linux
832 _host_cpu=arm
834 dreamcast)
835 _host_os=dreamcast
836 _host_cpu=sh
837 _host_alias=sh-elf
838 CXXFLAGS="$CXXFLAGS -ml -m4-single-only"
839 LDFLAGS="$LDFLAGS -ml -m4-single-only"
841 wii)
842 _host_os=wii
843 _host_cpu=ppc
844 _host_alias=powerpc-gekko
846 gamecube)
847 _host_os=gamecube
848 _host_cpu=ppc
849 _host_alias=powerpc-gekko
851 nds)
852 _host_os=nds
853 _host_cpu=arm
854 _host_alias=arm-eabi
856 psp)
857 _host_os=psp
858 _host_cpu=mipsallegrexel
859 _host_alias=psp
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/'`
870 esac
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
880 HOSTEXEEXT=$_exeext
883 # Determine separator used for $PATH
885 case $_host_os in
886 os2-emx* )
887 SEPARATOR=";"
890 SEPARATOR=":"
892 esac
895 # Platform specific sanity checks
897 case $_host_os in
898 wii | gamecube | nds)
899 if test -z "$DEVKITPRO"; then
900 echo "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to devkitPRO>"
901 exit 1
904 psp)
905 if test -z "$PSPDEV"; then
906 echo "Please set PSPDEV in your environment. export PSPDEV=<path to psp toolchain>"
907 exit 1
912 esac
915 # Determine the C++ compiler
917 echo_n "Looking for C++ compiler... "
919 # Check whether the given command is a working C++ compiler
920 test_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
931 else
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
939 echo $CXX
940 else
941 if test -n "$_host"; then
942 compilers="$_host_alias-g++ $_host_alias-c++ $_host-g++ $_host-c++"
943 else
944 compilers="g++ c++"
947 # Iterate over all candidates, pick the first working one
948 CXX=
949 for compiler in $compilers; do
950 if test_compiler $compiler; then
951 CXX=$compiler
952 echo $CXX
953 break
955 done
958 if test -z "$CXX"; then
959 echo "none found!"
960 exit 1
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"
973 case $cxx_version in
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"
978 cxx_verc_fail=no
980 # whacky beos version strings
981 2.9-beos-991026*|2.9-beos-000224*)
982 _cxx_major=2
983 _cxx_minor=95
984 cxx_version="$cxx_version, ok"
985 cxx_verc_fail=no
987 3_4)
988 _cxx_major=3
989 _cxx_minor=4
991 'not found')
992 cxx_verc_fail=yes
995 cxx_version="$cxx_version, bad"
996 cxx_verc_fail=yes
998 esac
1000 echo "$cxx_version"
1002 if test "$cxx_verc_fail" = yes ; then
1003 echo
1004 echo "The version of your compiler is not supported at this time"
1005 echo "Please ensure you are using GCC >= 2.95"
1006 exit 1
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
1024 _endian=big
1025 else
1026 _endian=little
1028 echo $_endian;
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_;
1038 int main() {
1039 static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) == $1)];
1040 test_array [0] = 0;
1041 return 0;
1044 if $CXX $CXXFLAGS -c -o tmp_find_type_with_size$HOSTEXEEXT tmp_find_type_with_size.cpp 2>/dev/null ; then
1045 break
1046 else
1047 if test "$datatype" = "unknown"; then
1048 echo "couldn't find data type with $1 bytes"
1049 exit 1
1051 continue
1053 done
1054 rm -f tmp_find_type_with_size$HOSTEXEEXT tmp_find_type_with_size.cpp
1055 echo $datatype
1059 # Determine data type sizes
1061 echo_n "Type with 1 byte... "
1062 type_1_byte=`find_type_with_size 1`
1063 TMP="$?"
1064 echo "$type_1_byte"
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`
1069 TMP="$?"
1070 echo "$type_2_byte"
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`
1075 TMP="$?"
1076 echo "$type_4_byte"
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... "
1083 case $_host_cpu in
1084 i386|i486|i586|i686)
1085 _have_x86=yes
1088 _have_x86=no
1090 esac
1091 echo "$_have_x86"
1094 # Determine build settings
1096 echo_n "Checking hosttype... "
1097 echo $_host_os
1098 case $_host_os in
1099 linux* | uclinux* | openbsd* | netbsd* | bsd* | sunos* | hpux*)
1100 DEFINES="$DEFINES -DUNIX"
1102 freebsd*)
1103 DEFINES="$DEFINES -DUNIX"
1104 LDFLAGS="$LDFLAGS -L/usr/local/lib"
1105 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
1107 beos*)
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"
1114 type_1_byte='char'
1115 type_2_byte='short'
1116 type_4_byte='long'
1118 haiku*)
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"
1123 type_1_byte='char'
1124 type_2_byte='short'
1125 type_4_byte='long'
1127 solaris*)
1128 DEFINES="$DEFINES -DUNIX -DSOLARIS -DSYSTEM_NOT_SUPPORTING_D_TYPE"
1129 # Needs -lbind -lsocket for the timidity MIDI driver
1130 LIBS="$LIBS -lnsl -lsocket"
1132 irix*)
1133 DEFINES="$DEFINES -DUNIX -DIRIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
1134 LIBS="$LIBS -lmd "
1135 _ranlib=:
1137 darwin*)
1138 DEFINES="$DEFINES -DUNIX -DMACOSX"
1139 LIBS="$LIBS -framework QuickTime -framework AudioUnit -framework AudioToolbox -framework Carbon -framework CoreMIDI"
1141 mingw*)
1142 DEFINES="$DEFINES -DWIN32 -D__USE_MINGW_ANSI_STDIO=0"
1143 LIBS="$LIBS -lmingw32 -lwinmm"
1144 OBJS="$OBJS scummvmico.o"
1146 cygwin*)
1147 echo ERROR: Cygwin building is not supported by ScummVM anymore. Consider using MinGW.
1148 exit 0
1150 os2-emx*)
1151 DEFINES="$DEFINES -DUNIX"
1153 mint*)
1154 DEFINES="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
1156 amigaos*)
1157 CXXFLAGS="$CXXFLAGS -mcrt=newlib -mstrict-align -mcpu=750 -mtune=7400"
1158 LDFLAGS="$LDFLAGS -mcrt=newlib -use-dynld -Lsobjs:"
1159 type_1_byte='char'
1160 type_2_byte='short'
1161 type_4_byte='long'
1163 dreamcast)
1164 DEFINES="$DEFINES -D__DC__ -DNONSTANDARD_PORT"
1166 wii)
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"
1172 gamecube)
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"
1178 nds)
1179 # TODO nds
1181 psp)
1182 CXXFLAGS="$CXXFLAGS -O2 -G0 -I$PSPDEV/psp/sdk/include -D_PSP_FW_VERSION=150"
1184 wince)
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"
1193 esac
1195 if test -n "$_host"; then
1196 # Cross-compiling mode - add your target here if needed
1197 case "$_host" in
1198 linupy|arm-riscos)
1199 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1200 DEFINES="$DEFINES -DUNIX"
1201 _endian=little
1202 _need_memalign=yes
1203 add_line_to_config_h "#define LINUPY"
1204 type_1_byte='char'
1205 type_2_byte='short'
1206 type_4_byte='int'
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
1212 _endian=little
1213 _need_memalign=yes
1214 type_1_byte='char'
1215 type_2_byte='short'
1216 type_4_byte='int'
1217 add_line_to_config_mk 'USE_ARM_SOUND_ASM = 1'
1218 add_line_to_config_mk 'USE_ARM_SMUSH_ASM = 1'
1220 bfin*)
1221 _need_memalign=yes
1223 *darwin*)
1224 _ranlib=$_host-ranlib
1225 _strip=$_host-strip
1227 gp2xwiz)
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"
1231 LDFLAGS="$LDFLAGS"
1232 _endian=little
1233 _need_memalign=yes
1234 type_1_byte='char'
1235 type_2_byte='short'
1236 type_4_byte='int'
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'
1244 _backend="gp2xwiz"
1245 _build_hq_scalers="no"
1246 _mt32emu="no"
1248 gp2x)
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"
1253 _endian=little
1254 _need_memalign=yes
1255 type_1_byte='char'
1256 type_2_byte='short'
1257 type_4_byte='int'
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'
1265 _backend="gp2x"
1266 _build_hq_scalers="no"
1267 _mt32emu="no"
1269 neuros)
1270 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1271 DEFINES="$DEFINES -DUNIX"
1272 _endian=little
1273 _need_memalign=yes
1274 add_line_to_config_h "#define NEUROS"
1275 type_1_byte='char'
1276 type_2_byte='short'
1277 type_4_byte='int'
1278 _backend='null'
1279 _build_hq_scalers="no"
1280 _mt32emu="no"
1282 ppc-amigaos)
1283 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1284 _endian=big
1285 _need_memalign=yes
1286 type_1_byte='char'
1287 type_2_byte='short'
1288 type_4_byte='long'
1290 m68k-atari-mint)
1291 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1292 DEFINES="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
1293 _endian=big
1294 _need_memalign=yes
1295 type_1_byte='char'
1296 type_2_byte='short'
1297 type_4_byte='long'
1298 _ranlib=m68k-atari-mint-ranlib
1299 _ar="m68k-atari-mint-ar cru"
1301 *mingw32*)
1302 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1303 _endian=little
1304 type_1_byte='char'
1305 type_2_byte='short'
1306 type_4_byte='int'
1307 _sdlconfig=$_host-sdl-config
1308 _windres=$_host-windres
1309 _ar="$_host-ar cru"
1310 _ranlib=$_host-ranlib
1312 iphone)
1313 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1314 DEFINES="$DEFINES -DIPHONE -DUNIX -DUSE_ARM_SMUSH_ASM"
1315 _endian=little
1316 _need_memalign=yes
1317 type_1_byte='char'
1318 type_2_byte='short'
1319 type_4_byte='int'
1320 add_line_to_config_mk 'USE_ARM_SOUND_ASM = 1'
1321 add_line_to_config_mk 'USE_ARM_SMUSH_ASM = 1'
1322 _backend="iphone"
1323 _build_hq_scalers="no"
1324 _ar="$_host_alias-ar cru"
1325 _ranlib=$_host_alias-ranlib
1326 _strip=$_host_alias-strip
1328 wince)
1329 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1330 LDFLAGS="$LDFLAGS -Wl,-Map,scummvm.exe.map -Wl,--stack,65536"
1331 _endian=little
1332 _need_memalign=yes
1333 type_1_byte='char'
1334 type_2_byte='short'
1335 type_4_byte='int'
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'
1342 _backend="wince"
1343 _ar="$_host_alias-ar cru"
1344 _ranlib=$_host_alias-ranlib
1345 _strip=$_host_alias-strip
1346 _windres=$_host_alias-windres
1347 _mt32emu="no"
1348 add_line_to_config_mk 'include $(srcdir)/backends/platform/wince/wince.mk'
1350 dreamcast)
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"
1354 _endian=little
1355 _need_memalign=yes
1356 type_1_byte='char'
1357 type_2_byte='short'
1358 type_4_byte='int'
1359 _backend="dc"
1360 _build_scalers="no"
1361 _build_hq_scalers="no"
1362 _mad="yes"
1363 _zlib="yes"
1364 _ar="$_host_alias-ar cru"
1365 _ranlib=$_host_alias-ranlib
1366 add_line_to_config_mk 'include $(srcdir)/backends/platform/dc/dreamcast.mk'
1368 wii)
1369 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1370 _endian=big
1371 _need_memalign=yes
1372 type_1_byte='char'
1373 type_2_byte='short'
1374 type_4_byte='int'
1375 _ar="$_host_alias-ar cru"
1376 _ranlib=$_host_alias-ranlib
1377 _strip=$_host_alias-strip
1378 _backend="wii"
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"
1388 gamecube)
1389 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1390 _endian=big
1391 _need_memalign=yes
1392 type_1_byte='char'
1393 type_2_byte='short'
1394 type_4_byte='int'
1395 _ar="$_host_alias-ar cru"
1396 _ranlib=$_host_alias-ranlib
1397 _strip=$_host_alias-strip
1398 _backend="wii"
1399 _build_hq_scalers="no"
1400 _mt32emu="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 */"
1408 nds)
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"
1413 _endian=little
1414 _need_memalign=yes
1415 type_1_byte='char'
1416 type_2_byte='short'
1417 type_4_byte='int'
1418 _backend="nds"
1419 _build_hq_scalers="no"
1420 _mt32emu="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'
1426 psp)
1427 echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
1428 _endian=little
1429 _need_memalign=yes
1430 type_1_byte='char'
1431 type_2_byte='short'
1432 type_4_byte='int'
1433 _ar="$_host_alias-ar cru"
1434 _ranlib=$_host_alias-ranlib
1435 _backend="psp"
1436 _build_scalers="no"
1437 _build_hq_scalers="no"
1438 _mt32emu="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."
1444 esac
1446 else
1448 # Check whether memory alignment is required
1450 echo_n "Alignment required... "
1451 case $_host_cpu in
1452 arm*)
1453 _need_memalign=yes
1455 alpha*)
1456 # Hardcode alignment requirements for Alpha processsors
1457 _need_memalign=yes
1459 sh*)
1460 # Hardcode alignment requirements for SH processsors.
1461 # While these can emulate unaligned memory access, this
1462 # emulation is rather slow.
1463 _need_memalign=yes
1465 mips*)
1466 # Hardcode alignment requirements for MIPS processsors.
1467 # While these can emulate unaligned memory access, this
1468 # emulation is rather slow.
1469 _need_memalign=yes
1472 # Try to auto-detect....
1473 cat > $TMPC << EOF
1474 #include <stdlib.h>
1475 #include <signal.h>
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) {
1482 return 1;
1484 return 0;
1487 _need_memalign=yes
1488 cc_check && $TMPO$HOSTEXEEXT && _need_memalign=no
1490 esac
1491 echo "$_need_memalign"
1495 # Add the results of the above checks to config.h
1497 case $_endian in
1498 big)
1499 add_line_to_config_h '/* #define SCUMM_LITTLE_ENDIAN */'
1500 add_line_to_config_h '#define SCUMM_BIG_ENDIAN'
1502 little)
1503 add_line_to_config_h '#define SCUMM_LITTLE_ENDIAN'
1504 add_line_to_config_h '/* #define SCUMM_BIG_ENDIAN */'
1507 exit 1
1509 esac
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"
1521 _mak_plugins=
1522 _def_plugin="/* -> plugins disabled */"
1524 if test "$_dynamic_modules" = yes ; then
1525 echo_n "Checking whether building plugins is supported... "
1526 case $_host_os in
1527 linux*)
1528 _def_plugin='
1529 #define PLUGIN_PREFIX "lib"
1530 #define PLUGIN_SUFFIX ".so"
1532 _mak_plugins='
1533 DYNAMIC_MODULES := 1
1534 PLUGIN_PREFIX := lib
1535 PLUGIN_SUFFIX := .so
1536 PLUGIN_EXTRA_DEPS =
1537 CXXFLAGS += -DDYNAMIC_MODULES
1538 CXXFLAGS += -fpic
1539 PLUGIN_LDFLAGS += -shared
1540 PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive
1541 POST_OBJS_FLAGS := -Wl,-no-whole-archive
1542 LIBS += -ldl
1545 freebsd*)
1546 _def_plugin='
1547 #define PLUGIN_PREFIX "lib"
1548 #define PLUGIN_SUFFIX ".so"
1550 _mak_plugins='
1551 DYNAMIC_MODULES := 1
1552 PLUGIN_PREFIX := lib
1553 PLUGIN_SUFFIX := .so
1554 PLUGIN_EXTRA_DEPS =
1555 CXXFLAGS += -DDYNAMIC_MODULES
1556 CXXFLAGS += -fpic
1557 PLUGIN_LDFLAGS += -shared
1558 PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive
1559 POST_OBJS_FLAGS := -Wl,-no-whole-archive
1562 darwin*)
1563 _def_plugin='
1564 #define PLUGIN_PREFIX ""
1565 #define PLUGIN_SUFFIX ".plugin"
1567 _mak_plugins='
1568 DYNAMIC_MODULES := 1
1569 PLUGIN_PREFIX :=
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
1575 POST_OBJS_FLAGS :=
1576 LIBS += -ldl
1579 *mingw32*)
1580 _def_plugin='
1581 #define PLUGIN_PREFIX ""
1582 #define PLUGIN_SUFFIX ".dll"
1584 _mak_plugins='
1585 DYNAMIC_MODULES := 1
1586 PLUGIN_PREFIX :=
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
1595 gp2xwiz*)
1596 _def_plugin='
1597 #define PLUGIN_PREFIX ""
1598 #define PLUGIN_SUFFIX ".plugin"
1600 _mak_plugins='
1601 DYNAMIC_MODULES := 1
1602 PLUGIN_PREFIX :=
1603 PLUGIN_SUFFIX := .plugin
1604 PLUGIN_EXTRA_DEPS = $(EXECUTABLE)
1605 CXXFLAGS += -DDYNAMIC_MODULES
1606 CXXFLAGS += -fpic
1607 PLUGIN_LDFLAGS += -shared
1608 PRE_OBJS_FLAGS := -Wl,-export-dynamic -Wl,-whole-archive
1609 POST_OBJS_FLAGS := -Wl,-no-whole-archive
1610 LIBS += -ldl
1613 dreamcast)
1614 _def_plugin='
1615 #define PLUGIN_PREFIX ""
1616 #define PLUGIN_SUFFIX ".plg"
1618 _mak_plugins='
1619 DYNAMIC_MODULES := 1
1620 PLUGIN_PREFIX :=
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
1630 _dynamic_modules=no
1631 _mak_plugins=
1632 _def_plugin=
1634 esac
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'
1644 else
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
1658 cat > $TMPC << EOF
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
1668 _vorbis=no
1669 cat > $TMPC << EOF
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"
1680 else
1681 _def_vorbis='#undef USE_VORBIS'
1683 add_to_config_mk_if_yes "$_vorbis" 'USE_VORBIS = 1'
1684 echo "$_vorbis"
1687 # Check for Tremor
1689 echocheck "Tremor"
1690 if test "$_tremor" = auto ; then
1691 _tremor=no
1692 cat > $TMPC << EOF
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 && \
1697 _tremor=yes
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"
1704 else
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'
1711 echo "$_tremor"
1714 # Check for FLAC
1716 echocheck "FLAC >= 1.0.1"
1717 if test "$_flac" = auto ; then
1718 _flac=no
1719 cat > $TMPC << EOF
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
1726 else
1727 cc_check $LDFLAGS $CXXFLAGS $FLAC_CFLAGS $FLAC_LIBS \
1728 -lFLAC && _flac=yes
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"
1735 else
1736 LIBS="$LIBS $FLAC_LIBS -lFLAC"
1738 INCLUDES="$INCLUDES $FLAC_CFLAGS"
1739 else
1740 _def_flac='#undef USE_FLAC'
1742 add_to_config_mk_if_yes "$_flac" 'USE_FLAC = 1'
1743 echo "$_flac"
1746 # Check for MAD (MP3 library)
1748 echocheck "MAD"
1749 if test "$_mad" = auto ; then
1750 _mad=no
1751 cat > $TMPC << EOF
1752 #include <mad.h>
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"
1761 else
1762 _def_mad='#undef USE_MAD'
1764 add_to_config_mk_if_yes "$_mad" 'USE_MAD = 1'
1765 echo "$_mad"
1768 # Check for ALSA
1770 echocheck "ALSA >= 0.9"
1771 if test "$_alsa" = auto ; then
1772 _alsa=no
1773 cat > $TMPC << EOF
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"
1783 else
1784 _def_alsa='#undef USE_ALSA'
1786 echo "$_alsa"
1789 # Check for ZLib
1791 echocheck "zlib"
1792 if test "$_zlib" = auto ; then
1793 _zlib=no
1794 cat > $TMPC << EOF
1795 #include <string.h>
1796 #include <zlib.h>
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"
1805 else
1806 _def_zlib='#undef USE_ZLIB'
1808 add_to_config_mk_if_yes "$_zlib" 'USE_ZLIB = 1'
1809 echo "$_zlib"
1812 # Check for LibMPEG2
1814 echocheck "libmpeg2 >= 0.3.2"
1815 if test "$_mpeg2" = auto ; then
1816 _mpeg2=no
1817 cat > $TMPC << EOF
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>
1827 int main(void) {
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))
1833 return 0;
1834 #endif
1835 return 1;
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
1842 else
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"
1850 else
1851 _def_mpeg2='#undef USE_MPEG2'
1853 add_to_config_mk_if_yes "$_mpeg2" 'USE_MPEG2 = 1'
1854 echo "$_mpeg2"
1857 # Check for libfluidsynth
1859 echocheck "libfluidsynth"
1860 if test "$_fluidsynth" = auto ; then
1861 _fluidsynth=no
1862 cat > $TMPC << EOF
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'
1870 case $_host_os in
1871 mingw*)
1872 LIBS="$LIBS $FLUIDSYNTH_LIBS -lfluidsynth -ldsound -lwinmm"
1875 LIBS="$LIBS $FLUIDSYNTH_LIBS -lfluidsynth"
1877 esac
1878 INCLUDES="$INCLUDES $FLUIDSYNTH_CFLAGS"
1879 else
1880 _def_fluidsynth='#undef USE_FLUIDSYNTH'
1882 echo "$_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
1891 _readline=no
1892 cat > $TMPC << EOF
1893 #include <stdio.h>
1894 #include <readline/readline.h>
1895 #include <readline/history.h>
1897 int main(void) {
1898 char *x = readline("");
1901 cc_check $LDFLAGS $CXXFLAGS $READLINE_CFLAGS $READLINE_LIBS -lreadline && _readline=yes
1903 echo "$_readline"
1904 rm -rf $TMPC $TMPO$HOSTEXEEXT $TMPO.dSYM
1905 else
1906 _readline=no
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"
1914 else
1915 _def_readline='#undef USE_READLINE'
1918 if test "$_text_console" = yes ; then
1919 _def_text_console='#define USE_TEXT_CONSOLE'
1920 else
1921 _def_text_console='#undef USE_TEXT_CONSOLE'
1925 # Check for nasm
1927 if test "$_have_x86" = yes ; then
1928 echocheck "nasm"
1929 if test "$_nasm" = no ; then
1930 echo "disabled"
1931 else
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"
1937 echo $NASM
1938 break
1940 done
1942 IFS="$ac_save_ifs"
1944 if test x$NASM = x -o x$NASM = x'"$NASM"'; then
1945 echo "not found"
1946 _nasm=no
1947 else
1948 case $_host_os in
1949 os2-emx*)
1950 NASMFLAGS="-f aout"
1952 mingw*)
1953 NASMFLAGS="-f win32"
1955 darwin*)
1956 NASMFLAGS="-f macho"
1959 NASMFLAGS="-f elf"
1961 esac
1962 _nasm=yes
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... "
1993 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
2016 echo ", keymapper"
2017 else
2018 echo
2022 # Backend related stuff
2024 case $_backend in
2025 null)
2026 DEFINES="$DEFINES -DUSE_NULL_DRIVER"
2028 sdl)
2029 find_sdlconfig
2030 INCLUDES="$INCLUDES `$_sdlconfig --prefix="$_sdlpath" --cflags`"
2031 LIBS="$LIBS `$_sdlconfig --prefix="$_sdlpath" --libs`"
2032 DEFINES="$DEFINES -DSDL_BACKEND"
2034 gp2x)
2035 find_sdlconfig
2036 INCLUDES="$INCLUDES `$_sdlconfig --prefix="$_sdlpath" --cflags`"
2037 LIBS="$LIBS `$_sdlconfig --prefix="$_sdlpath" --libs`"
2038 LDFLAGS="$LDFLAGS -static"
2039 CXXFLAGS="$CXXFLAGS -march=armv4t"
2041 gp2xwiz)
2042 find_sdlconfig
2043 INCLUDES="$INCLUDES `$_sdlconfig --prefix="$_sdlpath" --cflags`"
2044 LIBS="$LIBS `$_sdlconfig --prefix="$_sdlpath" --libs`"
2045 LDFLAGS="$LDFLAGS"
2046 CXXFLAGS="$CXXFLAGS -mcpu=arm926ej-s -mtune=arm926ej-s"
2048 iphone)
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"
2052 wince)
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"
2061 wii)
2062 DEFINES="$DEFINES -D__WII__ -DGEKKO"
2063 case $_host_os in
2064 gamecube)
2065 LIBS="$LIBS -lfat -logc -ldb"
2068 LIBS="$LIBS -ldi -lfat -lwiiuse -lbte -logc -lwiikeyboard -ldb"
2070 esac
2072 nds)
2073 # TODO nds
2075 psp)
2076 DEFINES="$DEFINES -D__PSP__ -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE"
2077 INCLUDES="$INCLUDES -I$PSPDEV/psp/include/SDL"
2078 LIBS="$LIBS -lSDL"
2081 echo "support for $_backend backend not implemented in configure script yet"
2082 exit 1
2084 esac
2085 MODULES="$MODULES backends/platform/$_backend"
2088 # Do CXXFLAGS now we know the compiler version
2090 if test "$_cxx_major" -ge "3" ; then
2091 case $_host_os in
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"
2100 esac
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"
2106 else
2107 CXXFLAGS="$CXXFLAGS -Wconversion"
2110 # Some platforms use certain GNU extensions in header files
2111 case $_host_os in
2112 wii | gamecube | psp)
2115 CXXFLAGS="$CXXFLAGS -pedantic"
2117 esac
2120 # Engine selection
2122 _engines_built_static=""
2123 _engines_built_dynamic=""
2124 _engines_skipped=""
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
2130 isbuilt=no
2131 else
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
2136 else
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
2147 else
2148 eval _engine_${engine}_build=static
2149 isbuilt=STATIC_PLUGIN
2153 # Prepare the information to be shown
2154 prepare_engine_build_strings $engine
2155 else
2156 # It's a subengine, just say yes or no
2157 if test "`get_engine_build $engine`" = "no" ; then
2158 isbuilt=no
2159 else
2160 isbuilt=1
2164 # Save the settings
2165 defname="ENABLE_`echo $engine | tr '[a-z]' '[A-Z]'`"
2166 if test "$isbuilt" = "no" ; then
2167 add_line_to_config_mk "# $defname"
2168 else
2169 add_line_to_config_mk "$defname = $isbuilt"
2171 done
2174 # Show which engines ("frontends") are to be built
2176 echo
2177 if test -n "$_engines_built_static" ; then
2178 echo "Engines (builtin):"
2179 echo $_engines_built_static | sed 's/@/\
2181 s/#/ /g'
2184 if test -n "$_engines_built_dynamic" ; then
2185 echo "Engines (plugins):"
2186 echo $_engines_built_dynamic | sed 's/@/\
2188 s/#/ /g'
2191 if test -n "$_engines_skipped" ; then
2192 echo "Engines Skipped:"
2193 echo $_engines_skipped | sed 's/@/\
2195 s/#/ /g'
2199 echo
2200 echo "Creating config.h"
2201 cat > config.h << EOF
2202 /* This file is automatically generated by configure */
2203 /* DO NOT EDIT MANUALLY */
2205 #ifndef CONFIG_H
2206 #define CONFIG_H
2208 $_config_h_data
2210 /* Data types */
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;
2220 /* Libs */
2221 $_def_vorbis
2222 $_def_tremor
2223 $_def_flac
2224 $_def_mad
2225 $_def_alsa
2226 $_def_zlib
2227 $_def_mpeg2
2228 $_def_fluidsynth
2229 $_def_readline
2231 /* Options */
2232 $_def_text_console
2233 $_def_mt32emu
2235 /* Plugin settings */
2236 $_def_plugin
2238 #endif /* CONFIG_H */
2241 echo "Creating config.mk"
2242 cat > config.mk << EOF
2243 # -------- Generated by configure -----------
2245 CXX := $CXX
2246 CXXFLAGS := $CXXFLAGS
2247 LIBS += $LIBS
2248 RANLIB := $_ranlib
2249 STRIP := $_strip
2250 AR := $_ar
2251 WINDRES := $_windres
2252 WIN32PATH=$_win32path
2253 AOS4PATH=$_aos4path
2254 STATICLIBPATH=$_staticlibpath
2256 BACKEND := $_backend
2257 MODULES += $MODULES
2258 MODULE_DIRS += $MODULE_DIRS
2259 EXEEXT := $HOSTEXEEXT
2260 NASM := $NASM
2261 NASMFLAGS := $NASMFLAGS
2263 PREFIX := $_prefix
2264 BINDIR := $_bindir
2265 MANDIR := $_mandir
2266 DATADIR := $_datadir
2267 LIBDIR := $_libdir
2269 $_config_mk_data
2271 INCLUDES += $INCLUDES
2272 OBJS += $OBJS
2273 DEFINES += $DEFINES
2274 LDFLAGS += $LDFLAGS
2276 $_mak_plugins
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 -----------
2294 srcdir = $_srcdir
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