Author: jelmer
Date: 2006-09-07 20:01:17 +0000 (Thu, 07 Sep 2006)
New Revision: 18228

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18228

Log:
Don't include Samba4-specific headers when building inside a Samba3 tree.

Modified:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm


Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm  
2006-09-07 19:46:23 UTC (rev 18227)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm  
2006-09-07 20:01:17 UTC (rev 18228)
@@ -2359,6 +2359,29 @@
        pidl_hdr "#endif /* _HEADER_NDR_$interface->{NAME} */";
 }
 
+sub GenerateIncludes()
+{
+       if (is_intree()) {
+               pidl "#include \"includes.h\"";
+       } else {
+               pidl "#define _GNU_SOURCE";
+               pidl "#include <stdint.h>";
+               pidl "#include <stdlib.h>";
+               pidl "#include <stdio.h>";
+               pidl "#include <stdbool.h>";
+               pidl "#include <stdarg.h>";
+               pidl "#include <string.h>";
+       }
+
+       # Samba3 has everything in include/includes.h
+       if (is_intree() != 3) {
+               pidl choose_header("libcli/util/nterr.h", "core/nterr.h");
+               pidl choose_header("librpc/gen_ndr/ndr_misc.h", 
"gen_ndr/ndr_misc.h");
+               pidl choose_header("librpc/gen_ndr/ndr_dcerpc.h", 
"gen_ndr/ndr_dcerpc.h");
+               pidl choose_header("librpc/rpc/dcerpc.h", "dcerpc.h"); #FIXME: 
This shouldn't be here!
+       }
+}
+
 #####################################################################
 # parse a parsed IDL structure back into an IDL file
 sub Parse($$$)
@@ -2376,22 +2399,8 @@
 
        pidl "/* parser auto-generated by pidl */";
        pidl "";
-       if (is_intree()) {
-               pidl "#include \"includes.h\"";
-       } else {
-               pidl "#define _GNU_SOURCE";
-               pidl "#include <stdint.h>";
-               pidl "#include <stdlib.h>";
-               pidl "#include <stdio.h>";
-               pidl "#include <stdbool.h>";
-               pidl "#include <stdarg.h>";
-               pidl "#include <string.h>";
-       }
-       pidl choose_header("libcli/util/nterr.h", "core/nterr.h");
-       pidl choose_header("librpc/gen_ndr/ndr_misc.h", "gen_ndr/ndr_misc.h");
-       pidl choose_header("librpc/gen_ndr/ndr_dcerpc.h", 
"gen_ndr/ndr_dcerpc.h");
+       GenerateIncludes();
        pidl "#include \"$ndr_header\"" if ($ndr_header);
-       pidl choose_header("librpc/rpc/dcerpc.h", "dcerpc.h"); #FIXME: This 
shouldn't be here!
        pidl "";
 
        my %needed = ();

Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm     2006-09-07 
19:46:23 UTC (rev 18227)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4.pm     2006-09-07 
20:01:17 UTC (rev 18228)
@@ -18,7 +18,9 @@
 
 sub is_intree()
 {
-       return (-f "kdc/kdc.c" or -f "include/smb.h");
+       return 4 if (-f "kdc/kdc.c");
+       return 3 if (-f "include/smb.h");
+       return 0;
 }
 
 # Return an #include line depending on whether this build is an in-tree

Reply via email to