Cloudy & Associates

Commit 06653047 authored by Chatzikos, Marios's avatar Chatzikos, Marios
Browse files

Update capabilities.pl for Apple M1 chip

Compilers for the M1 produce position-independent code by default.
Issuing '-fno-pie' on the command line emits an innocuous warning.

The present implementation checks on the compiler's capabilities only if
the chip is not arm64.

Clang++ version is:

   $  clang++ --version
   Apple clang version 13.0.0 (clang-1300.0.27.3)
   Target: arm64-apple-darwin21.5.0
parent a4b67eed
......@@ -2,6 +2,13 @@
# this script checks whether the installed g++ supports certain features we need
$res = "";
$os = `uname -s`;
$arch = "";
if( $os =~ /Darwin/ )
{
my $tmp = `uname -m`;
chomp( $tmp );
$arch = "arm64" if( $tmp =~ m/arm64/ );
}
$version = `$ARGV[0] --version 2> /dev/null`;
# remove comments in parentheses, they may or may not contain spaces
$version =~ s/\(.*?\)//g;
......@@ -60,16 +67,19 @@ if( "$^O" ne "cygwin" ) {
}
}
unlink "tmp_cloudyconfig.out";
# test if the -no-pie and -fno-pie flags are supported
if( $compiler eq "clang" || $os =~ /Darwin/ ) {
$npflags = "-fno-pie";
}
else {
$npflags = "-no-pie -fno-pie";
}
$ret = system( "$ARGV[0] $npflags -o tmp_cloudyconfig.out tmp_cloudyconfig.cpp > /dev/null 2>&1" );
if( $ret == 0 ) {
$res .= "$npflags ";
if( $arch ne "arm64" )
{
# test if the -no-pie and -fno-pie flags are supported
if( $compiler eq "clang" || $os =~ /Darwin/ ) {
$npflags = "-fno-pie";
}
else {
$npflags = "-no-pie -fno-pie";
}
$ret = system( "$ARGV[0] $npflags -o tmp_cloudyconfig.out tmp_cloudyconfig.cpp > /dev/null 2>&1" );
if( $ret == 0 ) {
$res .= "$npflags ";
}
}
unlink "tmp_cloudyconfig.cpp";
unlink "tmp_cloudyconfig.out";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment