Merge branch 'v4-0-test' of git://git.samba.org/samba into 4-0-local
[samba.git] / source4 / 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 1;