config.lib
branchNewGRF_ports
changeset 6872 1c4a4a609f85
parent 6871 5a9dc001e1ad
child 6877 889301acc299
--- a/config.lib	Mon Dec 03 23:39:38 2007 +0000
+++ b/config.lib	Tue Jan 22 21:00:30 2008 +0000
@@ -30,20 +30,22 @@
 	data_dir="share/games/openttd"
 	icon_dir="share/pixmaps"
 	personal_dir="1"
+	shared_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_unicode="1"
 	enable_assert="1"
 	enable_strip="1"
 	enable_universal="1"
 	enable_osx_g5="0"
-	enable_unicode="1"
-	with_distcc="1"
-	with_ccache="1"
+	enable_cocoa_quartz="1"
+	enable_cocoa_quickdraw="1"
 	with_osx_sysroot="1"
 	with_application_bundle="1"
 	with_sdl="1"
@@ -61,8 +63,66 @@
 	with_fontconfig="1"
 	with_psp_config="1"
 	with_threads="1"
+	with_distcc="1"
+	with_ccache="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
+		lipo
+		awk
+		os
+		endian
+		cpu_type
+		revision
+		config_log
+		prefix_dir
+		binary_dir
+		data_dir
+		icon_dir
+		personal_dir
+		shared_dir
+		install_dir
+		enable_debug
+		enable_desync_debug
+		enable_profiling
+		enable_dedicated
+		enable_network
+		enable_static
+		enable_translator
+		enable_unicode
+		enable_assert
+		enable_strip
+		enable_universal
+		enable_osx_g5
+		enable_cocoa_quartz
+		enable_cocoa_quickdraw
+		with_osx_sysroot
+		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
+		with_distcc
+		with_ccache
+	CC CXX CFLAGS LDFLAGS"
 }
 
 detect_params() {
@@ -135,6 +195,10 @@
 			--personal-dir=*)             personal_dir="$optarg";;
 			--without-personal-dir)       personal_dir="";;
 
+			--shared-dir)                 prevp_p="shared-dir";;
+			--shared-dir=*)               shared_dir="$optarg";;
+			--without-shared-dir)         shared_dir="";;
+
 			--install-dir)                prevp_p="install-dir";;
 			--install-dir=*)              install_dir="$optarg";;
 
@@ -142,6 +206,8 @@
 
 			--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";;
@@ -170,6 +236,13 @@
 			--enable-unicode)             enable_unicode="2";;
 			--enable-unicode=*)           enable_unicode="$optarg";;
 
+			--disable-cocoa-quartz)       enable_cocoa_quartz="0";;
+			--enable-cocoa-quartz)        enable_cocoa_quartz="2";;
+			--enable-cocoa-quartz=*)      enable_cocoa_quartz="$optarg";;
+			--disable-cocoa-quickdraw)    enable_cocoa_quickdraw="0";;
+			--enable-cocoa-quickdraw)     enable_cocoa_quickdraw="2";;
+			--enable-cocoa-quickdraw=*)   enable_cocoa_quickdraw="$optarg";;
+
 			--with-sdl)                   with_sdl="2";;
 			--without-sdl)                with_sdl="0";;
 			--with-sdl=*)                 with_sdl="$optarg";;
@@ -337,6 +410,13 @@
 		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
@@ -376,7 +456,7 @@
 	detect_cputype
 
 	if [ "$enable_static" = "1" ]; then
-		if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "OSX" ]; then
+		if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ]; then
 			enable_static="2"
 		else
 			enable_static="0"
@@ -419,6 +499,17 @@
 		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
 
@@ -729,6 +820,15 @@
 		fi
 	fi
 
+	if [ "$shared_dir" = "1" ]; then
+		# we are using default values
+		if [ "$os" = "OSX" ]; then
+			shared_dir="/Library/Application\\\\ Support/OpenTTD"
+		else
+			shared_dir=""
+		fi
+	fi
+
 	if [ -n "$personal_dir" ]
 	then
 		log 1 "personal home directory... $personal_dir"
@@ -736,6 +836,13 @@
 		log 1 "personal home directory... none"
 	fi
 
+	if [ -n "$shared_dir" ]
+	then
+		log 1 "shared data directory... $shared_dir"
+	else
+		log 1 "shared data directory... none"
+	fi
+
 	if [ -n "$install_dir" ]
 	then
 		log 1 "installation directory... $install_dir"
@@ -799,60 +906,76 @@
 		CFLAGS="$CFLAGS -DNO_THREADS"
 	fi
 
