summaryrefslogtreecommitdiff
path: root/make/configure.pm
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2013-07-04 08:41:33 +0100
committerPeter Powell <petpow@saberuk.com>2013-07-05 07:12:02 +0100
commit2677d12f20f2921b9724dc198f5e232fa9217d6a (patch)
tree9417d217535b45acbcc7f9b7b57a9895a86ca3af /make/configure.pm
parentf52123b1ed0b1bd96db2282f04f0e5852a50d782 (diff)
Automatically detect the compiler which the user has installed.
Diffstat (limited to 'make/configure.pm')
-rw-r--r--make/configure.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/make/configure.pm b/make/configure.pm
index 194d439e3..c022a7493 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -31,10 +31,20 @@ use warnings FATAL => qw(all);
use Exporter 'import';
use POSIX;
use make::utilities;
-our @EXPORT = qw(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(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 find_compiler {
+ foreach my $compiler ('c++', 'g++', 'clang++', 'icpc') {
+ return $compiler unless system "$compiler -v > /dev/null 2>&1";
+ if ($^O eq 'Darwin') {
+ return $compiler unless system "xcrun $compiler -v > /dev/null 2>&1";
+ }
+ }
+ return "";
+}
+
sub test_file($$;$) {
my ($cc, $file, $args) = @_;
my $status = 0;