PATCH $Config::Config{ldlibpthname} in ext/DynaLoader/DynaLoader_pm.PL
Nicholas Clark [Sat, 21 Oct 2000 22:23:19 +0000 (23:23 +0100)]
Message-ID: <20001021222319.B45586@plum.flirble.org>

p4raw-id: //depot/perl@7399

ext/DynaLoader/DynaLoader_pm.PL

index b7b45d8..0d4e8cd 100644 (file)
@@ -100,17 +100,35 @@ if ($Is_MacOS) {
     push(@dl_library_path, split(/,/, $ENV{LD_LIBRARY_PATH}))
        if exists $ENV{LD_LIBRARY_PATH};
 } else {
-    push(@dl_library_path, split(/:/, $ENV{$Config::Config{ldlibpthname}}))
-       if exists      $Config::Config{ldlibpthname}        &&
-                       $Config::Config{ldlibpthname}  ne '' &&
-                exists $ENV{$Config::Config{ldlibpthname}}       ;;
-    push(@dl_library_path, split(/:/, $ENV{$Config::Config{ldlibpthname}}))
-       if exists      $Config::Config{ldlibpthname}        &&
-                       $Config::Config{ldlibpthname}  ne '' &&
-                exists $ENV{$Config::Config{ldlibpthname}}       ;;
+#     push(@dl_library_path, split(/:/, $ENV{$Config::Config{ldlibpthname}}))
+#      if exists      $Config::Config{ldlibpthname}        &&
+#                        $Config::Config{ldlibpthname}  ne '' &&
+#                 exists $ENV{$Config::Config{ldlibpthname}}       ;;
+#     push(@dl_library_path, split(/:/, $ENV{$Config::Config{ldlibpthname}}))
+#      if exists      $Config::Config{ldlibpthname}        &&
+#                        $Config::Config{ldlibpthname}  ne '' &&
+#                 exists $ENV{$Config::Config{ldlibpthname}}       ;;
 # E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
-push(@dl_library_path, split(/:/, $ENV{LD_LIBRARY_PATH}))
-    if exists $ENV{LD_LIBRARY_PATH};
+# push(@dl_library_path, split(/:/, $ENV{LD_LIBRARY_PATH}))
+#     if exists $ENV{LD_LIBRARY_PATH};
+EOT
+
+# Make a list of paths to print.
+# HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH,
+# but for other OSes no point pushing 'LD_LIBRARY_PATH' twice.
+my @ldlibpthname = 'LD_LIBRARY_PATH';
+if (exists $Config::Config{ldlibpthname}
+    and length $Config::Config{ldlibpthname}
+    and $Config::Config{ldlibpthname} ne 'LD_LIBRARY_PATH') {
+    unshift @ldlibpthname, $Config::Config{ldlibpthname};
+}
+
+foreach (@ldlibpthname) {
+    print OUT "    push(\@dl_library_path, split(/:/, \$ENV{", to_string($_),
+                 "}))\n\tif exists \$ENV{", to_string($_), "};\n";
+}
+
+print OUT <<'EOT';
 }
 
 # No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.