Skip to content

Commit

Permalink
Merge pull request #1067 from vrurg/macos-toolchain
Browse files Browse the repository at this point in the history
 Improve check for used toolchain on macOS
  • Loading branch information
jnthn committed Apr 18, 2019
2 parents d111dd9 + 3df135d commit 0852ddc
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Configure.pl
Expand Up @@ -175,10 +175,17 @@ sub uniq {
# If we're in macOS, let's verify that the toolchain is consistent.
if ($^O eq 'darwin') {
my $gnu_count = 0;
my $gnu_toolchain = (exists $args{toolchain}) && ($args{toolchain} eq 'gnu');

unless ($gnu_toolchain) {
# When XCode toolchain is used then force use of XCode's make if
# available.
$config{make} = '/usr/bin/make' if -x '/usr/bin/make';
}

# Here are the tools that seem to cause trouble.
# If you see other ones, please add them to this list.
my @check_tools = qw/ar cc ld make/;
my @check_tools = qw/ar cc ld/;
for my $tool (map { `which $_` } @config{@check_tools}) {
chomp $tool;
system "grep -b 'gnu' '$tool'"; # Apple utilities don't match `gnu`
Expand All @@ -188,20 +195,14 @@ sub uniq {
}

## For a GNU toolchain, make sure that they're all GNU.
if (exists $args{toolchain} &&
$args{toolchain} eq 'gnu' &&
$gnu_count != scalar @check_tools)
{
if ($gnu_toolchain && $gnu_count != scalar @check_tools) {
print "\nNot all tools in the toolchain are GNU. Please correct this and retry.\n"
. "See README.markdown for more details.\n\n";
exit -1;
}

## Otherwise, make sure that none of them are GNU
elsif ((!exists $args{toolchain} ||
$args{toolchain} ne 'gnu' ) &&
$gnu_count != 0)
{
elsif (!$gnu_toolchain && $gnu_count != 0) {
print "\nGNU tools detected, despite this not being a GNU-oriented build.\n"
." Please correct this and retry. See README.markdown for more details.\n\n";
exit -1;
Expand Down

0 comments on commit 0852ddc

Please sign in to comment.