summaryrefslogtreecommitdiff
path: root/make/utilities.pm
diff options
context:
space:
mode:
Diffstat (limited to 'make/utilities.pm')
-rw-r--r--make/utilities.pm41
1 files changed, 38 insertions, 3 deletions
diff --git a/make/utilities.pm b/make/utilities.pm
index a7e0eb794..a227be3a4 100644
--- a/make/utilities.pm
+++ b/make/utilities.pm
@@ -1,6 +1,6 @@
package make::utilities;
use Exporter 'import';
-@EXPORT = qw(make_rpath pkgconfig_get_include_dirs pkgconfig_get_lib_dirs);
+@EXPORT = qw(make_rpath pkgconfig_get_include_dirs pkgconfig_get_lib_dirs translate_functions);
# Parse the output of a *_config program,
# such as pcre_config, take out the -L
@@ -9,10 +9,10 @@ use Exporter 'import';
sub make_rpath($)
{
my ($executable) = @_;
- $data = `$executable`;
+ chomp($data = `$executable`);
$data =~ /-L(\S+)\s/;
$libpath = $1;
- return "-Wl,--rpath -Wl,$libpath";
+ return "-Wl,--rpath -Wl,$libpath -L$libpath";
}
sub extend_pkg_path()
@@ -51,6 +51,7 @@ sub pkgconfig_get_include_dirs($$$)
{
$ret = "$foo " . $defaults;
}
+ chomp($ret);
return $ret;
}
@@ -79,8 +80,42 @@ sub pkgconfig_get_lib_dirs($$$)
{
$ret = "$foo " . $defaults;
}
+ chomp($ret);
return $ret;
}
+# Translate a $CompileFlags etc line and parse out function calls
+# to functions within these modules at configure time.
+sub translate_functions($)
+{
+ my ($line) = @_;
+ while ($line =~ /pkgconflibs\("(.+?)","(.+?)","(.+?)"\)/)
+ {
+ my $replace = pkgconfig_get_lib_dirs($1, $2, $3);
+ $line =~ s/pkgconflibs\("(.+?)","(.+?)","(.+?)"\)/$replace/;
+ }
+ while ($line =~ /pkgconflibs\("(.+?)","(.+?)",""\)/)
+ {
+ my $replace = pkgconfig_get_lib_dirs($1, $2, "");
+ $line =~ s/pkgconflibs\("(.+?)","(.+?)",""\)/$replace/;
+ }
+ while ($line =~ /pkgconfincludes\("(.+?)","(.+?)",""\)/)
+ {
+ my $replace = pkgconfig_get_include_dirs($1, $2, "");
+ $line =~ s/pkgconfincludes\("(.+?)","(.+?)",""\)/$replace/;
+ }
+ while ($line =~ /pkgconfincludes\("(.+?)","(.+?)","(.+?)"\)/)
+ {
+ my $replace = pkgconfig_get_include_dirs($1, $2, $3);
+ $line =~ s/pkgconfincludes\("(.+?)","(.+?)","(.+?)"\)/$replace/;
+ }
+ while ($line =~ /rpath\("(.+?)"\)/)
+ {
+ my $replace = make_rpath($1);
+ $line =~ s/rpath\("(.+?)"\)/$replace/;
+ }
+ return $line;
+}
+
1;