Skip to content

Commit

Permalink
cons: Use xml2-config to set up external dependency (#404)
Browse files Browse the repository at this point in the history
When we configure the build with xml2 as external dependency we can rely
on xml2-config found in PATH

This is similar to #357 where we
also use config utilities to set up fastjet and gsl packages and #402
for mysql

[skip ci]
  • Loading branch information
plexoos authored Oct 2, 2022
1 parent be608cb commit 05ac703
Showing 1 changed file with 34 additions and 42 deletions.
76 changes: 34 additions & 42 deletions mgr/ConsDefs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -970,53 +970,45 @@
"LIBDIR = $LoggerLIBDIR \tLoggerINCDIR = $LoggerINCDIR \tLoggerLIBS = $LoggerLIBS\n"
if $LoggerLIBDIR && ! $param::quiet;
}

# xml2
my ($XMLINCDIR,$XMLLIBDIR,$XMLLIBS) = ("","","");
my ($xml) = script::find_lib($MYSTAR . "/bin /usr/bin " . $LIBXML2_DIR . "/bin " . dirname(`which xml2-config`),
"xml2-config");
if ($xml) {
$xml .= "/xml2-config";
$XMLINCDIR = `$xml --cflags`;
chomp($XMLINCDIR);
$XMLINCDIR =~ s/-I//;
my $XML = `$xml --libs`; # die "$XML\n";
my(@libs)= split(" ", $XML);

$XMLLIBDIR = shift(@libs);
if ($XMLLIBDIR =~ /-L/){
$XMLLIBDIR =~ s/-L//;
$XMLLIBS = join(" ",@libs);
} else {
# no -L, assume all were LIBS
$XMLLIBS = $XMLLIBDIR ." ".join(" ",@libs);
# and fix -L / should work for both 32 and 64
$XMLLIBDIR = "/usr/$LLIB";
}
chomp(my $xml = `which xml2-config`);

if ($?) {
die "No xml2-config found\n";
}

# ($XMLLIBDIR,$XMLLIBS) = split(' ', $XML);
# if ($XMLLIBDIR =~ /-L/){
# $XMLLIBDIR =~ s/-L//;
# } else {
# # may not have any -L
# if ($XMLLIBS
# }
my ($XMLINCDIR,$XMLLIBDIR,$XMLLIBS) = ("","","");

my $XMLVersion = `$xml --version`; # print "XMLVersion = $XMLVersion\n";
my ($major,$minor) = split '\.', $XMLVersion; # print "major = $major,minor = $minor\n";
$XMLCPPFlag = "";#-DXmlTreeReader";
if ($major < 2 or $major == 2 and $minor < 5) {
$XMLCPPFlag = "-DNoXmlTreeReader";
}
if ( ! $param::quiet ){
if ( $XMLLIBDIR ){
print "Use xml $xml XMLLIBDIR = $XMLLIBDIR \tXMLINCDIR = $XMLINCDIR \tXMLLIBS = $XMLLIBS XMLCPPFlag =$XMLCPPFlag\n";
} else {
print "Use xml -> WARNING ** Could not define XMLLIBDIR, XMLINCDIR, XMLLIBS\n";
}
}
$XMLINCDIR = `$xml --cflags`;
chomp($XMLINCDIR);
$XMLINCDIR =~ s/-I//;
my $XML = `$xml --libs`; # die "$XML\n";
my(@libs)= split(" ", $XML);

$XMLLIBDIR = shift(@libs);
if ($XMLLIBDIR =~ /-L/){
$XMLLIBDIR =~ s/-L//;
$XMLLIBS = join(" ",@libs);
} else {
print "Could not find xml libs\n" if (! $param::quiet);
# no -L, assume all were LIBS
$XMLLIBS = $XMLLIBDIR ." ".join(" ",@libs);
# and fix -L / should work for both 32 and 64
$XMLLIBDIR = "/usr/$LLIB";
}

my $XMLVersion = `$xml --version`; # print "XMLVersion = $XMLVersion\n";
my ($major,$minor) = split '\.', $XMLVersion; # print "major = $major,minor = $minor\n";
$XMLCPPFlag = "";#-DXmlTreeReader";
if ($major < 2 or $major == 2 and $minor < 5) {
$XMLCPPFlag = "-DNoXmlTreeReader";
}
if ( ! $param::quiet ){
if ( $XMLLIBDIR ){
print "Using $xml\n\tXMLLIBDIR = $XMLLIBDIR\n\tXMLINCDIR = $XMLINCDIR\n\tXMLLIBS = $XMLLIBS\n\tXMLCPPFlag = $XMLCPPFlag\n" if !$param::quiet;
} else {
print "Use xml -> WARNING ** Could not define XMLLIBDIR, XMLINCDIR, XMLLIBS\n";
}
}

chomp($FASTJET_PREFIX = `fastjet-config --prefix`);
Expand Down

0 comments on commit 05ac703

Please sign in to comment.