From 20b0ed1da598a98b2b5036bc0decbd4aae79aa20 Mon Sep 17 00:00:00 2001 From: buffer51 Date: Wed, 27 Apr 2016 12:09:44 -0700 Subject: [PATCH] Fixed cross-suffix detection for path that contains dashes when the compiler itself doesn't --- c_check | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/c_check b/c_check index bcf4c2c..5242e33 100644 --- a/c_check +++ b/c_check @@ -1,5 +1,7 @@ #!/usr/bin/perl +use File::Basename; + # Checking cross compile $hostos = `uname -s | sed -e s/\-.*//`; chop($hostos); $hostarch = `uname -m | sed -e s/i.86/x86/`;chop($hostarch); @@ -26,14 +28,12 @@ if ($?) { $cross_suffix = ""; -if ($ARGV[0] =~ /(.*)(-[.\d]+)/) { - if ($1 =~ /(.*-)(.*)/) { - $cross_suffix = $1; - } -} else { - if ($ARGV[0] =~ /([^\/]*-)([^\/]*$)/) { - $cross_suffix = $1; - } +if (dirname($compiler_name) ne ".") { + $cross_suffix .= dirname($compiler_name) . "/"; +} + +if (basename($compiler_name) =~ /(.*-)(.*)/) { + $cross_suffix .= $1; } $compiler = ""; -- 2.7.4