s4 config-summary: Fix printing of which libraries are external and
[jra/samba/.git] / source4 / build / smb_build / summary.pm
1 # Samba Build System
2 # - write out summary
3 #
4 #  Copyright (C) Jelmer Vernooij 2006
5 #  Released under the GNU GPL
6
7 package summary;
8 use smb_build::config;
9 use strict;
10
11 sub enabled($)
12 {
13     my ($val) = @_;
14
15     return (defined($val) && $val =~ m/yes|true/i);
16 }
17
18 sub showitem($$$)
19 {
20         my ($output,$desc,$items) = @_;
21
22         my @need = ();
23
24         foreach (@$items) {
25                 push (@need, $_) if (enabled($config::enable{$_}));
26         }
27
28         print "Support for $desc: ";
29         if ($#need >= 0) {
30                 print "no (install " . join(',',@need) . ")\n";
31         } else {
32                 print "yes\n";
33         }
34 }
35
36 sub showisexternal($$$)
37 {
38         my ($output, $desc, $name) = @_;
39         print "Using external $desc: ";
40         if ($output->{$name}->{TYPE} eq "SUBSYSTEM" or
41             $output->{$name}->{TYPE} eq "LIBRARY") {
42                 print "no"; 
43         } else {
44                 print "yes";
45         }
46         print "\n";
47 }
48
49 sub show($$)
50 {
51         my ($output,$config) = @_;
52
53         print "Summary:\n\n";
54         showitem($output, "SSL in SWAT and LDAP", ["GNUTLS"]);
55         showitem($output, "threads in server (see --with-pthread)", ["PTHREAD"]);
56         showitem($output, "intelligent command line editing", ["READLINE"]);
57         showitem($output, "changing process titles (see --with-setproctitle)", ["SETPROCTITLE"]);
58         showitem($output, "using extended attributes", ["XATTR"]);
59         showitem($output, "using libblkid", ["BLKID"]);
60         showitem($output, "using iconv", ["ICONV"]);
61         showitem($output, "using pam", ["PAM"]);
62         showitem($output, "python bindings", ["LIBPYTHON"]);
63         showisexternal($output, "popt", "LIBPOPT");
64         showisexternal($output, "talloc", "LIBTALLOC");
65         showisexternal($output, "tdb", "LIBTDB");
66         showisexternal($output, "tevent", "LIBTEVENT");
67         showisexternal($output, "ldb", "LIBLDB");
68         print "Developer mode: ".(enabled($config->{developer})?"yes":"no")."\n";
69         print "Automatic dependencies: ".
70             (enabled($config->{automatic_dependencies})
71                     ? "yes" : "no (install GNU make >= 3.81 and see --enable-automatic-dependencies)") .
72              "\n";
73         
74         print "Building shared libraries: " .
75             (enabled($config->{BLDSHARED})
76                     ? "yes" : "no (not supported on this system)") .
77             "\n";
78         print "Using shared libraries internally: " .
79             (enabled($config->{USESHARED})
80                     ? "yes" : "no (specify --enable-dso)") .
81             "\n";
82
83         print "\n";
84 }
85
86 1;