#!/usr/bin/perl my $CC = $ARGV[1]; my $gcc = `echo '#include ' | $CC -E - `; $gcc =~ m=\"(/[^"]+/)stdio\.h"=; my $gcc_path = $1; my $gcc1 = `echo '#include ' | $CC -E - `; $gcc1 =~ m=\"(/[^"]+/)stddef\.h"=; my $gcc_path1 = $1; my $path = <) { if ($repl && /\#include \"\/usr\/include\/stdio.h\"/) { print "#include \"${gcc_path}stdio.h\"\n"; $repl = 0; next; } print; } } else { print "$gcc_path\n"; }