8 my $no = join('|',qw(GDBM_File ODBM_File NDBM_File DB_File
9 VMS.* Sys-Syslog IPC-SysV I18N-Langinfo));
16 push @no, 'Sys-Syslog' if $^O eq 'MSWin32';
18 # duplicates logic from Configure (mostly)
19 push @no, "DB_File" unless $config->{i_db};
20 push @no, "GDBM_File" unless $config->{i_gdbm};
21 push @no, "I18N-Langinfo" unless $config->{i_langinfo} && $config->{d_nl_langinfo};
22 push @no, "IPC-SysV" unless $config->{d_msg} || $config->{d_sem} || $config->{d_shm};
23 push @no, "NDBM_File" unless $config->{d_ndbm};
25 unless ($config->{i_dbm} || $config->{i_rpcsvcdbm}) && !$config->{d_cplusplus};
26 push @no, "VMS.*" unless $^O eq "VMS";
27 push @no, "Win32.*" unless $^O eq "MSWin32" || $^O eq "cygwin";
36 sub set_static_extensions {
37 # adjust results of scan_ext, and also save
38 # statics in case scan_ext hasn't been called yet.
39 # if '*' is passed then all XS extensions are static
40 # (with possible exclusions)
43 if (@_ and $_[0] eq '*') {
44 my %excl = map {$_=>1} map {m/^!(.*)$/} @_[1 .. $#_];
45 @list = grep {!exists $excl{$_}} keys %ext;
49 $ext{$_} = 'static' if $ext{$_} && $ext{$_} eq 'dynamic';
52 # Encode is a special case. If we are building Encode as a static
53 # extension, we need to explicitly list its subextensions as well.
54 # For other nested extensions, this is handled automatically by
55 # the appropriate Makefile.PL.
56 if ($ext{Encode} && $ext{Encode} eq 'static') {
61 return unless m!\b(Encode/.+)/Makefile\.PL!;
72 sort grep $ext{$_} eq $key, keys %ext;
76 *dynamic_ext = _ext_eq('dynamic');
77 *static_ext = _ext_eq('static');
78 *nonxs_ext = _ext_eq('nonxs');
81 sort grep $ext{$_} ne 'known', keys %ext;
84 sub known_extensions {
90 return $ext{$_[0]} eq 'static'
95 opendir my $dh, $dir or die "opendir $dir: $!";
96 while (defined (my $item = readdir $dh)) {
97 return 1 if $item =~ /\.xs$/;
98 return 1 if $item =~ /\.c$/;
103 # Function to find available extensions, ignoring DynaLoader
107 opendir my $dh, "$ext_dir";
108 while (defined (my $item = readdir $dh)) {
109 next if $item =~ /^\.\.?$/;
110 next if $item eq "DynaLoader";
111 next unless -d "$ext_dir/$item";
112 my $this_ext = $item;
115 $this_ext =~ s!-!/!g;
118 # List/Util.xs lives in Scalar-List-Utils, Cwd.xs lives in PathTools
119 $this_ext = 'List/Util' if $this_ext eq 'Scalar/List/Utils';
120 $this_ext = 'Cwd' if $this_ext eq 'PathTools';
122 # Temporary hack to cope with smokers that are not clearing directories:
123 next if $ext{$this_ext};
125 if (has_xs_or_c("$ext_dir/$item")) {
126 $ext{$this_ext} = $static{$this_ext} ? 'static' : 'dynamic';
128 $ext{$this_ext} = 'nonxs';
130 $ext{$this_ext} = 'known' if $item =~ $no;
135 # ex: set ts=8 sts=4 sw=4 et: