--- a/config.lib Tue Mar 13 18:43:10 2007 +0000
+++ b/config.lib Tue Mar 13 21:32:52 2007 +0000
@@ -20,6 +20,7 @@
awk="awk"
os="DETECT"
endian="AUTO"
+ cpu_type="DETECT"
revision=""
config_log="config.log"
prefix_dir="/usr/local"
@@ -58,8 +59,9 @@
with_freetype="1"
with_fontconfig="1"
with_psp_config="1"
+ with_squirrel="1"
- save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_osx_sysroot enable_universal enable_osx_g5 enable_unicode with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS"
+ save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os cpu_type revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_osx_sysroot enable_universal enable_osx_g5 enable_unicode with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config with_squirrel CC CXX CFLAGS LDFLAGS"
}
detect_params() {
@@ -89,6 +91,9 @@
--os) prev_p="os";;
--os=*) os="$optarg";;
+ --cpu-type) prev_p="cpu_type";;
+ --cpu-type=*) cpu_type="$optarg";;
+
--revision=*) revision="$optarg";;
--cc-build) prevp_p="cc_build";;
@@ -192,6 +197,10 @@
--without-libpng) with_png="0";;
--with-libpng=*) with_png="$optarg";;
+ --with-squirrel) with_squirrel="2";;
+ --without-squirrel) with_squirrel="0";;
+ --with-squirrel=*) with_squirrel="$optarg";;
+
--with-libtimidity) with_libtimidity="2";;
--without-libtimidity) with_libtimidity="0";;
--with-libtimidity=*) with_libtimidity="$optarg";;
@@ -294,6 +303,7 @@
endian=`echo $endian | tr '[a-z]' '[A-Z]'`
os=`echo $os | tr '[a-z]' '[A-Z]'`
+ cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'`
# Check if all params have valid values
@@ -309,6 +319,12 @@
echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP]"
exit 1
fi
+ # cpu_type can be either 32 or 64
+ if [ -z "`echo $cpu_type | grep '^32$\|^64$\|^DETECT$'`" ]; then
+ echo "configure: error: invalid option --cpu-type=$cpu_type"
+ echo " Available options are: --cpu-type[=DETECT|32|64]"
+ exit 1
+ fi
# enable_debug should be between 0 and 4
if [ -z "`echo $enable_debug | grep '^[0123]$'`" ]; then
echo "configure: error: invalid option --enable-debug=$enable_debug"
@@ -352,6 +368,7 @@
fi
check_lipo
check_makedepend
+ detect_cputype
if [ "$enable_static" = "1" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "OSX" ]; then
@@ -451,6 +468,7 @@
detect_png
detect_freetype
detect_fontconfig
+ detect_squirrel
detect_iconv
detect_pspconfig
detect_libtimidity
@@ -772,6 +790,15 @@
CFLAGS="$CFLAGS -DWITH_ZLIB"
fi
+ if [ "$with_squirrel" != "0" ]; then
+ LIBS="$LIBS $squirrel `echo $squirrel | sed s/libsquirrel/libsqstdlib/`"
+ CFLAGS="$CFLAGS -DWITH_SQUIRREL"
+ # 64bit machines need -D_SQ64
+ if [ "$cpu_type" = "64" ]; then
+ CFLAGS="$CFLAGS -D_SQ64"
+ fi
+ fi
+
if [ -n "$png_config" ]; then
CFLAGS="$CFLAGS -DWITH_PNG"
CFLAGS="$CFLAGS `$png_config --cppflags --I_opts | tr '\n\r' ' '`"
@@ -1386,6 +1413,9 @@
# $2 - library name ('zlib', sets $zlib)
# $3 - static library name (libz.a)
# $4 - header name (zlib.h)
+ # $5 - force static (if non-empty)
+
+ if [ -n "$5" ]; then force_static="1"; fi
# 0 means no, 1 is auto-detect, 2 is force
if [ "$1" = "0" ]; then
@@ -1410,7 +1440,7 @@
fi
eval "res=\$$2"
- if [ -n "$res" ] && [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then
+ if [ -n "$res" ] && ( [ -n "$force_static" ] || ( [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] ) ); then
eval "res=\$$2"
log 2 " trying $res... found"
# Now find the static lib, if needed
@@ -1470,6 +1500,10 @@
detect_library "$with_zlib" "zlib" "libz.a" "zlib.h"
}
+detect_squirrel() {
+ detect_library "$with_squirrel" "squirrel" "libsquirrel.a" "squirrel.h" "static"
+}
+
detect_libtimidity() {
detect_library "$with_libtimidity" "libtimidity" "libtimidity.a" "timidity.h"
}
@@ -1773,6 +1807,25 @@
fi
}
+detect_cputype() {
+ if [ -n "$cpu_type" ] && [ "$cpu_type" != "DETECT" ]; then
+ log 1 "forcing cpu-type... $cpu_type bits"
+ return;
+ fi
+ echo "#include \"src/stdafx.h\"" > tmp.64bit.cpp
+ echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp
+ echo "int main() { return 0; }" >> tmp.64bit.cpp
+ execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1"
+ cpu_type="`eval $execute 2>/dev/null`"
+ ret=$?
+ log 2 "executing $execute"
+ log 2 " returned $cpu_type"
+ log 2 " exit code $ret"
+ if [ "$ret" = "0" ]; then cpu_type="64"; else cpu_type="32"; fi
+ log 1 "detecting cpu-type... $cpu_type bits"
+ rm -f tmp.64bit tmp.64bit.cpp
+}
+
make_sed() {
# We check here if we are PPC, because then we need to enable FOUR_BYTE_BOOL
# We do this here, and not sooner, so universal builds also have this
--- a/src/stdafx.h Tue Mar 13 18:43:10 2007 +0000
+++ b/src/stdafx.h Tue Mar 13 21:32:52 2007 +0000
@@ -217,6 +217,7 @@
/* Windows has always LITTLE_ENDIAN */
#if defined(WIN32) || defined(__OS2__) || defined(WIN64)
# define TTD_LITTLE_ENDIAN
+#elif defined(TESTING)
#else
/* Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile */
# if defined(STRGEN)