[Scummvm-cvs-logs] SF.net SVN: scummvm:[44348] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Sep 25 14:11:27 CEST 2009


Revision: 44348
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44348&view=rev
Author:   fingolfin
Date:     2009-09-25 12:11:27 +0000 (Fri, 25 Sep 2009)

Log Message:
-----------
Modified version of patch #2838507: Add support for non-gcc compilers to configure, Makefile etc

Modified Paths:
--------------
    scummvm/trunk/Makefile
    scummvm/trunk/Makefile.common
    scummvm/trunk/configure

Modified: scummvm/trunk/Makefile
===================================================================
--- scummvm/trunk/Makefile	2009-09-25 11:41:08 UTC (rev 44347)
+++ scummvm/trunk/Makefile	2009-09-25 12:11:27 UTC (rev 44348)
@@ -19,28 +19,31 @@
 
 # Load the make rules generated by configure
 -include config.mk
+-include Makedepend
 
-CXXFLAGS:= -Wall $(CXXFLAGS)
-# Turn off some annoying and not-so-useful warnings
-CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
-# Enable even more warnings...
-CXXFLAGS+= -Wpointer-arith -Wcast-qual -Wcast-align
-CXXFLAGS+= -Wshadow -Wimplicit -Wnon-virtual-dtor -Wwrite-strings
+ifeq "$(HAVE_GCC)" "1"
+	CXXFLAGS:= -Wall $(CXXFLAGS)
+	# Turn off some annoying and not-so-useful warnings
+	CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
+	# Enable even more warnings...
+	CXXFLAGS+= -Wpointer-arith -Wcast-qual -Wcast-align
+	CXXFLAGS+= -Wshadow -Wimplicit -Wnon-virtual-dtor -Wwrite-strings
 
-# Currently we disable this gcc flag, since it will also warn in cases,
-# where using GCC_PRINTF (means: __attribute__((format(printf, x, y))))
-# is not possible, thus it would fail compiliation with -Werror without
-# being helpful.
-#CXXFLAGS+= -Wmissing-format-attribute
+	# Currently we disable this gcc flag, since it will also warn in cases,
+	# where using GCC_PRINTF (means: __attribute__((format(printf, x, y))))
+	# is not possible, thus it would fail compiliation with -Werror without
+	# being helpful.
+	#CXXFLAGS+= -Wmissing-format-attribute
 
-# Disable RTTI and exceptions, and enabled checking of pointers returned by "new"
-CXXFLAGS+= -fno-rtti -fno-exceptions -fcheck-new
+	# Disable RTTI and exceptions, and enabled checking of pointers returned by "new"
+	CXXFLAGS+= -fno-rtti -fno-exceptions -fcheck-new
 
-# There is a nice extra warning that flags variables that are potentially
-# used before being initialized. Very handy to catch a certain kind of
-# bugs. Unfortunately, it only works when optimizations are turned on,
-# which is why we normally don't use it.
-#CXXFLAGS+= -O -Wuninitialized
+	# There is a nice extra warning that flags variables that are potentially
+	# used before being initialized. Very handy to catch a certain kind of
+	# bugs. Unfortunately, it only works when optimizations are turned on,
+	# which is why we normally don't use it.
+	#CXXFLAGS+= -O -Wuninitialized
+endif
 
 #######################################################################
 # Default commands - put the necessary replacements in config.mk      #

Modified: scummvm/trunk/Makefile.common
===================================================================
--- scummvm/trunk/Makefile.common	2009-09-25 11:41:08 UTC (rev 44347)
+++ scummvm/trunk/Makefile.common	2009-09-25 12:11:27 UTC (rev 44348)
@@ -89,34 +89,34 @@
 	$(RM_REC) $(DEPDIRS)
 	$(RM) $(OBJS) $(EXECUTABLE)
 
-# Old (dumb) compile & dependcy rules
-#INCS	= scumm/scumm.h common/scummsys.h
-#.cpp.o:
-#	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
-#$(OBJS): $(INCS)
 
