X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=make%2Fconfigure.pm;h=2cd5beb607495feea5c47a76d5db358b58ab6a7c;hb=100048eb41b2b8ab4565ea19eb25e1a0acdd07af;hp=a5cb05c60fdcf92885a9efe06cb4453b01b60fb7;hpb=541a66de7adbfe57dd4d3e998e8cc0db5585a266;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/make/configure.pm b/make/configure.pm index a5cb05c60..2cd5beb60 100644 --- a/make/configure.pm +++ b/make/configure.pm @@ -34,6 +34,7 @@ use Cwd qw(getcwd); use Exporter qw(import); use File::Basename qw(basename); +use make::common; use make::console; use make::utilities; @@ -92,6 +93,13 @@ sub __get_template_settings($$$) { return %settings; } +sub __test_compiler($) { + my $compiler = shift; + return 0 unless run_test("`$compiler`", !system "$compiler -v >/dev/null 2>&1"); + return 0 unless run_test("`$compiler`", test_file($compiler, 'compiler.cpp', '-fno-rtti'), 'compatible'); + return 1; +} + sub cmd_clean { unlink CONFIGURE_CACHE_FILE; } @@ -176,9 +184,10 @@ sub cmd_update { exit 0; } -sub run_test($$) { - my ($what, $result) = @_; - print_format "Checking whether <|GREEN $what|> is available ... "; +sub run_test($$;$) { + my ($what, $result, $adjective) = @_; + $adjective ||= 'available'; + print_format "Checking whether <|GREEN $what|> is $adjective ... "; print_format $result ? "<|GREEN yes|>\n" : "<|RED no|>\n"; return $result; } @@ -243,10 +252,8 @@ sub get_compiler_info($) { sub find_compiler { my @compilers = qw(c++ g++ clang++ icpc); foreach my $compiler (shift || @compilers) { - return $compiler if run_test "`$compiler`", test_file $compiler, 'compiler.cpp'; - if ($^O eq 'darwin') { - return $compiler if run_test "`xcrun $compiler`", test_file "xcrun $compiler", 'compiler.cpp'; - } + return $compiler if __test_compiler $compiler; + return "xcrun $compiler" if $^O eq 'darwin' && __test_compiler "xcrun $compiler"; } }