Skip to content

Commit 05ac703

Browse files
authored
cons: Use xml2-config to set up external dependency (star-bnl#404)
When we configure the build with xml2 as external dependency we can rely on xml2-config found in PATH This is similar to star-bnl#357 where we also use config utilities to set up fastjet and gsl packages and star-bnl#402 for mysql [skip ci]
1 parent be608cb commit 05ac703

1 file changed

Lines changed: 34 additions & 42 deletions

File tree

mgr/ConsDefs.pm

Lines changed: 34 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -970,53 +970,45 @@
970970
"LIBDIR = $LoggerLIBDIR \tLoggerINCDIR = $LoggerINCDIR \tLoggerLIBS = $LoggerLIBS\n"
971971
if $LoggerLIBDIR && ! $param::quiet;
972972
}
973+
973974
# xml2
974-
my ($XMLINCDIR,$XMLLIBDIR,$XMLLIBS) = ("","","");
975-
my ($xml) = script::find_lib($MYSTAR . "/bin /usr/bin " . $LIBXML2_DIR . "/bin " . dirname(`which xml2-config`),
976-
"xml2-config");
977-
if ($xml) {
978-
$xml .= "/xml2-config";
979-
$XMLINCDIR = `$xml --cflags`;
980-
chomp($XMLINCDIR);
981-
$XMLINCDIR =~ s/-I//;
982-
my $XML = `$xml --libs`; # die "$XML\n";
983-
my(@libs)= split(" ", $XML);
984-
985-
$XMLLIBDIR = shift(@libs);
986-
if ($XMLLIBDIR =~ /-L/){
987-
$XMLLIBDIR =~ s/-L//;
988-
$XMLLIBS = join(" ",@libs);
989-
} else {
990-
# no -L, assume all were LIBS
991-
$XMLLIBS = $XMLLIBDIR ." ".join(" ",@libs);
992-
# and fix -L / should work for both 32 and 64
993-
$XMLLIBDIR = "/usr/$LLIB";
994-
}
975+
chomp(my $xml = `which xml2-config`);
995976

977+
if ($?) {
978+
die "No xml2-config found\n";
979+
}
996980

997-
# ($XMLLIBDIR,$XMLLIBS) = split(' ', $XML);
998-
# if ($XMLLIBDIR =~ /-L/){
999-
# $XMLLIBDIR =~ s/-L//;
1000-
# } else {
1001-
# # may not have any -L
1002-
# if ($XMLLIBS
1003-
# }
981+
my ($XMLINCDIR,$XMLLIBDIR,$XMLLIBS) = ("","","");
1004982

1005-
my $XMLVersion = `$xml --version`; # print "XMLVersion = $XMLVersion\n";
1006-
my ($major,$minor) = split '\.', $XMLVersion; # print "major = $major,minor = $minor\n";
1007-
$XMLCPPFlag = "";#-DXmlTreeReader";
1008-
if ($major < 2 or $major == 2 and $minor < 5) {
1009-
$XMLCPPFlag = "-DNoXmlTreeReader";
1010-
}
1011-
if ( ! $param::quiet ){
1012-
if ( $XMLLIBDIR ){
1013-
print "Use xml $xml XMLLIBDIR = $XMLLIBDIR \tXMLINCDIR = $XMLINCDIR \tXMLLIBS = $XMLLIBS XMLCPPFlag =$XMLCPPFlag\n";
1014-
} else {
1015-
print "Use xml -> WARNING ** Could not define XMLLIBDIR, XMLINCDIR, XMLLIBS\n";
1016-
}
1017-
}
983+
$XMLINCDIR = `$xml --cflags`;
984+
chomp($XMLINCDIR);
985+
$XMLINCDIR =~ s/-I//;
986+
my $XML = `$xml --libs`; # die "$XML\n";
987+
my(@libs)= split(" ", $XML);
988+
989+
$XMLLIBDIR = shift(@libs);
990+
if ($XMLLIBDIR =~ /-L/){
991+
$XMLLIBDIR =~ s/-L//;
992+
$XMLLIBS = join(" ",@libs);
1018993
} else {
1019-
print "Could not find xml libs\n" if (! $param::quiet);
994+
# no -L, assume all were LIBS
995+
$XMLLIBS = $XMLLIBDIR ." ".join(" ",@libs);
996+
# and fix -L / should work for both 32 and 64
997+
$XMLLIBDIR = "/usr/$LLIB";
998+
}
999+
1000+
my $XMLVersion = `$xml --version`; # print "XMLVersion = $XMLVersion\n";
1001+
my ($major,$minor) = split '\.', $XMLVersion; # print "major = $major,minor = $minor\n";
1002+
$XMLCPPFlag = "";#-DXmlTreeReader";
1003+
if ($major < 2 or $major == 2 and $minor < 5) {
1004+
$XMLCPPFlag = "-DNoXmlTreeReader";
1005+
}
1006+
if ( ! $param::quiet ){
1007+
if ( $XMLLIBDIR ){
1008+
print "Using $xml\n\tXMLLIBDIR = $XMLLIBDIR\n\tXMLINCDIR = $XMLINCDIR\n\tXMLLIBS = $XMLLIBS\n\tXMLCPPFlag = $XMLCPPFlag\n" if !$param::quiet;
1009+
} else {
1010+
print "Use xml -> WARNING ** Could not define XMLLIBDIR, XMLINCDIR, XMLLIBS\n";
1011+
}
10201012
}
10211013

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

0 commit comments

Comments
 (0)