[klibc] Don't hardcode paths in klcc

Martin Michlmayr tbm at cyrius.com
Wed Jan 25 13:49:01 PST 2006


Stop makeklcc.pl from hardcoding paths of cc, ld and strip in the klcc
script it generates.  Using hardcoded paths is generally a bad idea.
First, the whole idea of $PATH is that you don't need to hardcode
paths.  Second, klcc is a Perl script but my hardcoding the paths
you make it less portable.

Signed-off-by: Martin Michlmayr <tbm at cyrius.com>


--- klibc-1.1.16/klcc/makeklcc.pl~	2006-01-25 21:30:48.000000000 +0000
+++ klibc-1.1.16/klcc/makeklcc.pl	2006-01-25 21:39:59.000000000 +0000
@@ -9,23 +9,6 @@
 
 ($klccin, $klibcconf, $perlpath) = @ARGV;
 
-sub pathsearch($) {
-    my($file) = @_;
-    my(@path);
-    my($p,$pp);
-
-    if ( $file =~ /\// ) {
-	return File::Spec->rel2abs($file);
-    }
-    
-    foreach $p ( split(/\:/, $ENV{'PATH'}) ) {
-	$pp = File::Spec->rel2abs(File::Spec->catpath(undef, $p, $file));
-	return $pp if ( -x $pp );
-    }
-
-    return undef;
-}
-
 print "#!${perlpath}\n";
 
 open(KLIBCCONF, '<', $klibcconf) or die "$0: cannot open $klibcconf: $!\n";
@@ -34,12 +17,6 @@
     if ( $l =~ /^([^=]+)\=\s*(.*)$/ ) {
 	$n = $1;  $s = $2;
 
-	if ( $n eq 'CC' || $n eq 'LD' || $n eq 'STRIP' ) {
-	    $s1 = pathsearch($s);
-	    die "$0: Cannot find $n: $s\n" unless ( defined($s1) );
-	    $s = $s1;
-	}
-
 	print "\$$n = \"\Q$s\E\";\n";
 	print "\$conf{\'\L$n\E\'} = \\\$$n;\n";
 


-- 
Martin Michlmayr
http://www.cyrius.com/



More information about the klibc mailing list