config.lib
branchgamebalance
changeset 9895 7bd07f43b0e3
parent 6546 d420506b08d8
child 9910 0b2aebc8283e
--- a/config.lib	Mon Mar 19 09:33:17 2007 +0000
+++ b/config.lib	Mon Mar 19 12:38:16 2007 +0000
@@ -41,6 +41,7 @@
 	enable_strip="1"
 	enable_universal="1"
 	enable_osx_g5="0"
+	enable_unicode="1"
 	with_osx_sysroot="1"
 	with_application_bundle="1"
 	with_sdl="1"
@@ -58,7 +59,7 @@
 	with_fontconfig="1"
 	with_psp_config="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 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 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"
 }
 
 detect_params() {
@@ -168,6 +169,9 @@
 			--disable-osx-g5)             enable_osx_g5="0";;
 			--enable-osx-g5)              enable_osx_g5="2";;
 			--enable-osx-g5=*)            enable_osx_g5="$optarg";;
+			--disable-unicode)            enable_unicode="0";;
+			--enable-unicode)             enable_unicode="2";;
+			--enable-unicode=*)           enable_unicode="$optarg";;
 
 			--with-sdl)                   with_sdl="2";;
 			--without-sdl)                with_sdl="0";;
@@ -271,7 +275,7 @@
 	echo "Running configure with following options:" >> $config_log
 	echo "" >> $config_log
 
-	configure="$0 --ignore-extra-parameters"
+	configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
 	for p in $save_params_array; do
 		eval "v=\"\$$p\""
 		p=`echo "$p" | sed 's/_/-/g;s/\n//g;'`
@@ -370,6 +374,20 @@
 		log 1 "checking static... no"
 	fi
 
+	if [ "$enable_unicode" = "1" ]; then
+		if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
+			enable_unicode="2"
+		else
+			enable_unicode="0"
+		fi
+	fi
+
+	if [ "$enable_unicode" != "0" ]; then
+		log 1 "checking unicode... yes"
+	else
+		log 1 "checking unicode... no"
+	fi
+
 	# Show what we configured
 	if [ "$enable_debug" = "0" ]; then
 		log 1 "using debug level... no"
@@ -478,6 +496,10 @@
 			strip_arg=""
 			# OS2 uses strip via gcc, because it needs to be feed to emxbind
 			LDFLAGS="$LDFLAGS -s"
+		elif [ "$os" = "SUNOS" ]; then
+			# The GNU strip does know -s, the non-GNU doesn't
+			#  So try to detect it (in a bit of an ugly way)
+			strip_arg="`$strip -s strip.test 2>/dev/null && echo \"-s\"`"
 		else
 			strip_arg="-s"
 		fi
@@ -533,18 +555,18 @@
 		OSXAPP="OpenTTD.app"
 
 # TODO: remove next few lines of code when the search path patch has been applied
-		if [ -n "$custom_lang_dir" ] && [ "$custom_lang_dir" != "${OSXAPP}/Contents/Lang/" ]; then
+		if [ -n "$custom_lang_dir" ] && [ "$custom_lang_dir" != "${OSXAPP}/Contents/Resources/lang/" ]; then
 			log 1 "configure: error: --custom-lang-dir and --with-application-bundle are not compatible
 			exit 1
 		fi
 
-		if [ -n "$custom_lang_dir" ] && [ "$second_data_dir" != "${OSXAPP}/Contents/Data/" ]; then
+		if [ -n "$custom_lang_dir" ] && [ "$second_data_dir" != "${OSXAPP}/Contents/Resources/data/" ]; then
 			log 1 "configure: error: --second-data-dir and --with-application-bundle are not compatible
 			exit 1
 		fi
 
-		custom_lang_dir="${OSXAPP}/Contents/Lang/"
-		second_data_dir="${OSXAPP}/Contents/Data/"
+		custom_lang_dir="${OSXAPP}/Contents/Resources/lang/"
+		second_data_dir="${OSXAPP}/Contents/Resources/data/"
 # TODO: remove till here
 	else
 		OSXAPP=""
