Changeset - r8080:18ba871a1f5b
[Not reviewed]
master
0 2 0
rubidium - 17 years ago 2007-12-15 22:42:12
rubidium@openttd.org
(svn r11641) -Add: configure time parameter to enable some desync debugging functionality.
2 files changed with 30 insertions and 2 deletions:
0 comments (0 inline, 0 general)
config.lib
Show inline comments
 
@@ -23,24 +23,25 @@ set_default() {
 
	os="DETECT"
 
	endian="AUTO"
 
	cpu_type="DETECT"
 
	revision=""
 
	config_log="config.log"
 
	prefix_dir="/usr/local"
 
	binary_dir="games"
 
	data_dir="share/games/openttd"
 
	icon_dir="share/pixmaps"
 
	personal_dir="1"
 
	install_dir="/"
 
	enable_debug="0"
 
	enable_desync_debug="0"
 
	enable_profiling="0"
 
	enable_dedicated="0"
 
	enable_network="1"
 
	enable_static="1"
 
	enable_translator="0"
 
	enable_assert="1"
 
	enable_strip="1"
 
	enable_universal="1"
 
	enable_osx_g5="0"
 
	enable_unicode="1"
 
	with_distcc="1"
 
	with_ccache="1"
 
@@ -53,25 +54,25 @@ set_default() {
 
	with_makedepend="1"
 
	with_direct_music="1"
 
	with_sort="1"
 
	with_iconv="1"
 
	with_midi=""
 
	with_midi_arg=""
 
	with_libtimidity="1"
 
	with_freetype="1"
 
	with_fontconfig="1"
 
	with_psp_config="1"
 
	with_threads="1"
 

	
 
	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 enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_distcc 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_threads 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 enable_debug enable_desync_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_distcc 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_threads CC CXX CFLAGS LDFLAGS"
 
}
 

	
 
detect_params() {
 
	# Walk over all params from the user and override any default settings if
 
	#  needed. This also handles any invalid option.
 
	for p in "$@"; do
 
		if [ -n "$prev_p" ]; then
 
			eval "$prev_p=\$p"
 
			prev_p=
 
			continue
 
		fi
 

	
 
@@ -133,24 +134,26 @@ detect_params() {
 

	
 
			--personal-dir)               prevp_p="personal-dir";;
 
			--personal-dir=*)             personal_dir="$optarg";;
 
			--without-personal-dir)       personal_dir="";;
 

	
 
			--install-dir)                prevp_p="install-dir";;
 
			--install-dir=*)              install_dir="$optarg";;
 

	
 

	
 

	
 
			--enable-debug)               enable_debug="1";;
 
			--enable-debug=*)             enable_debug="$optarg";;
 
			--enable-desync-debug)        enable_desync_debug="1";;
 
			--enable-desync-debug=*)      enable_desync_debug="$optarg";;
 
			--enable-profiling)           enable_profiling="1";;
 
			--enable-profiling=*)         enable_profiling="$optarg";;
 
			--enable-dedicated)           enable_dedicated="1";;
 
			--enable-dedicated=*)         enable_dedicated="$optarg";;
 
			--enable-network=*)           enable_network="$optarg";;
 
			--disable-network)            enable_network="0";;
 
			--disable-static)             enable_static="0";;
 
			--enable-static)              enable_static="2";;
 
			--enable-static=*)            enable_static="$optarg";;
 
			--disable-translator)         enable_translator="0";;
 
			--enable-translator)          enable_translator="2";;
 
			--enable-translator=*)        enable_translator="$optarg";;
 
