Index: tools/llvm-config/llvm-config.in.in
===================================================================
--- tools/llvm-config/llvm-config.in.in	(revision 51771)
+++ tools/llvm-config/llvm-config.in.in	(working copy)
@@ -19,6 +19,8 @@
 use strict;
 use warnings;
 
+use Cwd 'abs_path';
+
 #---- begin autoconf values ----
 my $PACKAGE_NAME        = q{@PACKAGE_NAME@};
 my $VERSION             = q{@PACKAGE_VERSION@};
@@ -62,23 +64,28 @@
 # locations of some files.
 
 # Convert the current executable name into its directory (e.g. ".").
-my ($RUN_DIR) = ($0 =~ /^(.*)\/.*$/);
+# my ($RUN_DIR) = ($0 =~ /^(.*)\/.*$/);
+my $RUN_DIR = substr($0,0,rindex($0,'/'));
 
 # Find the unix pwd program: we don't want to use the bash builtin, as it does
 # not look through symlinks etc.
-my $PWD = `which pwd`;
-chomp($PWD);
-$PWD = "pwd" if (!-e $PWD);
+# my $PWD = `which pwd`;
+# chomp($PWD);
+# $PWD = "pwd" if (!-e $PWD);
+my $PWD = 'pwd -L';
 
 # Turn the directory into an absolute directory on the file system, also pop up
 # from "bin" into the build or prefix dir.
-my $ABS_RUN_DIR = `cd $RUN_DIR/..; $PWD`;
-chomp($ABS_RUN_DIR);
+# my $ABS_RUN_DIR = `cd $RUN_DIR/..; $PWD`;
+# chomp($ABS_RUN_DIR);
+my $ABS_RUN_DIR = abs_path($RUN_DIR.'/..');
+$ABS_RUN_DIR = abs_path($ABS_RUN_DIR.'/..') if '/bin' eq substr($ABS_RUN_DIR,-4);
 
 # Compute the absolute object directory build, e.g. "foo/llvm/Debug".
 my $ABS_OBJ_ROOT = "$LLVM_OBJ_ROOT/$LLVM_BUILDMODE";
-$ABS_OBJ_ROOT = `cd $ABS_OBJ_ROOT; $PWD` if (-d $ABS_OBJ_ROOT);
-chomp($ABS_OBJ_ROOT);
+#$ABS_OBJ_ROOT = `cd $ABS_OBJ_ROOT; $PWD` if (-d $ABS_OBJ_ROOT);
+#chomp($ABS_OBJ_ROOT);
+$ABS_OBJ_ROOT = abs_path($ABS_OBJ_ROOT) if (-d $ABS_OBJ_ROOT);
 
 my $INCLUDEDIR = "$ABS_RUN_DIR/include";
 my $LIBDIR     = "$ABS_RUN_DIR/lib";
@@ -142,9 +149,11 @@
         } elsif ($arg eq "--build-mode") {
             $has_opt = 1; print "$LLVM_BUILDMODE\n";
         } elsif ($arg eq "--obj-root") {
-            $has_opt = 1; print `cd $LLVM_OBJ_ROOT/; $PWD`;
+#           $has_opt = 1; print `cd $LLVM_OBJ_ROOT/; $PWD`;
+            $has_opt = 1; print abs_path($LLVM_OBJ_ROOT.'/');
         } elsif ($arg eq "--src-root") {
-            $has_opt = 1; print `cd $LLVM_SRC_ROOT/; $PWD`;
+#           $has_opt = 1; print `cd $LLVM_SRC_ROOT/; $PWD`;
+            $has_opt = 1; print abs_path($LLVM_SRC_ROOT.'/');
         } else {
             usage();
         }
Index: utils/GenLibDeps.pl
===================================================================
--- utils/GenLibDeps.pl	(revision 51771)
+++ utils/GenLibDeps.pl	(working copy)
@@ -96,9 +96,17 @@
     print "  <dt><b>$lib</b</dt><dd><ul>\n";
   }
   open UNDEFS, 
-    "$nmPath -g -u $Directory/$lib | sed -e 's/^  *U //' | sort | uniq |";
+# this fails on ActivePerl
+#   "$nmPath -g -u $Directory/$lib | sed -e 's/^  *U //' | sort | uniq |";
+    "$nmPath -g -u $Directory/$lib |";
   my %DepLibs;
   while (<UNDEFS>) {
+	# to bypass missing sed
+    if ('  ' eq substr($_,0,2) and index($_,'U '))
+	{
+		$_ = substr($_,index($_,'U ')+2)
+	};
+	$_ = substr($_,index($_,'  *U ')+5) if -1!=index($_,'  *U ');
     chomp;
     my $lib_printed = 0;
     if (defined($libdefs{$_}) && $libdefs{$_} ne $lib) {
