summaryrefslogtreecommitdiff
path: root/make
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-01-14 00:39:29 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-01-14 00:39:29 +0000
commitf9d43fcd9f82d2316f91548acd99c794f7de4071 (patch)
tree91d4ead2dce731bcdcdd7d6c0817ac31c787d38b /make
parentfdabab1b825c2625a9165fca7ff8366ad00b127a (diff)
Add eval() and exec() macros, that evaluate perl and execute commands at configure time, rather than delaying them with backticks till compile time. This picks up any errors sooner.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6311 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'make')
-rw-r--r--make/utilities.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/make/utilities.pm b/make/utilities.pm
index fa7375da5..0109bf929 100644
--- a/make/utilities.pm
+++ b/make/utilities.pm
@@ -1,5 +1,6 @@
package make::utilities;
use Exporter 'import';
+use POSIX;
@EXPORT = qw(make_rpath pkgconfig_get_include_dirs pkgconfig_get_lib_dirs translate_functions);
# Parse the output of a *_config program,
@@ -123,6 +124,25 @@ sub pkgconfig_get_lib_dirs($$$)
sub translate_functions($)
{
my ($line) = @_;
+ while ($line =~ /exec\("(.+?)"\)/)
+ {
+ my $replace = `$1`;
+ chomp($replace);
+ $line =~ s/exec\("(.+?)"\)/$replace/;
+ }
+ while ($line =~ /eval\("(.+?)"\)/)
+ {
+ my $tmpfile;
+ do
+ {
+ $tmpfile = tmpnam();
+ } until sysopen(TF, $tmpfile, O_RDWR|O_CREAT|O_EXCL, 0700);
+ print TF $1;
+ close TF;
+ my $replace = `perl $tmpfile`;
+ chomp($replace);
+ $line =~ s/eval\("(.+?)"\)/$replace/;
+ }
while ($line =~ /pkgconflibs\("(.+?)","(.+?)","(.+?)"\)/)
{
my $replace = pkgconfig_get_lib_dirs($1, $2, $3);