-	# Enable some things only for certain GCC versions
-	cc_version=`$cc_host -dumpversion | cut -c 1,3`
-
-	if [ $cc_version -ge 29 ]; then
-		CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef"
-		CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith"
-		CFLAGS="$CFLAGS -Wno-uninitialized"
-
-		CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes"
-	fi
-
-	gcc295=""
-	if [ "$cc_version" = 29 ]; then
-		# Make sure we mark GCC 2.95 flag for Makefile.src.in, as we
-		#  need a lovely hack there to make it compile correctly.
-		gcc295="1"
-	fi
-
-	if [ $cc_version -ge 30 ]; then
-		CFLAGS="$CFLAGS -W -Wno-unused-parameter"
-	fi
-
-	if [ $cc_version -ge 34 ]; then
-		CC_CFLAGS="$CC_CFLAGS -Wdeclaration-after-statement -Wold-style-definition"
-	fi
+	if [ `echo $cc_host | cut -c 1-3` = "icc" ]; then
+		# Enable some things only for certain ICC versions
+		cc_version=`$cc_host -dumpversion | cut -c 1-4`
 
-	if [ "$os" = "CYGWIN" ]; then
-		CFLAGS="$CFLAGS -mwin32"
-		LDFLAGS="$LDFLAGS -mwin32"
-	fi
-	if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
-		CFLAGS="$CFLAGS -mno-cygwin"
-		LDFLAGS="$LDFLAGS -mno-cygwin"
-	fi
-
-	if [ "$os" = "CYGWIN" ] || [ "$os" = "MINGW" ]; then
-		LDFLAGS="$LDFLAGS -Wl,--subsystem,windows"
-		LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32"
-	fi
 
-	# GCC 4.0+ complains about that we break strict-aliasing.
-	#  On most places we don't see how to fix it, and it doesn't
-	#  break anything. So disable strict-aliasing to make the
-	#  compiler all happy.
-	if [ $cc_version -ge 40 ]; then
-		CFLAGS="$CFLAGS -fno-strict-aliasing"
-	fi
+		if [ "$cc_version" = "10.1" ]; then
+			CFLAGS="$CFLAGS -Wno-multichar"
+		fi
+	else
+		# Enable some things only for certain GCC versions
+		cc_version=`$cc_host -dumpversion | cut -c 1,3`
 
-	# GCC 4.2+ automatically assumes that signed overflows do
-	# not occur in signed arithmetics, whereas we are not
-	# sure that they will not happen. It furthermore complains
-	# about it's own optimized code in some places.
-	if [ $cc_version -ge 42 ]; then
-		CFLAGS="$CFLAGS -fno-strict-overflow"
+		if [ $cc_version -ge 29 ]; then
+			CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef"
+			CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith"
+			CFLAGS="$CFLAGS -Wno-uninitialized"
+
+			CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes"
+		fi
+
+		gcc295=""
+		if [ "$cc_version" = 29 ]; then
+			# Make sure we mark GCC 2.95 flag for Makefile.src.in, as we
+			#  need a lovely hack there to make it compile correctly.
+			gcc295="1"
+		fi
+
+		if [ $cc_version -ge 30 ]; then
+			CFLAGS="$CFLAGS -W -Wno-unused-parameter"
+		fi
+
+		if [ $cc_version -ge 34 ]; then
+			CC_CFLAGS="$CC_CFLAGS -Wdeclaration-after-statement -Wold-style-definition"
+		fi
+
+		if [ "$os" = "CYGWIN" ]; then
+			CFLAGS="$CFLAGS -mwin32"
+			LDFLAGS="$LDFLAGS -mwin32"
+		fi
+		if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
+			CFLAGS="$CFLAGS -mno-cygwin"
+			LDFLAGS="$LDFLAGS -mno-cygwin"
+		fi
+
+		if [ "$os" = "CYGWIN" ] || [ "$os" = "MINGW" ]; then
+			LDFLAGS="$LDFLAGS -Wl,--subsystem,windows"
+			LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32"
+		fi
+
+		# GCC 4.0+ complains about that we break strict-aliasing.
+		#  On most places we don't see how to fix it, and it doesn't
+		#  break anything. So disable strict-aliasing to make the
+		#  compiler all happy.
+		if [ $cc_version -ge 40 ]; then
+			CFLAGS="$CFLAGS -fno-strict-aliasing"
+		fi
+
+		# GCC 4.2+ automatically assumes that signed overflows do
+		# not occur in signed arithmetics, whereas we are not
+		# sure that they will not happen. It furthermore complains
+		# about it's own optimized code in some places.
+		if [ $cc_version -ge 42 ]; then
+			CFLAGS="$CFLAGS -fno-strict-overflow"
+		fi
+
+		# GCC 4.3+ gives a warning about empty body of
+		# loops and conditions
+		if [ $cc_version -ge 43 ]; then
+			CFLAGS="$CFLAGS -Wno-empty-body"
+		fi
 	fi
 
 	if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
@@ -922,6 +1045,14 @@
 	if [ "$with_cocoa" != "0" ]; then
 		CFLAGS="$CFLAGS -DWITH_COCOA"
 		LIBS="$LIBS -F/System/Library/Frameworks -framework Cocoa -framework Carbon -framework AudioUnit"
