@@ -18,11 +18,12 @@ $binary = $ENV{"BINARY"};
1818$makefile = shift (@ARGV );
1919$config = shift (@ARGV );
2020
21- $compiler_name = join (" " , @ARGV );
21+ $compiler_name = shift (@ARGV );
22+ $flags = join (" " , @ARGV );
2223
2324# First, we need to know the target OS and compiler name
2425
25- $data = ` $compiler_name -E ctest.c` ;
26+ $data = ` $compiler_name $flags -E ctest.c` ;
2627
2728if ($? ) {
2829 printf STDERR " C Compiler ($compiler_name ) is something wrong.\n " ;
@@ -175,7 +176,7 @@ if ($defined == 0) {
175176
176177# Do again
177178
178- $data = ` $compiler_name -E ctest.c` ;
179+ $data = ` $compiler_name $flags -E ctest.c` ;
179180
180181if ($? ) {
181182 printf STDERR " C Compiler ($compiler_name ) is something wrong.\n " ;
@@ -195,7 +196,7 @@ if (($architecture eq "mips") || ($architecture eq "mips64")) {
195196 print $tmpf " void main(void){ __asm__ volatile($code ); }\n " ;
196197
197198 $args = " $msa_flags -o $tmpf .o $tmpf " ;
198- my @cmd = (" $compiler_name $args >/dev/null 2>/dev/null" );
199+ my @cmd = (" $compiler_name $flags $ args >/dev/null 2>/dev/null" );
199200 system (@cmd ) == 0;
200201 if ($? != 0) {
201202 $have_msa = 0;
@@ -236,7 +237,7 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) {
236237 if ($compiler eq " PGI" ) {
237238 $args = " -tp skylake -c -o $tmpf .o $tmpf " ;
238239 }
239- my @cmd = (" $compiler_name $args >/dev/null 2>/dev/null" );
240+ my @cmd = (" $compiler_name $flags $ args >/dev/null 2>/dev/null" );
240241 system (@cmd ) == 0;
241242 if ($? != 0) {
242243 $no_avx512 = 1;
@@ -247,7 +248,7 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) {
247248 }
248249}
249250
250- $data = ` $compiler_name -S ctest1.c && grep globl ctest1.s | head -n 1 && rm -f ctest1.s` ;
251+ $data = ` $compiler_name $flags -S ctest1.c && grep globl ctest1.s | head -n 1 && rm -f ctest1.s` ;
251252
252253$data =~ / globl\s ([_\. ]*)(.*)/ ;
253254
@@ -263,27 +264,14 @@ if ($architecture ne $hostarch) {
263264
264265$cross = 1 if ($os ne $hostos );
265266
266- # rework cross suffix and architecture if we are on OSX cross-compiling for ARMV8-based IOS
267- # the initial autodetection will have been confused by the command-line arguments to clang
268- # and the cross-compiler apparently still claims to build for x86_64 in its CC -E output
269- if (($os eq " Darwin" ) && ($cross_suffix ne " " )) {
270- my $tmpnam = ` xcrun --sdk iphoneos --find clang` ;
271- $cross_suffix = substr ($tmpnam , 0, rindex ($tmpnam , " /" )+1 );
272- # this should produce something like $cross_suffix="/Applications/Xcode-10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/";
273- $cross =1;
274- $architecture = arm64;
275- }
276-
277-
278-
279267$openmp = " " if $ENV {USE_OPENMP } != 1;
280268
281269$linker_L = " " ;
282270$linker_l = " " ;
283271$linker_a = " " ;
284272
285273{
286- $link = ` $compiler_name -c ctest2.c -o ctest2.o 2>&1 && $compiler_name $openmp -v ctest2.o -o ctest2 2>&1 && rm -f ctest2.o ctest2 ctest2.exe` ;
274+ $link = ` $compiler_name $flags -c ctest2.c -o ctest2.o 2>&1 && $compiler_name $flags $openmp -v ctest2.o -o ctest2 2>&1 && rm -f ctest2.o ctest2 ctest2.exe` ;
287275
288276 $link =~ s /\- Y\s P\, / \- Y/ g ;
289277
0 commit comments