#!/usr/bin/env perl

use FindBin;
use lib $FindBin::Bin;
use Run qw(ret run);
use strict;

my $preset_comm=$ENV{'CHPL_COMM'};
my $comm;

if ($preset_comm eq "") {
    my $platform = run("platform", "--target");
    # automatically uses gasnet when on a cray-x* or cray-cs machine
    if ($platform =~ /^cray-(xc|xe|xk|xt|cs)$/) {
        $comm = "gasnet";
    } else {
        $comm = "none";
    }
} else {
    $comm = $preset_comm;
}

ret($comm);
print "$comm\n" unless caller;