+
+		if [ "$enable_cocoa_quartz" != "0" ]; then
+			CFLAGS="$CFLAGS -DENABLE_COCOA_QUARTZ"
+		fi
+
+		if [ "$enable_cocoa_quickdraw" != "0" ]; then
+			CFLAGS="$CFLAGS -DENABLE_COCOA_QUICKDRAW"
+		fi
 	fi
 
 	if [ "$with_zlib" != "0" ]; then
@@ -1052,6 +1183,13 @@
 		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
@@ -1065,6 +1203,10 @@
 		CFLAGS="$CFLAGS -DWITH_PERSONAL_DIR -DPERSONAL_DIR=\\\\\"$personal_dir\\\\\""
 	fi
 
+	if [ -n "$shared_dir" ]; then
+		CFLAGS="$CFLAGS -DWITH_SHARED_DIR -DSHARED_DIR=\\\\\"$shared_dir\\\\\""
+	fi
+
 	CFLAGS="$CFLAGS -DGLOBAL_DATA_DIR=\\\\\"$prefix_dir/$data_dir\\\\\""
 
 	log 1 "using CFLAGS... $CFLAGS $CC_CFLAGS"
@@ -1524,6 +1666,19 @@
 	fi
 
 	log 1 "checking COCOA... found"
+
+
+	if [ "$enable_cocoa_quartz" != "0" ]; then
+		log 1 "checking whether to enable the Quartz window subdriver... yes"
+	else
+		log 1 "checking whether to enable the Quartz window subdriver... no"
+	fi
+
+	if [ "$enable_cocoa_quickdraw" != "0" ]; then
+		log 1 "checking whether to enable the Quickdraw window subdriver... yes"
+	else
+		log 1 "checking whether to enable the Quickdraw window subdriver... no"
+	fi
 }
 
 detect_library() {
@@ -1976,7 +2131,7 @@
 	ppc=`$cc_host -dumpmachine | egrep "powerpc|ppc"`
 	if [ -n "$ppc" ]; then
 		T_CFLAGS="$CFLAGS -DFOUR_BYTE_BOOL"
-		osx_sysroot_version=10.3.9
+		osx_sysroot_version=10.4u
 	else
 		T_CFLAGS="$CFLAGS"
 		osx_sysroot_version=10.4u
@@ -2022,6 +2177,7 @@
 		s#!!DATA_DIR!!#$prefix_dir/$data_dir#g;
 		s#!!ICON_DIR!!#$prefix_dir/$icon_dir#g;
 		s#!!PERSONAL_DIR!!#$personal_dir#g;
+		s#!!SHARED_DIR!!#$shared_dir#g;
 		s#!!INSTALL_DIR!!#$install_dir#g;
 		s#!!STRGEN!!#$STRGEN#g;
 		s#!!ENDIAN_CHECK!!#$ENDIAN_CHECK#g;
@@ -2162,12 +2318,16 @@
 	echo "                                 [share/games/openttd]"
 	echo "  --icon-dir=dir                 location of icons. Will be prefixed"
 	echo "                                 with the prefix-dir [share/pixmaps]"
-	echo "  --personal-dir=dir             location of the personal directory [.openttd]"
+	echo "  --personal-dir=dir             location of the personal directory"
+	echo "                                 [os-dependent default]"
+	echo "  --shared-dir=dir               location of shared data files"
+	echo "                                 [os-dependent default]"
 	echo "  --install-dir=dir              specifies the root to install to."
 	echo "                                 Useful to install into jails [/]"
 	echo ""
 	echo "Features and packages:"
 	echo "  --enable-debug[=LVL]           enable debug-mode (LVL=[0123], 0 is release)"
+	echo "  --enable_desync_debug=[LVL]    enable desync debug options (LVL=[012], 0 is none"
 	echo "  --enable-profiling             enables profiling"
 	echo "  --enable-dedicated             compile a dedicated server (without video)"
 	echo "  --enable-static                enable static compile (doesn't work for"
@@ -2175,6 +2335,10 @@
 	echo "  --enable-translator            enable extra output for translators"
 	echo "  --enable-universal             enable universal builds (OSX ONLY)"
 	echo "  --enable-osx-g5                enables optimalizations for G5 (OSX ONLY)"
+	echo "  --disable-cocoa-quartz         disable the quartz window mode driver for Cocoa (OSX ONLY)"
+	echo "  --disable-cocoa-quickdraw      disable the quickdraw window mode driver for Cocoa (OSX ONLY)"
+	echo "  --disable-unicode              disable unicode support to build win9x"
+	echo "                                 version (Win32 ONLY)"
 	echo "  --disable-network              disable network support"
 	echo "  --disable-assert               disable asserts (continue on errors)"
 	echo "  --disable-strip                disable any possible stripping"