Cons_gcc.pm (858B)
1 # 2 # Some utilities to handle gcc compiler setup 3 # 4 5 package Cons_gcc; 6 7 # pass the compiler name 8 # returns an array, first element is 2 for 2.x 3 for 3.x, then full version, then machine info 9 sub get_gcc_version 10 { 11 my @ret; 12 my ($CC) = @_; 13 my $version=`$CC --version | head -1`; 14 chop($version); 15 my $machine=`$CC -dumpmachine`; 16 chop($machine); 17 if($version =~ '2\.[0-9]*\.[0-9]*') 18 { 19 push @ret, '2'; 20 } else { 21 push @ret, '3'; 22 } 23 push @ret, $version; 24 push @ret, $machine; 25 return @ret; 26 } 27 28 # http://ccache.samba.org/ 29 # check ccache existence and path 30 # returns an array, first element 0 / 1, then path 31 sub get_ccache 32 { 33 my @ret; 34 $ccache_path=`which ccache`; 35 chop($ccache_path); 36 if(-x $ccache_path) 37 { 38 push @ret, '1'; 39 push @ret, $ccache_path; 40 return @ret; 41 } 42 push @ret, '0'; 43 return @ret; 44 } 45 46 # close package 47 1;