@@ -328,24 +331,31 @@ check_params() {
 
	if [ -z "`echo $cpu_type | egrep '^(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 | egrep '^[0123]$'`" ]; then
 
		echo "configure: error: invalid option --enable-debug=$enable_debug"
 
		echo " Available options are: --enable-debug[=0123]"
 
		exit 1
 
	fi
 

	
 
	# enable_desync_debug should be between 0 and 3
 
	if [ -z "`echo $enable_desync_debug | egrep '^[012]$'`" ]; then
 
		echo "configure: error: invalid option --enable-desync-debug=$enable_desync_debug"
 
		echo " Available options are: --enable-desync-debug[=012]"
 
		exit 1
 
	fi
 

	
 
	detect_awk
 

	
 
	check_build
 
	check_host
 

	
 
	detect_os
 

	
 
# We might enable universal builds always on OSX targets.. but currently we don't
 
#	if [ "$enable_universal" = "1" ]  && [ "$os" != "OSX" ]; then
 
	if [ "$enable_universal" = "1" ]; then
 
		enable_universal="0"
 
	fi
 
@@ -410,24 +420,35 @@ check_params() {
 
		log 1 "checking unicode... no"
 
	fi
 

	
 
	# Show what we configured
 
	if [ "$enable_debug" = "0" ]; then
 
		log 1 "using debug level... no"
 
	elif [ "$enable_profiling" != "0" ]; then
 
		log 1 "using debug level... profiling (debug level $enable_debug)"
 
	else
 
		log 1 "using debug level... level $enable_debug"
 
	fi
 

	
 
	if [ "$enable_desync_debug" = "0" ]; then
 
		log 1 "using desync debug level... no"
 
	else
 
		log 1 "using desync debug level... level $enable_desync_debug"
 
		log 1 "WARNING: desync debug functions slow down the game considerably."
 
		log 1 "WARNING: use only when you are instructed to do so"
 
		log 1 "         or when you know what you are doing."
 

	
 
		sleep 5
 
	fi
 

	
 
	detect_sdl
 
	detect_cocoa
 

	
 
	if [ "$enable_dedicated" != "0" ]; then
 
		log 1 "checking GDI video driver... skipping"
 
		log 1 "checking dedicated... found"
 

	
 
		if [ "$enable_network" = "0" ]; then
 
			log 1 "WARNING: compiling a dedicated server without network is pointless"
 
			sleep 5
 
		fi
 
	else
 
@@ -1043,24 +1064,31 @@ make_cflags_and_ldflags() {
 

	
 
	if [ "$enable_static" != "0" ]; then
 
		# OSX can't handle -static in LDFLAGS
 
		if [ "$os" != "OSX" ]; then
 
			LDFLAGS="$LDFLAGS -static"
 
		fi
 
	fi
 

	
 
	if [ "$enable_assert" = "0" ]; then
 
		CFLAGS="$CFLAGS -DNDEBUG"
 
	fi
 

	
 
	if [ "$enable_desync_debug" = "1" ]; then
 
		CFLAGS="$CFLAGS -DDEBUG_DUMP_COMMANDS"
 
	fi
 
	if [ "$enable_desync_debug" = "2" ]; then
 
		CFLAGS="$CFLAGS -DRANDOM_DEBUG"
 
	fi
 

	
 
	if [ "$enable_osx_g5" != "0" ]; then
 
		CFLAGS="$CFLAGS -mtune=970 -mcpu=970 -mpowerpc-gpopt"
 
	fi
 

	
 
	if [ "$with_osx_sysroot" != "0" ] && [ "$with_osx_sysroot" != "3" ]; then
 
		CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX$with_osx_sysroot.sdk"
 
		LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX$with_osx_sysroot.sdk"
 
	fi
 

	
 
	if [ -n "$personal_dir" ]; then
 
		CFLAGS="$CFLAGS -DWITH_PERSONAL_DIR -DPERSONAL_DIR=\\\\\"$personal_dir\\\\\""
 
	fi
configure
Show inline comments
 
@@ -22,25 +22,25 @@ PREFIX="`pwd`/bin"
 
. $ROOT_DIR/config.lib
 

	
 
# Set default dirs
 
OBJS_DIR="$PWD/objs"
 
BASE_SRC_OBJS_DIR="$OBJS_DIR"
 
LANG_OBJS_DIR="$OBJS_DIR/lang"
 
BIN_DIR="$PREFIX"
 
SRC_DIR="$ROOT_DIR/src"
 
LANG_DIR="$SRC_DIR/lang"
 
MEDIA_DIR="$ROOT_DIR/media"
 
SOURCE_LIST="$ROOT_DIR/source.list"
 

	
 
if [ "$1" = "--reconfig" ]; then
 
if [ "$1" = "--reconfig" ] || [ "$1" = "--reconfigure" ]; then
 
	if ! [ -f "config.cache" ]; then
 
		echo "can't reconfigure, because never configured before"
 
		exit 1
 
	fi
 
	# Make sure we don't lock config.cache
 
	cat config.cache > cache.tmp
 
	sh cache.tmp
 
	rm -f cache.tmp
 
	exit $?
 
fi
 

	
 
set_default
0 comments (0 inline, 0 general)