Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | # NOTE: Derived from blib/lib/Inline.pm. |
2 | # Changes made here will be lost when autosplit is run again. | |
3 | # See AutoSplit.pm. | |
4 | package Inline; | |
5 | ||
6 | #line 800 "blib/lib/Inline.pm (autosplit into blib/lib/auto/Inline/check_module.al)" | |
7 | #============================================================================== | |
8 | # Check to see if code has already been compiled | |
9 | #============================================================================== | |
10 | sub check_module { | |
11 | my ($module, $module2); | |
12 | my $o = shift; | |
13 | return $o->install if $o->{CONFIG}{_INSTALL_}; | |
14 | ||
15 | if ($o->{CONFIG}{NAME}) { | |
16 | $module = $o->{CONFIG}{NAME}; | |
17 | } | |
18 | elsif ($o->{API}{pkg} eq 'main') { | |
19 | $module = $o->{API}{script}; | |
20 | my($v,$d,$file) = File::Spec->splitpath($module); | |
21 | $module = $file; | |
22 | $module =~ s|\W|_|g; | |
23 | $module =~ s|^_+||; | |
24 | $module =~ s|_+$||; | |
25 | $module = 'FOO' if $module =~ /^_*$/; | |
26 | $module = "_$module" if $module =~ /^\d/; | |
27 | } | |
28 | else { | |
29 | $module = $o->{API}{pkg}; | |
30 | } | |
31 | ||
32 | $o->{API}{suffix} = $o->{INLINE}{ILSM_suffix}; | |
33 | $o->{API}{directory} = $o->{INLINE}{DIRECTORY}; | |
34 | ||
35 | my $auto_level = 2; | |
36 | while ($auto_level <= 5) { | |
37 | if ($o->{CONFIG}{AUTONAME}) { | |
38 | $module2 = | |
39 | $module . '_' . substr($o->{INLINE}{md5}, 0, 2**$auto_level); | |
40 | $auto_level++; | |
41 | } else { | |
42 | $module2 = $module; | |
43 | $auto_level = 6; # Don't loop on non-autoname objects | |
44 | } | |
45 | $o->{API}{module} = $module2; | |
46 | my @modparts = split /::/, $module2; | |
47 | $o->{API}{modfname} = $modparts[-1]; | |
48 | $o->{API}{modpname} = File::Spec->catdir(@modparts); | |
49 | $o->{API}{build_dir} = | |
50 | File::Spec->catdir($o->{INLINE}{DIRECTORY}, | |
51 | 'build',$o->{API}{modpname}); | |
52 | $o->{API}{install_lib} = | |
53 | File::Spec->catdir($o->{INLINE}{DIRECTORY}, 'lib'); | |
54 | ||
55 | my $inl = File::Spec->catfile($o->{API}{install_lib},"auto", | |
56 | $o->{API}{modpname},"$o->{API}{modfname}.inl"); | |
57 | $o->{API}{location} = | |
58 | File::Spec->catfile($o->{API}{install_lib},"auto",$o->{API}{modpname}, | |
59 | "$o->{API}{modfname}.$o->{INLINE}{ILSM_suffix}"); | |
60 | last unless -f $inl; | |
61 | my %inl; | |
62 | { local ($/, *INL); | |
63 | open INL, $inl or croak M31_inline_open_failed($inl); | |
64 | %inl = Inline::denter->new()->undent(<INL>); | |
65 | } | |
66 | next unless ($o->{INLINE}{md5} eq $inl{md5}); | |
67 | next unless ($inl{inline_version} ge '0.40'); | |
68 | unless (-f $o->{API}{location}) { | |
69 | warn <<END if $^W; | |
70 | Missing object file: $o->{API}{location} | |
71 | For Inline file: $inl | |
72 | END | |
73 | next; | |
74 | } | |
75 | $o->{INLINE}{object_ready} = 1 unless $o->{CONFIG}{FORCE_BUILD}; | |
76 | last; | |
77 | } | |
78 | unshift @::INC, $o->{API}{install_lib}; | |
79 | } | |
80 | ||
81 | # end of Inline::check_module | |
82 | 1; |