diff options
-rw-r--r-- | crawl-ref/source/makefile | 9 | ||||
-rwxr-xr-x | crawl-ref/source/util/gcc-gte.pl | 59 |
2 files changed, 67 insertions, 1 deletions
diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile index a6246b1b0a..3fdb42db58 100644 --- a/crawl-ref/source/makefile +++ b/crawl-ref/source/makefile @@ -213,6 +213,8 @@ GCC := gcc GXX := g++ endif +GCC_GTE_4_3_0 := $(shell util/gcc-gte.pl $(GCC) 4.3.0) + RLTILES = rltiles # @@ -340,9 +342,14 @@ endif # MacOS endif # TILES -CFWARN_L := -D_FORTIFY_SOURCE=0 -Wno-array-bounds -Wno-parentheses -Wwrite-strings -Wshadow -pedantic +CFWARN_L := -D_FORTIFY_SOURCE=0 -Wno-parentheses -Wwrite-strings -Wshadow -pedantic CFOTHERS_L = $(EXTERNAL_FLAGS) $(EXTRA_FLAGS) $(DEFINES) -DCLUA_BINDINGS $(SDL_CFLAGS) +ifeq ($(GCC_GTE_4_3_0),Yes) +CFWARN_L += -Wno-array-bounds +endif + + # # Figure out the build settings for this type of build # diff --git a/crawl-ref/source/util/gcc-gte.pl b/crawl-ref/source/util/gcc-gte.pl new file mode 100755 index 0000000000..cd74544d7f --- /dev/null +++ b/crawl-ref/source/util/gcc-gte.pl @@ -0,0 +1,59 @@ +#!/usr/bin/perl +# +# Simple GCC version check +# +# I have a feeling this could be better-implemented, because +# it seems like the regex results should be available in an +# array (i.e $RESULT[1] == $1 or something), but whatever. +# But for now, this works fine. - Steven +# + +use strict; +use warnings; + +my $gcc = $ARGV[0]; +my $min = $ARGV[1]; + +if ( `which $gcc 2> /dev/null` ) { +} else { + die "Can't detect GCC version ($gcc is missing?)\n"; +} + +my $local = `$gcc -dumpversion`; +my $pattern = "([0-9]+).([0-9]+).([0-9]+)"; + +if ($local =~ $pattern) { +} else { + die "Version '$local' is malformed.\n"; +} + +my $local_major = $1; +my $local_minor = $2; +my $local_patch = $3; + +if ($min =~ $pattern) { +} else { + die "Version '$min' is malformed.\n"; +} + +my $min_major = $1; +my $min_minor = $2; +my $min_patch = $3; + +if ($local_major < $min_major) { + print "No\n"; + exit 0; +} + +if ($local_minor < $min_minor) { + print "No\n"; + exit 0; +} + +if ($local_patch < $min_patch) { + print "No\n"; + exit 0; +} + +print "Yes\n"; +exit 0; |