Skip to content
Snippets Groups Projects
Commit ee383ed9 authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

add checks to prevent undef var messages in configure on RPi2

parent 944ffdf4
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env perl #!/usr/bin/env perl
# #
# configuration script for the binary_c/nucsyn code # The binary_c stellar population nucleosynthesis framework.
#
# Contact: r.izzard@surrey.ac.uk or rob.izzard@gmail.com
#
# http://personal.ph.surrey.ac.uk/~ri0005/binary_c.html
# https://gitlab.eps.surrey.ac.uk/ri0005/binary_c
# https://groups.google.com/forum/#!forum/binary_c-nucsyn-announce
# https://groups.google.com/forum/#!forum/binary_c-nucsyn-devel
# https://twitter.com/binary_c_code
# https://www.facebook.com/groups/149489915089142/
#
# Please see the files README, LICENCE and CHANGES,
# and the doc/ directory for documentation.
#
# This file is the configuration script for binary_c.
#
# This is version 2, a more modular, flexible script (I hope) # This is version 2, a more modular, flexible script (I hope)
# without all the dirty hacks, just some of them! :) # without all the dirty hacks, just some of them! :)
# #
# usage: # Usage:
# #
# Normal use, auto-detected CPU optimization: # Normal use:
# ./configure # ./configure
# #
# Debugging (-g): # Debugging (-g -Og):
# ./confgure debug # ./confgure debug
# #
# Debugging with -O3: # Debugging with -O3:
# ./configure optdebug # ./configure optdebug
# #
# Accurate (try to prevent floating point issues) # Accurate (try to prevent floating point issues, slower):
# ./configure accurate # ./configure accurate
# #
# For DUMA (http://en.wikipedia.org/wiki/Duma_%28software%29) # For DUMA (http://en.wikipedia.org/wiki/Duma_%28software%29)
...@@ -363,7 +378,8 @@ sub secondary_variables ...@@ -363,7 +378,8 @@ sub secondary_variables
my $orig=$regexp; my $orig=$regexp;
$regexp=~s/^\d+ //; $regexp=~s/^\d+ //;
#print "Check regexp\n"; #print "Check regexp\n";
if($cpuinfo{'flags'}=~/$regexp/) if(defined $cpuinfo{'flags'} &&
$cpuinfo{'flags'}=~/$regexp/)
{ {
$coptflags.=$sse_hash{$orig}.' '; $coptflags.=$sse_hash{$orig}.' ';
last; last;
...@@ -413,8 +429,8 @@ sub secondary_variables ...@@ -413,8 +429,8 @@ sub secondary_variables
{ {
$coptflags.=' -ffunction-sections '; $coptflags.=' -ffunction-sections ';
$lib.=' -L/usr/lib '; $lib.=' -L/usr/lib ';
print 'CPU Flags ',$cpuinfo{'flags'},"\n"; print 'CPU Flags ',$cpuinfo{'flags'}//'',"\n";
if($cpu=~/pentium/) if($cpu=~/pentium/)
{ {
...@@ -726,7 +742,8 @@ sub get_cpu ...@@ -726,7 +742,8 @@ sub get_cpu
$cpuinfo{'model name'}=~/atom/i ? 'atom' : $cpuinfo{'model name'}=~/atom/i ? 'atom' :
$cpuinfo{'model name'}=~/Core/ ? $cpuinfo{'model name'}=~/Core/ ?
($cpuinfo{'model name'}=~/i7/ ? ($cpuinfo{'model name'}=~/i7/ ?
($cpuinfo{flags}=~/\bavx\b/ ? 'corei7-avx' : 'i7') : (defined $cpuinfo{flags} &&
($cpuinfo{flags}=~/\bavx\b/ ? 'corei7-avx' : 'i7')) :
'core2') : 'i686' ) : 'i686'; 'core2') : 'i686' ) : 'i686';
} }
elsif($cpuinfo{'model name'}=~/amd/i) elsif($cpuinfo{'model name'}=~/amd/i)
...@@ -1753,7 +1770,8 @@ sub features ...@@ -1753,7 +1770,8 @@ sub features
# CPU has AVX or not? # CPU has AVX or not?
have_avx => have_avx =>
{ {
check =>(!$generic && check =>(!$generic &&
defined $cpuinfp{flags} &&
$cpuinfo{flags}=~/\bavx\b/) ? 1 : 0, $cpuinfo{flags}=~/\bavx\b/) ? 1 : 0,
cflags => ' -mavx ', cflags => ' -mavx ',
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment