pidl: use $CC -E if $CPP is not defined, if both undefined use cpp
[ira/wip.git] / pidl / lib / Parse / Pidl / IDL.pm
index de605c702462fddf957d6e1d9d31fe29aa9390d2..bafa2cec61d7ea5c8e1d330a042fea0c46914177 100644 (file)
@@ -2619,11 +2619,17 @@ sub parse_file($$)
        my $saved_delim = $/;
        undef $/;
        my $cpp = $ENV{CPP};
+       my $options = "";
        if (! defined $cpp) {
-               $cpp = "cpp";
+               if (defined $ENV{CC}) {
+                       $cpp = "$ENV{CC}";
+                       $options = "-E";
+               } else {
+                       $cpp = "cpp";
+               }
        }
        my $includes = join('',map { " -I$_" } @$incdirs);
-       my $data = `$cpp -D__PIDL__$includes -xc "$filename"`;
+       my $data = `$cpp $options -D__PIDL__$includes -xc "$filename"`;
        $/ = $saved_delim;
 
        return parse_string($data, $filename);