-ifndef HAVE_GCC3
-# If you use GCC, disable the above and enable this for intelligent
+#
+# The build rules for object files.
+#
+
+ifdef CXX_UPDATE_DEP_FLAG
+
+# Build rule for C++ files. Makes use of CXX_UPDATE_DEP_FLAG for advanced
 # dependency tracking.
 %.o: %.cpp
 	$(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
-	$(QUIET_CXX)$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
-	$(QUIET)$(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
-	$(QUIET)$(CAT) "$(*D)/$(DEPDIR)/$(*F).d2" >> "$(*D)/$(DEPDIR)/$(*F).d"
-	$(QUIET)$(RM) "$(*D)/$(DEPDIR)/$(*F).d2"
-else
-# If you even have GCC 3.x, you can use this build rule, which is safer; the above
-# rule can get you into a bad state if you Ctrl-C at the wrong moment.
-# Also, with this GCC inserts additional dummy rules for the involved headers,
-# which ensures a smooth compilation even if said headers become obsolete.
-%.o: %.cpp
-	$(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
-	$(QUIET_CXX)$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
+	$(QUIET_CXX)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
+
+# Build rule for Objective-C files. Strictly speaking, this is for OS X only.
 %.o: %.m
 	$(QUIET)$(MKDIR) $(*D)/$(DEPDIR)
-	$(QUIET_CXX)$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(OBJCFLAGS) -c $(<) -o $*.o
+	$(QUIET_CXX)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(OBJCFLAGS) -c $(<) -o $*.o
+
+else
+
+# Dumb compile rule, for C++ compilers that don't allow dependency tracking or
+# where it is broken (such as GCC 2.95).
+.cpp.o:
+	$(QUIET_CXX)$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
+
 endif
 
+
 %.o: %.s
 	$(QUIET_AS)$(AS) $(ASFLAGS) $(<) -o $*.o
 

Modified: scummvm/trunk/configure
===================================================================
--- scummvm/trunk/configure	2009-09-25 11:41:08 UTC (rev 44347)
+++ scummvm/trunk/configure	2009-09-25 12:11:27 UTC (rev 44348)
@@ -1008,38 +1008,79 @@
 #
 echocheck "compiler version"
 
+have_gcc=no
 cxx_version=`( $CXX -dumpversion ) 2>&1`
 if test "$?" -gt 0; then
-	cxx_version="not found"
+	# TODO: Big scary warning about unsupported Compilers
+	cxx_version=`( $CXX -version ) 2>&1`
+	if test "$?" -eq 0; then
+		cxx_version="`echo "${cxx_version}" | sed -ne 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/gp'`"
+		if test -z "${cxx_version}"; then
+			cxx_version="not found"
+			cxx_verc_fail=yes
+		fi
+		echo non-gcc compiler version ${cxx_version}
+	else
+		cxx_version="not found"
+		cxx_verc_fail=yes
+		echo found non-gcc compiler version ${cxx_version}
+	fi
+else
+	add_line_to_config_mk 'HAVE_GCC = 1'
+	have_gcc=yes
 fi
 
-case $cxx_version in
-	2.95.[2-9]|2.95.[2-9][-.]*|3.[0-9]|3.[0-9].[0-9]|3.[0-9].[0-9][-.]*|4.[0-9]|4.[0-9].[0-9]|4.[0-9].[0-9][-.]*)
-		_cxx_major=`echo $cxx_version | cut -d '.' -f 1`
-		_cxx_minor=`echo $cxx_version | cut -d '.' -f 2`
-		cxx_version="$cxx_version, ok"
-		cxx_verc_fail=no
-		;;
-	# whacky beos version strings
-	2.9-beos-991026*|2.9-beos-000224*)
-		_cxx_major=2
-		_cxx_minor=95
-		cxx_version="$cxx_version, ok"
-		cxx_verc_fail=no
-		;;
-	3_4)
-		_cxx_major=3
-		_cxx_minor=4
-		;;
-	'not found')
-		cxx_verc_fail=yes
-		;;
-	*)
-		cxx_version="$cxx_version, bad"
-		cxx_verc_fail=yes
-		;;
-esac
+if test "$have_gcc" = yes; then
+	case $cxx_version in
+		2.95.[2-9]|2.95.[2-9][-.]*|3.[0-9]|3.[0-9].[0-9]|3.[0-9].[0-9][-.]*|4.[0-9]|4.[0-9].[0-9]|4.[0-9].[0-9][-.]*)
+			_cxx_major=`echo $cxx_version | cut -d '.' -f 1`
+			_cxx_minor=`echo $cxx_version | cut -d '.' -f 2`
+			cxx_version="$cxx_version, ok"
+			cxx_verc_fail=no
+			;;
+		# whacky beos version strings
+		2.9-beos-991026*|2.9-beos-000224*)
+			_cxx_major=2
+			_cxx_minor=95
+			cxx_version="$cxx_version, ok"
+			cxx_verc_fail=no
+			;;
+		3_4)
+			_cxx_major=3
+			_cxx_minor=4
+			;;
+		'not found')
+			cxx_verc_fail=yes
+			;;
+		*)
+			cxx_version="$cxx_version, bad"
+			cxx_verc_fail=yes
+			;;
+	esac
+else
+	case $_host_os in
+		irix*)
+			case $cxx_version in
+				7.4.4*)
+					# We just assume this is SGI MipsPRO
+					_cxx_major=7
+					_cxx_minor=4
+					add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MDupdate "$(*D)/$(DEPDIR)/$(*F).d"'
+					;;
+				*)
+					cxx_version="$cxx_version, bad"
+					cxx_verc_fail=yes
+					;;
+			esac
+			;;
+		*) 
+			cxx_version="$cxx_version, bad"
+			cxx_verc_fail=yes
+			;;
+	esac
 
