summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4.pm4
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm39
2 files changed, 27 insertions, 16 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4.pm b/source4/pidl/lib/Parse/Pidl/Samba4.pm
index eac5104da2..4ef2daa591 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4.pm
@@ -18,7 +18,9 @@ $VERSION = '0.01';
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
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index bf5e8fe441..9e4388e28d 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -2359,6 +2359,29 @@ sub ParseInterface($$)
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 @@ sub Parse($$$)
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 = ();