Ticket #9069: configure-non-gcc-compilers.patch

File configure-non-gcc-compilers.patch, 7.6 KB (added by SF/canavan, 15 years ago)
  • configure

     
    946946
    947947cxx_version=`( $CXX -dumpversion ) 2>&1`
    948948if test "$?" -gt 0; then
    949         cxx_version="not found"
     949        # TODO: Big scary warning about unsupported Compilers
     950        cxx_version=`( $CXX -version ) 2>&1`
     951        if test "$?" -eq 0; then
     952                cxx_version="`echo "${cxx_version}" | sed -ne 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/gp'`"
     953                if test -z "${cxx_version}"; then
     954                        cxx_version="not found"
     955                        cxx_verc_fail=yes
     956                fi
     957                echo non-gcc compiler version ${cxx_version}
     958        else
     959                cxx_version="not found"
     960                cxx_verc_fail=yes
     961                echo fooo non-gcc compiler version ${cxx_version}
     962        fi
     963else
     964        add_line_to_config_mk 'HAVE_GCC = 1'
     965        HAVE_GCC=1
    950966fi
    951967
    952 case $cxx_version in
    953         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][-.]*)
    954                 _cxx_major=`echo $cxx_version | cut -d '.' -f 1`
    955                 _cxx_minor=`echo $cxx_version | cut -d '.' -f 2`
    956                 cxx_version="$cxx_version, ok"
    957                 cxx_verc_fail=no
    958                 ;;
    959         # whacky beos version strings
    960         2.9-beos-991026*|2.9-beos-000224*)
    961                 _cxx_major=2
    962                 _cxx_minor=95
    963                 cxx_version="$cxx_version, ok"
    964                 cxx_verc_fail=no
    965                 ;;
    966         3_4)
    967                 _cxx_major=3
    968                 _cxx_minor=4
    969                 ;;
    970         'not found')
    971                 cxx_verc_fail=yes
    972                 ;;
    973         *)
    974                 cxx_version="$cxx_version, bad"
    975                 cxx_verc_fail=yes
    976                 ;;
    977 esac
     968if test "$HAVE_GCC" -eq 1; then
     969        case $cxx_version in
     970                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][-.]*)
     971                        _cxx_major=`echo $cxx_version | cut -d '.' -f 1`
     972                        _cxx_minor=`echo $cxx_version | cut -d '.' -f 2`
     973                        cxx_version="$cxx_version, ok"
     974                        cxx_verc_fail=no
     975                        ;;
     976                # whacky beos version strings
     977                2.9-beos-991026*|2.9-beos-000224*)
     978                        _cxx_major=2
     979                        _cxx_minor=95
     980                        cxx_version="$cxx_version, ok"
     981                        cxx_verc_fail=no
     982                        ;;
     983                3_4)
     984                        _cxx_major=3
     985                        _cxx_minor=4
     986                        ;;
     987                'not found')
     988                        cxx_verc_fail=yes
     989                        ;;
     990                *)
     991                        cxx_version="$cxx_version, bad"
     992                        cxx_verc_fail=yes
     993                        ;;
     994        esac
     995else
     996        case $_host_os in
     997                irix*)
     998                        case $cxx_version in
     999                                7.4.4*)
     1000                                        _cxx_major=7
     1001                                        _cxx_minor=4
     1002                                        ;;
     1003                                *)
     1004                                        cxx_version="$cxx_version, bad"
     1005                                        cxx_verc_fail=yes
     1006                                        ;;
     1007                        esac
     1008                        ;;
     1009                *)
     1010                        cxx_version="$cxx_version, bad"
     1011                        cxx_verc_fail=yes
     1012                        ;;
     1013        esac
    9781014
     1015fi
     1016
    9791017echo "$cxx_version"
    9801018
    9811019if test "$cxx_verc_fail" = yes ; then
     
    11101148                ;;
    11111149        irix*)
    11121150                DEFINES="$DEFINES -DUNIX -DIRIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
    1113                 LIBS="$LIBS -lmd "
     1151                LIBS="$LIBS -lmd -lfastm -lm"
     1152                if test "$HAVE_GCC" -ne 1 ; then
     1153                        add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MDupdate'
     1154                fi
    11141155                _ranlib=:
    11151156                ;;
    11161157        darwin*)
     
    20002041#
    20012042# Do CXXFLAGS now we know the compiler version
    20022043#
    2003 if test "$_cxx_major" -ge "3" ; then
    2004         case $_host_os in
    2005         # newlib-based system include files suppress non-C89 function
    2006         # declarations under __STRICT_ANSI__
    2007         mingw* | dreamcast | wii | gamecube | psp | wince | amigaos*)
    2008                 CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
    2009                 ;;
    2010         *)
    2011                 CXXFLAGS="$CXXFLAGS -ansi -W -Wno-unused-parameter"
    2012                 ;;
    2013         esac
    2014         add_line_to_config_mk 'HAVE_GCC3 = 1'
    2015 fi;
     2044if test "$HAVE_GCC" -eq 1 ; then
     2045        if test "$_cxx_major" -ge "3" ; then
     2046                case $_host_os in
     2047                # newlib-based system include files suppress non-C89 function
     2048                # declarations under __STRICT_ANSI__
     2049                mingw* | dreamcast | wii | gamecube | psp | wince | amigaos*)
     2050                        CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter"
     2051                        ;;
     2052                *)
     2053                        CXXFLAGS="$CXXFLAGS -ansi -W -Wno-unused-parameter"
     2054                        ;;
     2055                esac
     2056                add_line_to_config_mk 'HAVE_GCC3 = 1'
     2057        fi;
    20162058
    2017 if test "$_cxx_major" -ge "4" && test "$_cxx_minor" -ge "3" ; then
    2018         CXXFLAGS="$CXXFLAGS -Wno-empty-body"
    2019 else
    2020         CXXFLAGS="$CXXFLAGS -Wconversion"
     2059        if test "$_cxx_major" -ge "4" && test "$_cxx_minor" -ge "3" ; then
     2060                CXXFLAGS="$CXXFLAGS -Wno-empty-body"
     2061        else
     2062                CXXFLAGS="$CXXFLAGS -Wconversion"
     2063        fi;
    20212064fi;
    20222065
    20232066# Some platforms use certain GNU extensions in header files
  • Makefile.common

     
    7373        $(RM_REC) $(DEPDIRS)
    7474        $(RM) $(OBJS) $(EXECUTABLE)
    7575
     76ifndef HAVE_GCC
     77INCS    = config.h
     78ifdef CXX_UPDATE_DEP_FLAG
     79%.o: %.cpp
     80        $(MKDIR) $(*D)/$(DEPDIR)
     81        $(CXX) $(CXX_UPDATE_DEP_FLAG) "$(*D)/$(DEPDIR)/$(*F).d" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
     82else
    7683# Old (dumb) compile & dependcy rules
    77 #INCS   = scumm/scumm.h common/scummsys.h
    78 #.cpp.o:
    79 #       $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
    80 #$(OBJS): $(INCS)
     84.cpp.o:
     85        $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
    8186
     87$(OBJS): $(INCS)
     88endif
     89endif
     90
     91ifdef HAVE_GCC
    8292ifndef HAVE_GCC3
    83 # If you use GCC, disable the above and enable this for intelligent
    84 # dependency tracking.
     93# If you use GCC, enable this for intelligent # dependency tracking.
    8594%.o: %.cpp
    8695        $(MKDIR) $(*D)/$(DEPDIR)
    8796        $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
     
    100109        $(MKDIR) $(*D)/$(DEPDIR)
    101110        $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(OBJCFLAGS) -c $(<) -o $*.o
    102111endif
     112endif
    103113
    104114ifdef HAVE_NASM
    105115%.o: %.asm
  • Makefile

     
    1919
    2020# Load the make rules generated by configure
    2121-include config.mk
     22-include Makedepend
    2223
    23 CXXFLAGS:= -Wall $(CXXFLAGS)
    24 # Turn off some annoying and not-so-useful warnings
    25 CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
    26 # Enable even more warnings...
    27 CXXFLAGS+= -Wpointer-arith -Wcast-qual -Wcast-align
    28 CXXFLAGS+= -Wshadow -Wimplicit -Wnon-virtual-dtor -Wwrite-strings
     24ifeq "$(HAVE_GCC)" "1"
     25        CXXFLAGS:= -Wall $(CXXFLAGS)
     26        # Turn off some annoying and not-so-useful warnings
     27        CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
     28        # Enable even more warnings...
     29        CXXFLAGS+= -Wpointer-arith -Wcast-qual -Wcast-align
     30        CXXFLAGS+= -Wshadow -Wimplicit -Wnon-virtual-dtor -Wwrite-strings
    2931
    30 # Currently we disable this gcc flag, since it will also warn in cases,
    31 # where using GCC_PRINTF (means: __attribute__((format(printf, x, y))))
    32 # is not possible, thus it would fail compiliation with -Werror without
    33 # being helpful.
    34 #CXXFLAGS+= -Wmissing-format-attribute
     32        # Currently we disable this gcc flag, since it will also warn in cases,
     33        # where using GCC_PRINTF (means: __attribute__((format(printf, x, y))))
     34        # is not possible, thus it would fail compiliation with -Werror without
     35        # being helpful.
     36        #CXXFLAGS+= -Wmissing-format-attribute
    3537
    36 # Disable RTTI and exceptions, and enabled checking of pointers returned by "new"
    37 CXXFLAGS+= -fno-rtti -fno-exceptions -fcheck-new
     38        # Disable RTTI and exceptions, and enabled checking of pointers returned by "new"
     39        CXXFLAGS+= -fno-rtti -fno-exceptions -fcheck-new
    3840
    39 # There is a nice extra warning that flags variables that are potentially
    40 # used before being initialized. Very handy to catch a certain kind of
    41 # bugs. Unfortunately, it only works when optimizations are turned on,
    42 # which is why we normally don't use it.
    43 #CXXFLAGS+= -O -Wuninitialized
     41        # There is a nice extra warning that flags variables that are potentially
     42        # used before being initialized. Very handy to catch a certain kind of
     43        # bugs. Unfortunately, it only works when optimizations are turned on,
     44        # which is why we normally don't use it.
     45        #CXXFLAGS+= -O -Wuninitialized
     46endif
    4447
    4548#######################################################################
    4649# Default commands - put the necessary replacements in config.mk      #