diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-13 23:53:08 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-13 23:53:08 +0000 |
commit | 4f0e6377e80d61ba633588568640881f6ddca9ec (patch) | |
tree | 8e7e214a27cd4de83f0b292d3442db7e96745406 /make | |
parent | ad4d207905fa3ae5cec09163d7ac462e3120ad4b (diff) |
Extra stuff to improve buildsystem, calculate lib and include dirs at configure time rather than at build time. This means that we can also throw errors at configure time if we cant find the libraries,
rather than erroring at buildtime like we used to.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6306 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'make')
-rw-r--r-- | make/utilities.pm | 41 |
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; |