pidl: use $CC -E if $CPP is not defined, if both undefined use cpp
authorMatthieu Patou <mat@matws.net>
Thu, 9 Dec 2010 23:03:40 +0000 (02:03 +0300)
committerMatthieu Patou <mat@samba.org>
Fri, 10 Dec 2010 00:26:44 +0000 (01:26 +0100)
Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Fri Dec 10 01:26:44 CET 2010 on sn-devel-104

pidl/lib/Parse/Pidl/IDL.pm

index de605c7..bafa2ce 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);