+fi
+
 echo "$cxx_version"
 
 if test "$cxx_verc_fail" = yes ; then
@@ -1174,7 +1215,7 @@
 		;;
 	irix*)
 		DEFINES="$DEFINES -DUNIX -DIRIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
-		LIBS="$LIBS -lmd "
+		LIBS="$LIBS -lmd -lfastm -lm"
 		_ranlib=:
 		;;
 	darwin*)
@@ -2216,24 +2257,27 @@
 #
 # Do CXXFLAGS now we know the compiler version
 #
-if test "$_cxx_major" -ge "3" ; then
-	case $_host_os in
-	# newlib-based system include files suppress non-C89 function 
-	# declarations under __STRICT_ANSI__
-	mingw* | dreamcast | wii | gamecube | psp | wince | amigaos*)
-		CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
-		;;
-	*)
-		CXXFLAGS="$CXXFLAGS -ansi -W -Wno-unused-parameter"
-		;;
-	esac
-	add_line_to_config_mk 'HAVE_GCC3 = 1'
-fi;
+if test "$have_gcc" = yes ; then
+	if test "$_cxx_major" -ge "3" ; then
+		case $_host_os in
+		# newlib-based system include files suppress non-C89 function 
+		# declarations under __STRICT_ANSI__
+		mingw* | dreamcast | wii | gamecube | psp | wince | amigaos*)
+			CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
+			;;
+		*)
+			CXXFLAGS="$CXXFLAGS -ansi -W -Wno-unused-parameter"
+			;;
+		esac
+		add_line_to_config_mk 'HAVE_GCC3 = 1'
+		add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP'
+	fi;
 
-if test "$_cxx_major" -ge "4" && test "$_cxx_minor" -ge "3" ; then
-	CXXFLAGS="$CXXFLAGS -Wno-empty-body"
-else
-	CXXFLAGS="$CXXFLAGS -Wconversion"
+	if test "$_cxx_major" -ge "4" && test "$_cxx_minor" -ge "3" ; then
+		CXXFLAGS="$CXXFLAGS -Wno-empty-body"
+	else
+		CXXFLAGS="$CXXFLAGS -Wconversion"
+	fi;
 fi;
 
 # Some platforms use certain GNU extensions in header files


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list