build: remove support for automatically building .pc files.
[ira/wip.git] / source / build / smb_build / env.pm
1 # Environment class
2 #
3 # Samba Build Environment
4 #
5 # (C) 2005 Jelmer Vernooij <jelmer@samba.org>
6 #
7 # Published under the GNU GPL
8
9 package smb_build::env;
10 use smb_build::input;
11 use File::Path;
12 use File::Basename;
13
14 use strict;
15
16 sub new($$)
17
18         my ($name, $config) = @_;
19         my $self = { };
20         bless $self, $name;
21
22         $self->{items} = {};
23         $self->{info} = {};
24         
25         $self->_set_config($config);
26
27         return $self;
28 }
29
30 sub _set_config($$)
31 {
32         my ($self, $config) = @_;
33
34         $self->{config} = $config;
35
36         if (not defined($self->{config}->{srcdir})) {
37                 $self->{config}->{srcdir} = '.';
38         }
39
40         if (not defined($self->{config}->{builddir})) {
41                 $self->{config}->{builddir}  = '.';
42         }
43
44         if ($self->{config}->{prefix} eq "NONE") {
45                 $self->{config}->{prefix} = $self->{config}->{ac_default_prefix};
46         }
47
48         if ($self->{config}->{exec_prefix} eq "NONE") {
49                 $self->{config}->{exec_prefix} = $self->{config}->{prefix};
50         }
51         
52         $self->{developer} = ($self->{config}->{developer} eq "yes");
53         $self->{gnu_make} = ($self->{config}->{GNU_MAKE} eq "yes");
54         $self->{automatic_deps} = ($self->{config}->{automatic_dependencies} eq "yes");
55 }
56
57 sub Import($$)
58 {
59         my ($self,$items) = @_;
60
61         foreach (keys %$items) {
62                 if (defined($self->{items})) {
63                         print "Warning: Importing $_ twice!\n";
64                 }
65                 $self->{items}->{$_} = $items->{$_};
66         }
67 }
68
69 sub GetInfo($$)
70 {
71         my ($self,$name) = @_;
72
73         unless (defined($self->{info}->{$name})) 
74         {
75                 $self->{info}->{$name} = $self->{items}->Build($self);
76         }
77
78         return $self->{info}->{$name};
79 }
80
81 1;