From dca75a1ceae6debd3c8384f3eed11485381089af Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Torgeir=20Lerker=C3=B8d?= Date: Tue, 20 Oct 2009 18:22:38 +0200 Subject: [PATCH] S4: Build of idl files by a non gcc compiler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit The command used to compile files generated from idl uses gcc spesific flags. This patch user perl's built in grep facility to check for gcc or things like ccache gcc. If found compiles with gcc flags else without. Signed-off-by: Torgeir Lerkerød --- pidl/idl.yp | 10 +++++++++- pidl/lib/Parse/Pidl/IDL.pm | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pidl/idl.yp b/pidl/idl.yp index dc8e293..a60f101 100644 --- a/pidl/idl.yp +++ b/pidl/idl.yp @@ -655,8 +655,16 @@ sub parse_file($$) if (! defined $cpp) { $cpp = "cpp"; } + #Check if the compiler string contains gcc + my $cptype = grep("gcc", $cpp); my $includes = join('',map { " -I$_" } @$incdirs); - my $data = `$cpp -D__PIDL__$includes -xc $filename`; + my $data = ''; + #if we found gcc in the compilerstring use gcc spesific flags + if($cptype eq "gcc") { + $data = `$cpp -D__PIDL__$includes -xc $filename`; + } else { + $data = `$cpp -D__PIDL__$includes $filename`; + } $/ = $saved_delim; return parse_string($data, $filename); diff --git a/pidl/lib/Parse/Pidl/IDL.pm b/pidl/lib/Parse/Pidl/IDL.pm index 1a3c59d..e196545 100644 --- a/pidl/lib/Parse/Pidl/IDL.pm +++ b/pidl/lib/Parse/Pidl/IDL.pm @@ -2615,8 +2615,16 @@ sub parse_file($$) if (! defined $cpp) { $cpp = "cpp"; } + #Check if the compiler string contains gcc + my $cptype = grep("gcc", $cpp); my $includes = join('',map { " -I$_" } @$incdirs); - my $data = `$cpp -D__PIDL__$includes -xc $filename`; + my $data = ''; + #if we found gcc in the compilerstring use gcc spesific flags + if($cptype eq "gcc") { + $data = `$cpp -D__PIDL__$includes -xc $filename`; + } else { + $data = `$cpp -D__PIDL__$includes $filename`; + } $/ = $saved_delim; return parse_string($data, $filename); -- 1.5.6.5