BUILD: Reorder configure some more

This commit is contained in:
Max Horn 2011-05-26 11:02:46 +02:00
parent d5050463d5
commit de8a44abfc

251
configure vendored
View file

@ -134,21 +134,19 @@ _mpeg2=no
_png=auto
_theoradec=auto
_fluidsynth=auto
_16bit=auto
_opengl=auto
_opengles=auto
_readline=auto
# Default option behaviour yes/no
_debug_build=auto
_release_build=auto
_verbose_build=no
_text_console=no
_mt32emu=yes
_build_scalers=yes
_build_hq_scalers=yes
_enable_prof=no
_posix=no
_global_constructors=no
_elf_loader=no
# Default vkeybd/keymapper options
_vkeybd=no
_keymapper=no
@ -156,12 +154,9 @@ _keymapper=no
_translation=yes
# Default platform settings
_backend=sdl
_endian=unknown
_need_memalign=yes
_have_x86=no
_arm_asm=no
_verbose_build=no
_16bit=auto
_dynamic_modules=no
_elf_loader=no
_plugins_default=static
_plugin_prefix=
_plugin_suffix=
@ -180,6 +175,15 @@ _sdlpath="$PATH"
_nasmpath="$PATH"
NASMFLAGS=""
NASM=""
# The following variables are automatically detected, and should not
# be modified otherwise. Consider them read-only.
_posix=no
_endian=unknown
_need_memalign=yes
_have_x86=no
_arm_asm=no
# Directories for installing ScummVM.
# This list is closely based on what GNU autoconf does,
@ -1469,6 +1473,20 @@ fi
echo $_endian;
cc_check_clean tmp_endianness_check.cpp
case $_endian in
big)
add_line_to_config_h '#undef SCUMM_LITTLE_ENDIAN'
add_line_to_config_h '#define SCUMM_BIG_ENDIAN'
;;
little)
add_line_to_config_h '#define SCUMM_LITTLE_ENDIAN'
add_line_to_config_h '#undef SCUMM_BIG_ENDIAN'
;;
*)
exit 1
;;
esac
#
# Determine a data type with the given length
#
@ -1517,6 +1535,85 @@ TMPR="$?"
echo "$type_4_byte"
test $TMPR -eq 0 || exit 1 # check exit code of subshell
#
# Check whether memory alignment is required
#
# For some CPU types, unaligned memory access is either not supported at
# all (and so leads to a crash), requires a super-slow emulation via an
# exception handler, or just results in incorrect results.
# On the other hand, accessing data in a manner that works regardless of
# alignment can be a lot slower than regular access, so we don't want
# to use it if we don't have to.
#
# So we do the following: For CPU families where we know whether unaligned
# access is safe & fast, we enable / disable unaligned access accordingly.
# Otherwise, we just disable memory alignment.
#
# NOTE: In the past, for non-cross compiled builds, we would also run some code
# which would try to test whether unaligned access worked or not. But this test
# could not reliably determine whether unaligned access really worked in all
# situations (and across different implementations of the target CPU arch), nor
# whether it was fast (as opposed to slowly emulated by fault handlers). Hence,
# we do not use this approach anymore.
#
# NOTE: The only kinds of unaligned access we allow are for 2 byte and 4
# byte loads / stores. No promises are made for bigger sizes, such as 8
# or 16 byte loads, for which architectures may behave differently than
# for the smaller sizes.
echo_n "Alignment required... "
case $_host_cpu in
i[3-6]86 | x86_64 | ppc*)
# Unaligned access should work
_need_memalign=no
;;
alpha* | arm* | bfin* | hp* | mips* | sh* | sparc* | ia64 | nv1*)
# Unaligned access is not supported or extremely slow.
_need_memalign=yes
;;
*)
# Status of unaligned access is unknown, so assume the worst.
_need_memalign=yes
;;
esac
echo "$_need_memalign"
define_in_config_h_if_yes $_need_memalign 'SCUMM_NEED_ALIGNMENT'
#
# Check whether we can use x86 asm routines
#
echo_n "Compiling for x86... "
case $_host_cpu in
i386|i486|i586|i686)
_have_x86=yes
;;
*)
_have_x86=no
;;
esac
echo "$_have_x86"
define_in_config_h_if_yes $_have_x86 'HAVE_X86'
#
# Check whether to use optimized ARM asm
#
echo_n "Compiling for ARM... "
case $_host_cpu in
arm*)
_arm_asm=yes
;;
*)
_arm_asm=no
;;
esac
echo "$_arm_asm"
define_in_config_if_yes "$_arm_asm" 'USE_ARM_SCALER_ASM'
define_in_config_if_yes "$_arm_asm" 'USE_ARM_SOUND_ASM'
define_in_config_if_yes "$_arm_asm" 'USE_ARM_SMUSH_ASM'
define_in_config_if_yes "$_arm_asm" 'USE_ARM_GFX_ASM'
define_in_config_if_yes "$_arm_asm" 'USE_ARM_COSTUME_ASM'
#
# Determine build settings
#
@ -1715,35 +1812,6 @@ case $_host_os in
;;
esac
#
# Determine whether host is POSIX compliant, or at least POSIX
# compatible enough to support our POSIX code (including dlsym(),
# mkdir() and some other APIs).
#
# TODO: Instead of basing this on the host name, we should really base
# this on the presence of features (such as the dlsym and mkdir APIs).
#
echo_n "Checking if host is POSIX compliant... "
case $_host_os in
amigaos* | cygwin* | dreamcast | ds | gamecube | mingw* | n64 | ps2 | psp | wii | wince)
;;
android | beos* | bsd* | darwin* | freebsd* | gph-linux | haiku* | hpux* | iphone | irix* | linux* | mint* | netbsd* | openbsd* | solaris* | sunos* | uclinux* | webos)
_posix=yes
;;
os2-emx*)
_posix=yes # FIXME: Really???
;;
*)
# given this is a shell script, we might assume some type of posix.
# However, the host system might be a totally different one, so
# we can assume nothing about it.
# Indeed, as mentioned further above, we really should test for the
# presences of relevant APIs on the host anyway...
_posix=no
;;
esac
echo $_posix
if test -n "$_host"; then
# Cross-compiling mode - add your target here if needed
echo "Cross-compiling to $_host"
@ -2058,50 +2126,6 @@ if test -n "$_host"; then
esac
fi
#
# Check whether memory alignment is required
#
# For some CPU types, unaligned memory access is either not supported at
# all (and so leads to a crash), requires a super-slow emulation via an
# exception handler, or just results in incorrect results.
# On the other hand, accessing data in a manner that works regardless of
# alignment can be a lot slower than regular access, so we don't want
# to use it if we don't have to.
#
# So we do the following: For CPU families where we know whether unaligned
# access is safe & fast, we enable / disable unaligned access accordingly.
# Otherwise, we just disable memory alignment.
#
# NOTE: In the past, for non-cross compiled builds, we would also run some code
# which would try to test whether unaligned access worked or not. But this test
# could not reliably determine whether unaligned access really worked in all
# situations (and across different implementations of the target CPU arch), nor
# whether it was fast (as opposed to slowly emulated by fault handlers). Hence,
# we do not use this approach anymore.
#
# NOTE: The only kinds of unaligned access we allow are for 2 byte and 4
# byte loads / stores. No promises are made for bigger sizes, such as 8
# or 16 byte loads, for which architectures may behave differently than
# for the smaller sizes.
echo_n "Alignment required... "
case $_host_cpu in
i[3-6]86 | x86_64 | ppc*)
# Unaligned access should work
_need_memalign=no
;;
alpha* | arm* | bfin* | hp* | mips* | sh* | sparc* | ia64 | nv1*)
# Unaligned access is not supported or extremely slow.
_need_memalign=yes
;;
*)
# Status of unaligned access is unknown, so assume the worst.
_need_memalign=yes
;;
esac
echo "$_need_memalign"
define_in_config_h_if_yes $_need_memalign 'SCUMM_NEED_ALIGNMENT'
#
# Backend related stuff
#
@ -2238,21 +2262,34 @@ esac
#
# Add the results of the above checks to config.h
# Determine whether host is POSIX compliant, or at least POSIX
# compatible enough to support our POSIX code (including dlsym(),
# mkdir() and some other APIs).
#
case $_endian in
big)
add_line_to_config_h '#undef SCUMM_LITTLE_ENDIAN'
add_line_to_config_h '#define SCUMM_BIG_ENDIAN'
# TODO: Instead of basing this on the host name, we should really base
# this on the presence of features (such as the dlsym and mkdir APIs).
#
echo_n "Checking if host is POSIX compliant... "
case $_host_os in
amigaos* | cygwin* | dreamcast | ds | gamecube | mingw* | n64 | ps2 | psp | wii | wince)
_posix=no
;;
little)
add_line_to_config_h '#define SCUMM_LITTLE_ENDIAN'
add_line_to_config_h '#undef SCUMM_BIG_ENDIAN'
android | beos* | bsd* | darwin* | freebsd* | gph-linux | haiku* | hpux* | iphone | irix* | linux* | mint* | netbsd* | openbsd* | solaris* | sunos* | uclinux* | webos)
_posix=yes
;;
os2-emx*)
_posix=yes # FIXME: Really???
;;
*)
exit 1
# given this is a shell script, we might assume some type of posix.
# However, the host system might be a totally different one, so
# we can assume nothing about it.
# Indeed, as mentioned further above, we really should test for the
# presences of relevant APIs on the host anyway...
_posix=no
;;
esac
echo $_posix
if test "$_posix" = yes ; then
DEFINES="$DEFINES -DPOSIX"
@ -2899,40 +2936,6 @@ define_in_config_if_yes "$_opengl" "USE_OPENGL"
define_in_config_if_yes "$_opengles" "USE_GLES"
#
# Check whether we can use x86 asm routines
#
echo_n "Compiling for x86... "
case $_host_cpu in
i386|i486|i586|i686)
_have_x86=yes
;;
*)
_have_x86=no
;;
esac
echo "$_have_x86"
define_in_config_h_if_yes $_have_x86 'HAVE_X86'
#
# Check whether to use optimized ARM asm
#
echo_n "Compiling for ARM... "
case $_host_cpu in
arm*)
_arm_asm=yes
;;
*)
_arm_asm=no
;;
esac
echo "$_arm_asm"
define_in_config_if_yes "$_arm_asm" 'USE_ARM_SCALER_ASM'
define_in_config_if_yes "$_arm_asm" 'USE_ARM_SOUND_ASM'
define_in_config_if_yes "$_arm_asm" 'USE_ARM_SMUSH_ASM'
define_in_config_if_yes "$_arm_asm" 'USE_ARM_GFX_ASM'
define_in_config_if_yes "$_arm_asm" 'USE_ARM_COSTUME_ASM'
#
# Check for nasm
#