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

update configure and clean scripts

parent 44ace25c
No related branches found
No related tags found
No related merge requests found
...@@ -20,3 +20,7 @@ rm amanda_sn_plot.pl binary_c-antiTZ binary_c-Ba binary_c.orig binary_c-sn2014 ...@@ -20,3 +20,7 @@ rm amanda_sn_plot.pl binary_c-antiTZ binary_c-Ba binary_c.orig binary_c-sn2014
rm -rf faillist fails imfticks fionread rm -rf faillist fails imfticks fionread
rm *~ src/*~ src/*/*~ rm *~ src/*~ src/*/*~
clean-svn.pl clean-svn.pl
svn rm novae*pdf
svn rm novae*plt
svn rm cemps
...@@ -462,9 +462,9 @@ sub secondary_variables ...@@ -462,9 +462,9 @@ sub secondary_variables
if($cc =~ /^(?:gcc|clang)/) if($cc =~ /^(?:gcc|clang)/)
{ {
# libraries we should include if we can # libraries we should include if we can
if((checklib('libbfd')=~/libbfd-(\d+\.\d+)/)[0] && if(checklib('libbfd') &&
test_for_header_file('bfd.h')) test_for_header_file('bfd.h'))
{ {
$cflags .= ' -D__HAVE_LIBBFD__ '; $cflags .= ' -D__HAVE_LIBBFD__ ';
$extralibs.= ' -lbfd '; $extralibs.= ' -lbfd ';
} }
...@@ -1215,12 +1215,37 @@ sub stripversion ...@@ -1215,12 +1215,37 @@ sub stripversion
sub checklib sub checklib
{ {
# simple library checker : beware unescaped grep # simple library checking function :
# on error return '' (empty string)
# get the library name
my $lib = shift; my $lib = shift;
my $r = `ldconfig -p |grep $lib`; my $striplib = ($lib=~/lib(.*)/)[0];
my $r;
# first try with ld because this is supposed to work on the mac
$r = `ld -l$striplib 2>\&1`;
# check for error string : if the library isn't found
# then return an empty
if($r=~/cannot find -l$striplib/ ||
$r=~/not found for -l$striplib/)
{
# library not found : return empty string
return '';
}
# find location using ld, return if found
$r = `ld --verbose -l$striplib 2>\&1`;
if($r=~/attempt to open (\S+lib$striplib.so) succeeded/)
{
return $1;
}
# ld failed, try ldconfig
$r = `ldconfig -p |grep $lib`;
$r=~s/^\s+//; $r=~s/^\s+//;
$r=~s/\s+$//; $r=~s/\s+$//;
return $r if($r ne ''); return $r if($r ne '');
# check in LIBRARY_PATH and LD_LIBRARY_PATH # check in LIBRARY_PATH and LD_LIBRARY_PATH
......
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