view tools/find-gcc-include-path @ 771:5e07b9804aea

dpreinc, dpostinc
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 18 Nov 2010 12:08:55 +0900
parents c14a1426cfed
children c005a392e27e
line wrap: on
line source

#!/usr/bin/perl

my $CC = $ARGV[1];
my $gcc = `echo '#include <stddef.h>' | $CC -E - `;

$gcc =~ m=\"(/[^"]+/)stddef\.h"=;
my $gcc_path = $1;

if ($ARGV[0]=~/-l/) {
print <<EOF
char *l_include_path[] = {
    "$gcc_path",
    "/usr/include/",
    0
};
EOF
} else {
	print "$gcc_path\n";
}