Mercurial > hg > CbC > old > device
diff tools/find-gcc-include-path @ 861:c005a392e27e
fix for Marvaricks
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 31 Mar 2014 18:33:20 +0900 |
parents | c14a1426cfed |
children |
line wrap: on
line diff
--- a/tools/find-gcc-include-path Mon Sep 16 18:02:58 2013 +0900 +++ b/tools/find-gcc-include-path Mon Mar 31 18:33:20 2014 +0900 @@ -1,19 +1,45 @@ #!/usr/bin/perl my $CC = $ARGV[1]; -my $gcc = `echo '#include <stddef.h>' | $CC -E - `; +my $gcc = `echo '#include <stdio.h>' | $CC -E - `; + +$gcc =~ m=\"(/[^"]+/)stdio\.h"=; +my $gcc_path = $1; + +my $gcc1 = `echo '#include <stddef.h>' | $CC -E - `; + +$gcc1 =~ m=\"(/[^"]+/)stddef\.h"=; +my $gcc_path1 = $1; -$gcc =~ m=\"(/[^"]+/)stddef\.h"=; -my $gcc_path = $1; +my $path = <<EOF; + "$gcc_path", +EOF +if ($gcc_path1 ne $gcc_path) { + $path = <<EOF; + "$gcc_path", + "$gcc_path1", +EOF +} if ($ARGV[0]=~/-l/) { print <<EOF char *l_include_path[] = { - "$gcc_path", +$path "/usr/include/", 0 }; EOF +} elsif ($ARGV[0]=~/-s/) { + open my $fd, "<", "stdio.template" or die("can't open stdio.template"); + my $repl = 1; + while(<$fd>) { + if ($repl && /\#include \"\/usr\/include\/stdio.h\"/) { + print "#include \"${gcc_path}stdio.h\"\n"; + $repl = 0; + next; + } + print; + } } else { print "$gcc_path\n"; }