diff options
author | Peter Powell <petpow@saberuk.com> | 2013-07-04 08:41:33 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2013-07-05 07:12:02 +0100 |
commit | 2677d12f20f2921b9724dc198f5e232fa9217d6a (patch) | |
tree | 9417d217535b45acbcc7f9b7b57a9895a86ca3af /configure | |
parent | f52123b1ed0b1bd96db2282f04f0e5852a50d782 (diff) |
Automatically detect the compiler which the user has installed.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 24 |
1 files changed, 7 insertions, 17 deletions
@@ -232,16 +232,15 @@ $config{DESTINATION} = "BASE"; # Is target path. if ($config{OSNAME} =~ /darwin/i) { $config{STARTSCRIPT} = "org.inspircd.plist"; # start script for OSX. - $config{CC} = "xcrun clang++"; # C++ compiler for OSX. } -else -{ - $config{CC} = "g++"; # C++ compiler -} -if (defined $ENV{CXX}) -{ - $config{CC} = $ENV{CXX}; + +$config{CC} = defined $ENV{CXX} && !system("$ENV{CXX} -v > /dev/null 2>&1") ? $ENV{CXX} : find_compiler(); +if ($config{CC} eq "") { + print "A C++ compiler could not be detected on your system!\n"; + print "Set the CXX environment variable to the full path if this is incorrect.\n"; + exit 1; } + our $exec = $config{CC} . " -dumpversion | cut -c 1"; chomp($config{GCCVER} = `$exec`); # Major GCC Version $exec = $config{CC} . " -dumpversion | cut -c 3"; @@ -253,15 +252,6 @@ if ($config{HAS_OPENSSL} =~ /^([-[:digit:].]+)(?:[a-z])?(?:\-[a-z][0-9])?/) { $config{HAS_OPENSSL} = ""; } -if (($config{GCCVER} eq "") || ($config{GCCMINOR} eq "")) { - if ($config{OSNAME} eq 'darwin') { - print $config{CC} . " was not found! You require clang++ (the LLVM C++ compiler, part of the OSX developer tools) to build InspIRCd!\n"; - } else { - print $config{CC} . " was not found! You require g++ (the GNU C++ compiler, part of GCC) to build InspIRCd!\n"; - } - exit; -} - # Get and Set some important vars.. getmodules(); |