aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-09-25 12:11:27 +0000
committerMax Horn2009-09-25 12:11:27 +0000
commit26f2597fd1d8f7b5264ffa12d2d80a690d0f4503 (patch)
tree3c082dd6fc990523d0f9caa1233f99cc430f4603
parentf91f4d4186f06281f3e1cd3c2b267f6dd9018220 (diff)
downloadscummvm-rg350-26f2597fd1d8f7b5264ffa12d2d80a690d0f4503.tar.gz
scummvm-rg350-26f2597fd1d8f7b5264ffa12d2d80a690d0f4503.tar.bz2
scummvm-rg350-26f2597fd1d8f7b5264ffa12d2d80a690d0f4503.zip
Modified version of patch #2838507: Add support for non-gcc compilers to configure, Makefile etc
svn-id: r44348
-rw-r--r--Makefile47
-rw-r--r--Makefile.common42
-rwxr-xr-xconfigure134
3 files changed, 135 insertions, 88 deletions
diff --git a/Makefile b/Makefile
index 2ed634bdc5..13ef5f3fdb 100644
--- a/Makefile
+++ b/Makefile
@@ -19,28 +19,31 @@ MODULE_DIRS :=
# Load the make rules generated by configure
-include config.mk
-
-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
-
-# 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
+-include Makedepend
+
+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
+
+ # 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
+endif
#######################################################################
# Default commands - put the necessary replacements in config.mk #
diff --git a/Makefile.common b/Makefile.common
index 6c0e2101ad..790dca8f89 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -89,34 +89,34 @@ clean:
$(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
diff --git a/configure b/configure
index 379e110884..56d091251f 100755
--- a/configure
+++ b/configure
@@ -1008,37 +1008,78 @@ fi
#
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"
@@ -1174,7 +1215,7 @@ case $_host_os in
;;
irix*)
DEFINES="$DEFINES -DUNIX -DIRIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
- LIBS="$LIBS -lmd "
+ LIBS="$LIBS -lmd -lfastm -lm"
_ranlib=:
;;
darwin*)
@@ -2216,24 +2257,27 @@ MODULES="$MODULES backends/platform/$_backend"
#
# 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