@@ -559,8 +581,8 @@
 			# First, are we a real OSX system, else we can't detect it
 			native=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | grep darwin`
 			# If $host doesn't match $build , we are cross-compiling
-			if [ -n "$native" ] && [ "$build" != "$host" ]; then
-				$cc_build $SRC_DIR/os/macosx/G5_detector.cpp -o G5_detector
+			if [ -n "$native" ] && [ "$build" == "$host" ]; then
+				$cxx_build $SRC_DIR/os/macosx/G5_detector.cpp -o G5_detector
 				res=`./G5_detector`
 				rm -f G5_detector
 				if [ -n "$res" ]; then
@@ -727,10 +749,12 @@
 	if [ -n "$sdl_config" ]; then
 		CFLAGS="$CFLAGS -DWITH_SDL"
 		CFLAGS="$CFLAGS `$sdl_config --cflags`"
-		if [ "$enable_static" != "0" ]; then
-			LIBS="$LIBS `$sdl_config --static-libs`"
-		else
-			LIBS="$LIBS `$sdl_config --libs`"
+		if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
+			if [ "$enable_static" != "0" ]; then
+				LIBS="$LIBS `$sdl_config --static-libs`"
+			else
+				LIBS="$LIBS `$sdl_config --libs`"
+			fi
 		fi
 	fi
 
@@ -757,10 +781,27 @@
 			if [ "$os" = "OSX" ]; then
 				LIBS="$LIBS `$png_config --prefix`/lib/libpng.a"
 			else
-				LIBS="$LIBS `$png_config --static --ldflags --libs --L_opts | tr '\n\r' '  '`"
+				LIBS="$LIBS `$png_config --static --ldflags | tr '\n\r' '  '`"
 			fi
 		else
-			LIBS="$LIBS `$png_config --ldflags --libs --L_opts | tr '\n\r' '  '`"
+			LIBS="$LIBS `$png_config --ldflags | tr '\n\r' '  '`"
+		fi
+	fi
+
+	if [ -n "$fontconfig_config" ]; then
+		CFLAGS="$CFLAGS -DWITH_FONTCONFIG"
+		CFLAGS="$CFLAGS `$fontconfig_config --cflags | tr '\n\r' '  '`"
+
+		if [ "$enable_static" != "0" ]; then
+			if [ "$os" = "OSX" ]; then
+				# fontconfig_config goes via pkg-config on all systems, which doesn't know --prefix
+				# Also, despite the reason we link to the .a file ourself (because we can't use -static), we do need to ask pkg-config about possible other deps
+				LIBS="$LIBS `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s/-lfontconfig//`"
+			else
+				LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' '  '`"
+			fi
+		else
+			LIBS="$LIBS `$fontconfig_config --libs | tr '\n\r' '  '`"
 		fi
 	fi
 
@@ -780,21 +821,6 @@
 		fi
 	fi
 
-	if [ -n "$fontconfig_config" ]; then
-		CFLAGS="$CFLAGS -DWITH_FONTCONFIG"
-		CFLAGS="$CFLAGS `$fontconfig_config --cflags | tr '\n\r' '  '`"
-
-		if [ "$enable_static" != "0" ]; then
-			if [ "$os" = "OSX" ]; then
-				LIBS="$LIBS `$fontconfig_config --prefix`/lib/libfontconfig.a"
-			else
-				LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' '  '`"
-			fi
-		else
-			LIBS="$LIBS `$fontconfig_config --libs | tr '\n\r' '  '`"
-		fi
-	fi
-
 	if [ "$with_direct_music" != "0" ]; then
 		CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT"
 		# GCC 4.0+ doesn't like the DirectX includes (gives tons of
@@ -834,6 +860,10 @@
 		CFLAGS="$CFLAGS -DDEDICATED"
 	fi
 
+	if [ "$enable_unicode" != "0" ]; then
+		CFLAGS="$CFLAGS -DUNICODE -D_UNICODE"
+	fi
+
 	if [ "$enable_network" != "0" ]; then
 		CFLAGS="$CFLAGS -DENABLE_NETWORK"
 
@@ -1541,6 +1571,12 @@
 		return 0
 	fi
 
+	if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
+		log 1 "checking libfontconfig... WIN32, skipping"
+		fontconfig_config=""
+		return 0
+	fi
+
 	if [ "$with_fontconfig" = "1" ] || [ "$with_fontconfig" = "" ] || [ "$with_fontconfig" = "2" ]; then
 		fontconfig_config="pkg-config fontconfig"
 	else