summaryrefslogtreecommitdiff
path: root/klibc/makeklcc.pl
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2005-04-11 04:51:03 +0200
committerGreg KH <gregkh@suse.de>2005-04-26 23:55:01 -0700
commitd3743cfb3bd605a8ccb52d30eeaad6a00e6d2123 (patch)
tree0706d95880acedc896dd487c22baa0dcc0ab9488 /klibc/makeklcc.pl
parent7ab16233831bb90b2ee14e7ee98c3dde77276a9e (diff)
[PATCH] klibc: version 1.0.6
Diffstat (limited to 'klibc/makeklcc.pl')
-rw-r--r--klibc/makeklcc.pl26
1 files changed, 26 insertions, 0 deletions
diff --git a/klibc/makeklcc.pl b/klibc/makeklcc.pl
index f8a6294db3..74045955fd 100644
--- a/klibc/makeklcc.pl
+++ b/klibc/makeklcc.pl
@@ -5,8 +5,27 @@
# Usage: makeklcc klcc.in klibc.config perlpath
#
+use File::Spec;
+
($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";
@@ -14,6 +33,13 @@ while ( defined($l = <KLIBCCONF>) ) {
chomp $l;
if ( $l =~ /^([^=]+)\=(.*)$/ ) {
$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 "\@$n = qw($s);\n";
print "\$conf{\'\L$n\E\'} = \\\$$n;\n";