home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _f09bde7ebddd4610c4cd10668c8b738f < prev    next >
Text File  |  2004-06-01  |  4KB  |  116 lines

  1. # NOTE: Derived from ../LIB\DynaLoader.pm.
  2. # Changes made here will be lost when autosplit is run again.
  3. # See AutoSplit.pm.
  4. package DynaLoader;
  5.  
  6. #line 269 "../LIB\DynaLoader.pm (autosplit into ..\lib\auto\DynaLoader\dl_findfile.al)"
  7. sub dl_findfile {
  8.     # Read ext/DynaLoader/DynaLoader.doc for detailed information.
  9.     # This function does not automatically consider the architecture
  10.     # or the perl library auto directories.
  11.     my (@args) = @_;
  12.     my (@dirs,  $dir);   # which directories to search
  13.     my (@found);         # full paths to real files we have found
  14.     my $dl_ext= 'dll'; # $Config::Config{'dlext'} suffix for perl extensions
  15.     my $dl_so = 'dll'; # $Config::Config{'so'} suffix for shared libraries
  16.  
  17.     print STDERR "dl_findfile(@args)\n" if $dl_debug;
  18.  
  19.     # accumulate directories but process files as they appear
  20.     arg: foreach(@args) {
  21.         #  Special fast case: full filepath requires no search
  22.         if ($Is_VMS && m%[:>/\]]% && -f $_) {
  23.         push(@found,dl_expandspec(VMS::Filespec::vmsify($_)));
  24.         last arg unless wantarray;
  25.         next;
  26.         }
  27.     elsif ($Is_MacOS) {
  28.         if (m/:/ && -f $_) {
  29.             push(@found,$_);
  30.             last arg unless wantarray;
  31.         }
  32.     }
  33.         elsif (m:/: && -f $_ && !$do_expand) {
  34.         push(@found,$_);
  35.         last arg unless wantarray;
  36.         next;
  37.     }
  38.  
  39.         # Deal with directories first:
  40.         #  Using a -L prefix is the preferred option (faster and more robust)
  41.         if (m:^-L:) { s/^-L//; push(@dirs, $_); next; }
  42.  
  43.     if ($Is_MacOS) {
  44.             #  Otherwise we try to try to spot directories by a heuristic
  45.             #  (this is a more complicated issue than it first appears)
  46.         if (m/:/ && -d $_) {   push(@dirs, $_); next; }
  47.             #  Only files should get this far...
  48.             my(@names, $name);    # what filenames to look for
  49.         s/^-l//;
  50.         push(@names, $_);
  51.             foreach $dir (@dirs, @dl_library_path) {
  52.                 next unless -d $dir;
  53.         $dir =~ s/^([^:]+)$/:$1/;
  54.         $dir =~ s/:$//;
  55.                 foreach $name (@names) {
  56.                 my($file) = "$dir:$name";
  57.                     print STDERR " checking in $dir for $name\n" if $dl_debug;
  58.             if (-f $file) {
  59.                         push(@found, $file);
  60.                         next arg; # no need to look any further
  61.                     }
  62.                 }
  63.         }
  64.         next;
  65.     }
  66.     
  67.         #  Otherwise we try to try to spot directories by a heuristic
  68.         #  (this is a more complicated issue than it first appears)
  69.         if (m:/: && -d $_) {   push(@dirs, $_); next; }
  70.  
  71.         # VMS: we may be using native VMS directory syntax instead of
  72.         # Unix emulation, so check this as well
  73.         if ($Is_VMS && /[:>\]]/ && -d $_) {   push(@dirs, $_); next; }
  74.  
  75.         #  Only files should get this far...
  76.         my(@names, $name);    # what filenames to look for
  77.         if (m:-l: ) {          # convert -lname to appropriate library name
  78.             s/-l//;
  79.             push(@names,"lib$_.$dl_so");
  80.             push(@names,"lib$_.a");
  81.         } else {                # Umm, a bare name. Try various alternatives:
  82.             # these should be ordered with the most likely first
  83.             push(@names,"$_.$dl_ext")    unless m/\.$dl_ext$/o;
  84.             push(@names,"$_.$dl_so")     unless m/\.$dl_so$/o;
  85.             push(@names,"lib$_.$dl_so")  unless m:/:;
  86.             push(@names,"$_.a")          if !m/\.a$/ and $dlsrc eq "dl_dld.xs";
  87.             push(@names, $_);
  88.         }
  89.         foreach $dir (@dirs, @dl_library_path) {
  90.             next unless -d $dir;
  91.             chop($dir = VMS::Filespec::unixpath($dir)) if $Is_VMS;
  92.             foreach $name (@names) {
  93.         my($file) = "$dir/$name";
  94.                 print STDERR " checking in $dir for $name\n" if $dl_debug;
  95.         $file = ($do_expand) ? dl_expandspec($file) : (-f $file && $file);
  96.         #$file = _check_file($file);
  97.         if ($file) {
  98.                     push(@found, $file);
  99.                     next arg; # no need to look any further
  100.                 }
  101.             }
  102.         }
  103.     }
  104.     if ($dl_debug) {
  105.         foreach(@dirs) {
  106.             print STDERR " dl_findfile ignored non-existent directory: $_\n" unless -d $_;
  107.         }
  108.         print STDERR "dl_findfile found: @found\n";
  109.     }
  110.     return $found[0] unless wantarray;
  111.     @found;
  112. }
  113.  
  114. # end of DynaLoader::dl_findfile
  115. 1;
  116.