summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure63
-rw-r--r--make/configure.pm28
2 files changed, 32 insertions, 59 deletions
diff --git a/configure b/configure
index 777c6c323..c8fbdce09 100755
--- a/configure
+++ b/configure
@@ -241,10 +241,12 @@ if ($config{CC} eq "") {
exit 1;
}
-our $exec = $config{CC} . " -dumpversion | cut -c 1";
-chomp($config{GCCVER} = `$exec`); # Major GCC Version
-$exec = $config{CC} . " -dumpversion | cut -c 3";
-chomp($config{GCCMINOR} = `$exec`);
+our %cxx = get_compiler_info($config{CC});
+if ($cxx{UNSUPPORTED}) {
+ print "Your C++ compiler is too old to build InspIRCd!\n";
+ print "Reason: $cxx{REASON}\n";
+ exit 1;
+}
if ($config{HAS_OPENSSL} =~ /^([-[:digit:].]+)(?:[a-z])?(?:\-[a-z][0-9])?/) {
$config{HAS_OPENSSL} = $1;
@@ -298,12 +300,6 @@ print ($cache_loaded ? "found\n" : "not found\n");
$config{SYSTEM} = lc $^O;
print "Checking operating system version... $config{SYSTEM}\n";
-$exec = $config{CC} . " -dumpversion | cut -c 1";
-chomp($config{GCCVER} = `$exec`); # Major GCC Version
-$exec = $config{CC} . " -dumpversion | cut -c 3";
-chomp($config{GCCMINOR} = `$exec`);
-
-
print "Checking whether <stdint.h> exists... ";
if (test_header($config{CC}, "stdint.h")) {
$config{HAS_STDINT} = "true";
@@ -439,36 +435,7 @@ STOP
}
print ".\n\n";
- $config{CHANGE_COMPILER} = "n";
- print "I have detected the following compiler: \e[1;32m$config{CC}\e[0m (version \e[1;32m$config{GCCVER}.$config{GCCMINOR}\e[0m)\n";
-
- while (($config{GCCVER} < 3) || ($config{GCCVER} eq "")) {
- print "\e[1;32mIMPORTANT!\e[0m A GCC 2.x compiler has been detected, and
-should NOT be used. You should probably specify a newer compiler.\n\n";
- yesno('CHANGE_COMPILER',"Do you want to change the compiler?");
- if ($config{CHANGE_COMPILER} =~ /y/i) {
- print "What command do you want to use to invoke your compiler?\n";
- print "[\e[1;32m$config{CC}\e[0m] -> ";
- chomp($config{CC} = <STDIN>);
- if ($config{CC} eq "") {
- $config{CC} = "g++";
- }
- chomp(my $foo = `$config{CC} -dumpversion | cut -c 1`);
- if ($foo ne "") {
- chomp($config{GCCVER} = `$config{CC} -dumpversion | cut -c 1`); # we must redo these if we change compilers
- chomp($config{GCCMINOR} = `$config{CC} -dumpversion | cut -c 3`);
- print "Queried compiler: \e[1;32m$config{CC}\e[0m (version \e[1;32m$config{GCCVER}.$config{GCCMINOR}\e[0m)\n";
- if ($config{GCCVER} < 4 || $config{GCCVER} == 4 && $config{GCCMINOR} < 1) {
- print "\e[1;32mGCC 4.1 and earlier WILL NOT WORK!\e[0m. Let's try that again, shall we?\n";
- }
- }
- else {
- print "\e[1;32mWARNING!\e[0m Could not execute the compiler you specified. You may want to try again.\n";
- }
- }
- }
-
- print "\n";
+ print "I have detected the following compiler: \e[1;32m$cxx{NAME}\e[0m (version \e[1;32m$cxx{VERSION}\e[0m)\n\n";
# Directory Settings..
my $tmpbase = $config{BASE_DIR};
@@ -688,19 +655,6 @@ if (($config{USE_GNUTLS} eq "y") || ($config{USE_OPENSSL} eq "y")) {
print "\e[1;32mhttp://wiki.inspircd.org/Installation_From_Tarball\e[0m\n";
}
print "*** \e[1;32mRemember to edit your configuration files!!!\e[0m ***\n\n\n";
-if (($config{OSNAME} eq "OpenBSD") && ($config{CC} ne "eg++")) {
- print "\e[1;32mWARNING!\e[0m You are running OpenBSD but you are using the base gcc package\nrather than eg++. This compile will most likely fail, but i'm letting you\ngo ahead with it anyway, just in case i'm wrong :-)\n";
-}
-
-if ($config{GCCVER} < "3") {
- print <<FOO2;
-\e[1;32mWARNING!\e[0m You are attempting to compile InspIRCd on GCC 2.x!
-GCC 2.x series compilers only had partial (read as broken) C++ support, and
-your compile will most likely fail horribly! If you have any problems, do NOT
-report them to the bugtracker or forums without first upgrading your compiler
-to a newer 3.x or 4.x (or whatever is available currently) version.
-FOO2
-}
################################################################################
# HELPER FUNCTIONS #
@@ -828,9 +782,6 @@ EOF
if ($config{OSNAME} =~ /MINGW32/i) {
print FILEHANDLE "#define IS_MINGW\n";
}
- if ($config{GCCVER} >= 3) {
- print FILEHANDLE "#define GCC3\n";
- }
if ($config{HAS_STDINT} eq "true") {
print FILEHANDLE "#define HAS_STDINT\n";
}
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";