[klibc] [PATCH] klcc compatibility with gcc
Erik van Konijnenburg
ekonijn at xs4all.nl
Wed Mar 2 07:33:25 PST 2005
Here's a patch to klcc.in from klibc-0.202. The context: I have an
application, managed with GNU automake/autoconf. Packagers should be
able to build the application with klibc if available, with plain gcc
otherwise, as follows:
$ cd ~/klibc-0.202
$ ... make linux symlink
$ make bindir=$HOME/local/bin \
mandir=$HOME/local/man \
INSTALLDIR=$HOME/local \
SHLIBDIR=$HOME/local/shlib \
install
$ cd ~/myapp
$ ./configure --prefix=$HOME/local CC=$HOME/local/bin/klcc
It turns out klcc needs a few tweaks to function as a drop-in gcc
replacement, specifically:
* support -D -U -I options
* fix klcc -c myapp.o myapp.c
* fix klcc -o myapp myapp.o
Regards,
Erik
diff -urN klibc-0.202/klcc.in klibc-0.202-new/klcc.in
--- klibc-0.202/klcc.in 2005-03-02 03:32:17.000000000 +0100
+++ klibc-0.202-new/klcc.in 2005-03-02 16:43:12.000000000 +0100
@@ -20,6 +20,7 @@
my ($file) = @_;
return "c" if ( $file =~ /\.c$/ );
+ return "obj" if ( $file =~ /\.o$/ );
return "c-header" if ( $file =~ /\.h$/ );
return "cpp-output" if ( $file =~ /\.i$/ );
return "c++-cpp-output" if ( $file =~ /\.ii$/ );
@@ -109,7 +110,7 @@
} elsif ( $a =~ /^-Wl,(.*)$/ ) {
# -Wl used to pass options to the linker
push(@ldopt, split(/,/, $1));
- } elsif ( $a =~ /^-([fmwWQdO]|std=|ansi|pedantic)/ ) {
+ } elsif ( $a =~ /^-([fmwWQdODUI]|std=|ansi|pedantic)/ ) {
# Options to gcc
push(@ccopt, $a);
} elsif ( $a =~ /^-[gp]/ ) {
@@ -124,6 +125,7 @@
push(@ccopt, $a);
$save_temps = 1;
} elsif ( $a =~ '^-([cSE])$' ) {
+ push(@ccopt, $a);
$operation = $1;
} elsif ( $a eq '-shared' ) {
$shared = 1;
More information about the klibc
mailing list