3 # Combine klibc.config, klcc.in to produce a klcc script
5 # Usage: makeklcc klcc.in klibc.config perlpath
10 ($klccin, $klibcconf, $perlpath) = @ARGV;
17 if ( $file =~ /\// ) {
18 return File::Spec->rel2abs($file);
21 foreach $p ( split(/\:/, $ENV{'PATH'}) ) {
22 $pp = File::Spec->rel2abs(File::Spec->catpath(undef, $p, $file));
23 return $pp if ( -x $pp );
29 print "#!${perlpath}\n";
31 open(KLIBCCONF, '<', $klibcconf) or die "$0: cannot open $klibcconf: $!\n";
32 while ( defined($l = <KLIBCCONF>) ) {
34 if ( $l =~ /^([^=]+)\=(.*)$/ ) {
37 if ( $n eq 'CC' || $n eq 'LD' || $n eq 'STRIP' ) {
39 die "$0: Cannot find $n: $s\n" unless ( defined($s1) );
43 print "\$$n = \"\Q$s\E\";\n";
44 print "\@$n = qw($s);\n";
45 print "\$conf{\'\L$n\E\'} = \\\$$n;\n";
50 open(KLCCIN, '<', $klccin) or die "$0: cannot open $klccin: $!\n";
51 while ( defined($l = <KLCCIN>) ) {