summaryrefslogtreecommitdiff
path: root/make
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2013-07-04 09:27:12 +0100
committerPeter Powell <petpow@saberuk.com>2013-07-05 07:12:02 +0100
commit77a08e490c340ffeca089fb15043490f1ce4b7de (patch)
tree40f3586d7e8736cda75a5530c837a60fc2cc2748 /make
parent2677d12f20f2921b9724dc198f5e232fa9217d6a (diff)
Correctly detect the compiler version and whether it is acceptable.
Diffstat (limited to 'make')
-rw-r--r--make/configure.pm28
1 files changed, 25 insertions, 3 deletions
diff --git a/make/configure.pm b/make/configure.pm
index c022a7493..95499720f 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -31,10 +31,33 @@ use warnings FATAL => qw(all);
use Exporter 'import';
use POSIX;
use make::utilities;
-our @EXPORT = qw(find_compiler test_file test_header promptnumeric dumphash is_dir getmodules getrevision getcompilerflags getlinkerflags getdependencies nopedantic resolve_directory yesno showhelp promptstring_s module_installed);
+our @EXPORT = qw(get_compiler_info find_compiler test_file test_header promptnumeric dumphash is_dir getmodules getrevision getcompilerflags getlinkerflags getdependencies nopedantic resolve_directory yesno showhelp promptstring_s module_installed);
my $no_git = 0;
+sub get_compiler_info($) {
+ my %info = (NAME => shift, VERSION => '0.0');
+ my $version = `$info{NAME} -v 2>&1`;
+ return (ERROR => 1) if $?;
+ if ($version =~ /(?:clang|llvm)\sversion\s(\d+\.\d+)/i) {
+ $info{NAME} = 'Clang';
+ $info{VERSION} = $1;
+ $info{UNSUPPORTED} = $1 lt '3.0';
+ $info{REASON} = 'Clang 2.9 and older do not have adequate C++ support.';
+ } elsif ($version =~ /gcc\sversion\s(\d+\.\d+)/i) {
+ $info{NAME} = 'GCC';
+ $info{VERSION} = $1;
+ $info{UNSUPPORTED} = $1 lt '4.1';
+ $info{REASON} = 'GCC 4.0 and older do not have adequate C++ support.';
+ } elsif ($version =~ /(?:icc|icpc)\sversion\s(\d+\.\d+).\d+\s\(gcc\sversion\s(\d+\.\d+).\d+/i) {
+ $info{NAME} = 'ICC';
+ $info{VERSION} = $1;
+ $info{UNSUPPORTED} = $2 lt '4.1';
+ $info{REASON} = "ICC $1 (GCC $2 compatibility mode) does not have adequate C++ support."
+ }
+ return %info;
+}
+
sub find_compiler {
foreach my $compiler ('c++', 'g++', 'clang++', 'icpc') {
return $compiler unless system "$compiler -v > /dev/null 2>&1";
@@ -247,8 +270,7 @@ sub dumphash()
print "\e[0mBase install path:\e[1;32m\t\t$main::config{BASE_DIR}\e[0m\n";
print "\e[0mConfig path:\e[1;32m\t\t\t$main::config{CONFIG_DIR}\e[0m\n";
print "\e[0mModule path:\e[1;32m\t\t\t$main::config{MODULE_DIR}\e[0m\n";
- print "\e[0mGCC Version Found:\e[1;32m\t\t$main::config{GCCVER}.$main::config{GCCMINOR}\e[0m\n";
- print "\e[0mCompiler program:\e[1;32m\t\t$main::config{CC}\e[0m\n";
+ print "\e[0mCompiler:\e[1;32m\t\t\t$main::cxx{NAME} $main::cxx{VERSION}\e[0m\n";
print "\e[0mGnuTLS Support:\e[1;32m\t\t\t$main::config{USE_GNUTLS}\e[0m\n";
print "\e[0mOpenSSL Support:\e[1;32m\t\t$main::config{USE_OPENSSL}\e[0m\n\n";
print "\e[1;32mImportant note: The maximum length values are now configured in the\e[0m\n";