diff options
author | Steven Noonan <steven@uplinklabs.net> | 2009-10-14 04:06:20 -0700 |
---|---|---|
committer | Steven Noonan <steven@uplinklabs.net> | 2009-10-14 04:07:31 -0700 |
commit | eb61c8b8f8610c5720ac992db7d390e7f2283ffe (patch) | |
tree | 245b2a63f02d366ae7d9e008f4eae07490e7bbc3 /crawl-ref/source/util/gcc-gte.pl | |
parent | 97ac9424c4676f6dee9c9e2e8fd7cec93b5e37ce (diff) | |
download | crawl-ref-eb61c8b8f8610c5720ac992db7d390e7f2283ffe.tar.gz crawl-ref-eb61c8b8f8610c5720ac992db7d390e7f2283ffe.zip |
makefile: detect if GCC is >= 4.3.0 before adding -Wno-array-bounds
GCC versions less than 4.3.0 had a compiler error because
the -Wno-array-bounds flag wasn't valid.
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Diffstat (limited to 'crawl-ref/source/util/gcc-gte.pl')
-rwxr-xr-x | crawl-ref/source/util/gcc-gte.pl | 59 |
1 files changed, 59 insertions, 0 deletions
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; |