Skip to content

Commit

Permalink
BUILD: Unify how _posix is computed
Browse files Browse the repository at this point in the history
However, the current approach of determining _posix based on _host_os is
flawed and should be replaced by feature detection; added a TODO about
this.
  • Loading branch information
fingolfin committed May 25, 2011
1 parent 39076ef commit 38ff075
Showing 1 changed file with 27 additions and 33 deletions.
60 changes: 27 additions & 33 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,6 @@ case $_host_os in
LDFLAGS="$LDFLAGS --sysroot=$ANDROID_NDK/platforms/android-4/arch-arm"
LDFLAGS="$LDFLAGS -mthumb-interwork"
add_line_to_config_mk "ANDROID_SDK = $ANDROID_SDK"
_posix=yes
_seq_midi=no
;;
beos*)
Expand All @@ -1558,12 +1557,8 @@ case $_host_os in
CFLAGS="-I/boot/home/config/include"
CXXFLAGS="$CXXFLAGS -fhuge-objects"
LIBS="$LIBS -lbind -lsocket"
_posix=yes
_seq_midi=no
;;
bsd* | hpux* | netbsd* | openbsd* | sunos*)
_posix=yes
;;
cygwin*)
echo ERROR: Cygwin building is not supported by ScummVM anymore. Consider using MinGW.
exit 1
Expand All @@ -1572,7 +1567,6 @@ case $_host_os in
DEFINES="$DEFINES -DMACOSX"
LIBS="$LIBS -framework AudioUnit -framework AudioToolbox -framework Carbon -framework CoreMIDI"
add_line_to_config_mk 'MACOSX = 1'
_posix=yes
;;
dreamcast)
DEFINES="$DEFINES -D__DC__ -DNONSTANDARD_PORT"
Expand All @@ -1598,7 +1592,6 @@ case $_host_os in
freebsd*)
LDFLAGS="$LDFLAGS -L/usr/local/lib"
CXXFLAGS="$CXXFLAGS -I/usr/local/include"
_posix=yes
;;
gamecube)
CXXFLAGS="$CXXFLAGS -Os -mogc -mcpu=750 -meabi -mhard-float"
Expand All @@ -1616,22 +1609,19 @@ case $_host_os in
DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE"
# Needs -lnetwork for the timidity MIDI driver
LIBS="$LIBS -lnetwork"
_posix=yes
_seq_midi=no
;;
irix*)
DEFINES="$DEFINES -DIRIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
LIBS="$LIBS -lmd -lfastm -lm"
_ranlib=:
_posix=yes
;;
linux* | uclinux*)
# When not cross-compiling, enable large file support, but don't
# care if getconf doesn't exist or doesn't recognize LFS_CFLAGS.
if test -z "$_host"; then
CXXFLAGS="$CXXFLAGS $(getconf LFS_CFLAGS 2>/dev/null)"
fi
_posix=yes
DEFINES="$DEFINES -DLUA_USE_POSIX"
;;
mingw*)
Expand All @@ -1642,17 +1632,13 @@ case $_host_os in
;;
mint*)
DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE"
_posix=yes
;;
n64)
DEFINES="$DEFINES -D__N64__ -DLIMIT_FPS -DNONSTANDARD_PORT"
DEFINES="$DEFINES -DDISABLE_DEFAULT_SAVEFILEMANAGER -DDISABLE_COMMAND_LINE"
DEFINES="$DEFINES -DDISABLE_FANCY_THEMES -DDISABLE_DOSBOX_OPL -DDISABLE_SID -DDISABLE_NES_APU"
DEFINES="$DEFINES -DREDUCE_MEMORY_USAGE"
;;
os2-emx*)
_posix=yes # FIXME??? Why??
;;
ps2)
# TODO ps2
CXXFLAGS="$CXXFLAGS -G2"
Expand All @@ -1669,7 +1655,6 @@ case $_host_os in
DEFINES="$DEFINES -DSOLARIS -DSYSTEM_NOT_SUPPORTING_D_TYPE"
# Needs -lbind -lsocket for the timidity MIDI driver
LIBS="$LIBS -lnsl -lsocket"
_posix=yes
;;
webos)
CXXFLAGS="$CXXFLAGS -I$WEBOS_PDK/include -I$WEBOS_PDK/include/SDL -I$WEBOS_PDK/device/usr/include"
Expand All @@ -1679,7 +1664,6 @@ case $_host_os in
LDFLAGS="$LDFLAGS -Wl,--allow-shlib-undefined"
LDFLAGS="$LDFLAGS --sysroot=$WEBOS_PDK/arm-gcc/sysroot"
add_line_to_config_mk "WEBOS_SDK = $WEBOS_SDK"
_posix=yes
_seq_midi=no
;;
wii)
Expand All @@ -1699,19 +1683,42 @@ case $_host_os in
DEFINES="$DEFINES -D__ARM__ -D_ARM_ -DUNICODE -DFPM_DEFAULT -DNONSTANDARD_PORT"
DEFINES="$DEFINES -DWIN32 -Dcdecl= -D__cdecl__="
;;
# given this is a shell script assume some type of posix
*)
echo "WARNING: could not establish system type, assuming unix like"
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"
case "$_host" in
android | android-v7a)
_posix=yes
# we link a .so as default
LDFLAGS="$LDFLAGS -shared -Wl,-Bsymbolic,--no-undefined"
HOSTEXEPRE=lib
Expand All @@ -1724,11 +1731,9 @@ if test -n "$_host"; then
_timidity=no
;;
arm-linux|arm*-linux-gnueabi|arm-*-linux)
_posix=yes
;;
arm-riscos|linupy)
DEFINES="$DEFINES -DLINUPY"
_posix=yes
;;
bfin*)
;;
Expand All @@ -1744,7 +1749,6 @@ if test -n "$_host"; then
fi
CXXFLAGS="$CXXFLAGS -mcpu=arm926ej-s -mtune=arm926ej-s"
ASFLAGS="$ASFLAGS"
_posix=yes
_backend="gph"
_build_hq_scalers=no
_vkeybd=yes
Expand Down Expand Up @@ -1818,7 +1822,6 @@ if test -n "$_host"; then
CXXFLAGS="$CXXFLAGS -march=armv4t"
ASFLAGS="$ASFLAGS -mfloat-abi=soft"
LDFLAGS="$LDFLAGS -static"
_posix=yes
_backend="gph"
_build_hq_scalers=no
_vkeybd=yes
Expand All @@ -1836,7 +1839,6 @@ if test -n "$_host"; then
fi
CXXFLAGS="$CXXFLAGS -mcpu=arm926ej-s -mtune=arm926ej-s"
ASFLAGS="$ASFLAGS -mfloat-abi=soft"
_posix=yes
_backend="gph"
_build_hq_scalers=no
_vkeybd=yes
Expand All @@ -1847,14 +1849,12 @@ if test -n "$_host"; then
;;
iphone)
DEFINES="$DEFINES -DIPHONE"
_posix=yes
_backend="iphone"
_build_hq_scalers=no
_seq_midi=no
;;
m68k-atari-mint)
DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE"
_posix=yes
_ranlib=m68k-atari-mint-ranlib
_ar="m68k-atari-mint-ar cru"
_seq_midi=no
Expand All @@ -1872,7 +1872,6 @@ if test -n "$_host"; then
motoezx)
DEFINES="$DEFINES -DMOTOEZX"
ASFLAGS="$ASFLAGS -mfpu=vfp"
_posix=yes
_backend="linuxmoto"
_build_hq_scalers=no
_mt32emu=no
Expand All @@ -1883,7 +1882,6 @@ if test -n "$_host"; then
motomagx)
DEFINES="$DEFINES -DMOTOMAGX"
ASFLAGS="$ASFLAGS -mfpu=vfp"
_posix=yes
_backend="linuxmoto"
_build_hq_scalers=no
_mt32emu=no
Expand Down Expand Up @@ -1915,7 +1913,6 @@ if test -n "$_host"; then
;;
neuros)
DEFINES="$DEFINES -DNEUROS"
_posix=yes
_backend='null'
_build_hq_scalers=no
_mt32emu=no
Expand All @@ -1930,7 +1927,6 @@ if test -n "$_host"; then
fi
CXXFLAGS="$CXXFLAGS -march=armv7-a -mtune=cortex-a8 -mfpu=neon"
ASFLAGS="$ASFLAGS -mfloat-abi=soft"
_posix=yes
_backend="openpandora"
_build_hq_scalers=yes
_vkeybd=no
Expand Down Expand Up @@ -1979,13 +1975,11 @@ if test -n "$_host"; then
DEFINES="$DEFINES -DSAMSUNGTV -DDISABLE_COMMAND_LINE"
ASFLAGS="$ASFLAGS -mfpu=vfp"
HOSTEXEEXT=".so"
_posix=yes
_backend="samsungtv"
_mt32emu=no
_vkeybd=yes
;;
webos)
_posix=yes
_backend="webos"
_port_mk="backends/platform/webos/webos.mk"
_build_scalers=no
Expand Down

0 comments on commit 38ff075

Please sign in to comment.