config.lib
changeset 7414 54c0982e17ab
parent 7347 7a77358b0537
child 7425 350b9265b7a2
--- a/config.lib	Sat Jun 16 12:03:36 2007 +0000
+++ b/config.lib	Sat Jun 16 21:57:30 2007 +0000
@@ -45,6 +45,7 @@
 	enable_osx_g5="0"
 	enable_unicode="1"
 	with_distcc="1"
+	with_ccache="1"
 	with_osx_sysroot="1"
 	with_application_bundle="1"
 	with_sdl="1"
@@ -62,7 +63,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_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 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_distcc with_ccache 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() {
@@ -240,6 +241,10 @@
 			--with-distcc)                with_distcc="2";;
 			--with-distcc=*)              with_distcc="$optarg";;
 
+			--without-ccache)             with_ccache="0";;
+			--with-ccache)                with_ccache="2";;
+			--with-ccache=*)              with_ccache="$optarg";;
+
 			--without-osx-sysroot)        with_osx_sysroot="0";;
 			--with-osx-sysroot)           with_osx_sysroot="2";;
 			--with-osx-sysroot=*)         with_osx_sysroot="$optarg";;
@@ -546,6 +551,35 @@
 		log 1 "checking distcc... $distcc"
 	fi
 
+	if [ "$with_ccache" = "0" ]; then
+		log 1 "checking ccache... no"
+	elif [ "$with_ccache" = "1" ]; then
+		with_ccache="0"
+
+		log 1 "checking ccache... no (only used when forced)"
+	elif [ "$with_ccache" = "2" ]; then
+		ccache="ccache"
+	else
+		ccache="$with_ccache"
+	fi
+	if [ "$with_ccache" != "0" ]; then
+		res="`$ccache --version 2>/dev/null | head -n 1 | cut -b 0-6`"
+		if [ "$res" != "ccache" ]; then
+			ccache=""
+			log 1 "checking ccache... no"
+			if [ "$with_ccache" = "2" ]; then
+				log 1 "configure: error: no ccache detected, but was forced to be used"
+				exit 1
+			fi
+			if [ "$with_ccache" != "1" ]; then
+				log 1 "configure: error: '$with_ccache' doesn't seem a ccache to me"
+				exit 1
+			fi
+		fi
+
+		log 1 "checking ccache... $ccache"
+	fi
+
 	if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
 		if [ "$with_osx_sysroot" = "1" ]; then
 			with_osx_sysroot="0"
@@ -1030,6 +1064,11 @@
 		log 1 " NOTICE: remind yourself to use 'make -jN' to make use of distcc"
 		log 1 ""
 	fi
+
+	if [ "$with_ccache" != "0" ]; then
+		cc_host="$ccache $cc_host"
+		cxx_host="$ccache $cxx_host"
+	fi
 }
 
 check_compiler() {