diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2004-11-12 01:40:02 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:44 -0500 |
commit | ab440ac6f75c12989d5dc15cc75a99e62f35612f (patch) | |
tree | 15375ecfbeee53132b2298aa697e9eead69ed3a4 /source4/build/smb_build/input.pm | |
parent | 79c5d73a71c35f5b16232072a7b52033cb9364cb (diff) | |
download | samba-ab440ac6f75c12989d5dc15cc75a99e62f35612f.tar.gz samba-ab440ac6f75c12989d5dc15cc75a99e62f35612f.tar.bz2 samba-ab440ac6f75c12989d5dc15cc75a99e62f35612f.zip |
r3690: Use perl's 'use' statement to include the build system parts
rather then using "cat"
(This used to be commit 4d018b2b701faa56d7e3bb7634729296b53e0acb)
Diffstat (limited to 'source4/build/smb_build/input.pm')
-rw-r--r-- | source4/build/smb_build/input.pm | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm new file mode 100644 index 0000000000..d3737ea7d1 --- /dev/null +++ b/source4/build/smb_build/input.pm @@ -0,0 +1,140 @@ +########################################################### +### SMB Build System ### +### - the input checking functions ### +### ### +### Copyright (C) Stefan (metze) Metzmacher 2004 ### +### Released under the GNU GPL ### +########################################################### + +sub strtrim($) +{ + my $str = shift; + my @ar = (); + + $str =~ s/^[\t\n ]*//g; + + $str =~ s/[\t\n ]*$//g; + + return $str; +} + +sub str2array($) +{ + my $str = shift; + my @ar = (); + + $str =~ s/^[\t\n ]*//g; + + $str =~ s/[\t\n ]*$//g; + + $str =~ s/([\t\n ]+)/ /g; + + if (length($str)==0) { + return (); + } + + @ar = split(/[ \t\n]/,$str); + + return @ar; +} + +sub _check_subsystems($) +{ + my $CTX = shift; + + foreach my $subsys (sort keys %{$CTX->{INPUT}{SUBSYSTEMS}}) { + if ($CTX->{INPUT}{SUBSYSTEMS}{$subsys}{ENABLE} ne "YES") { + printf("Subsystem: %s disabled!\n",$CTX->{INPUT}{SUBSYSTEMS}{$subsys}{NAME}); + next; + } + } + + return; +} + +sub _check_modules($) +{ + my $CTX = shift; + + foreach my $mod (sort keys %{$CTX->{INPUT}{MODULES}}) { + my $subsys = $CTX->{INPUT}{MODULES}{$mod}{SUBSYSTEM}; + my $default_build = $CTX->{INPUT}{MODULES}{$mod}{DEFAULT_BUILD}; + my $build = $CTX->{INPUT}{MODULES}{$mod}{CHOSEN_BUILD}; + my $use_default = 0; + + if (!(defined($CTX->{INPUT}{SUBSYSTEMS}{$subsys}))) { + $CTX->{INPUT}{MODULES}{$mod}{BUILD} = "NOT"; + printf("Module: %s...PARENT SUBSYSTEM DISABLED\n",$mod); + next; + } + + if ($build eq "DEFAULT") { + $build = $default_build; + $use_default = 1; + } + + if ($build eq "SHARED") { + $CTX->{INPUT}{MODULES}{$mod}{BUILD} = "SHARED"; + printf("Module: %s...shared\n",$mod); + } elsif ($build eq "STATIC") { + $CTX->{INPUT}{MODULES}{$mod}{BUILD} = "STATIC"; + printf("Module: %s...static\n",$mod); + } else { + $CTX->{INPUT}{MODULES}{$mod}{BUILD} = "NOT"; + printf("Module: %s...not\n",$mod); + next; + } + } + + return; +} + +sub _check_libraries($) +{ + my $CTX = shift; + + foreach my $lib (sort keys %{$CTX->{INPUT}{LIBRARIES}}) { + if ($CTX->{INPUT}{LIBRARIES}{$lib}{ENABLE} ne "YES") { + printf("Library: %s...disabled\n",$CTX->{INPUT}{LIBRARIES}{$lib}{NAME}); + next; + } + } + + return; +} + +sub _check_binaries($) +{ + my $CTX = shift; + + foreach my $bin (sort keys %{$CTX->{INPUT}{BINARIES}}) { + if ($CTX->{INPUT}{BINARIES}{$bin}{ENABLE} ne "YES") { + printf("Binary: %s...disabled\n",$CTX->{INPUT}{BINARIES}{$bin}{NAME}); + next; + } + } + + return; +} + +########################################################### +# This function checks the input from the configure script +# +# check_input($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +sub check_input($) +{ + my $CTX = shift; + + _check_subsystems($CTX); + + _check_modules($CTX); + + _check_libraries($CTX); + + _check_binaries($CTX); + + return; +} +1; |