From 433ec0ba664c9eb53b26550e25973e2fc538646b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 7 Sep 2006 20:01:17 +0000 Subject: r18228: Don't include Samba4-specific headers when building inside a Samba3 tree. (This used to be commit d0f0d4600acad71ea4993f4e356735433d9bc5f0) --- source4/pidl/lib/Parse/Pidl/Samba4.pm | 4 ++- source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 39 +++++++++++++++--------- 2 files changed, 27 insertions(+), 16 deletions(-) (limited to 'source4/pidl/lib') 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 "; + pidl "#include "; + pidl "#include "; + pidl "#include "; + pidl "#include "; + pidl "#include "; + } + + # 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 "; - pidl "#include "; - pidl "#include "; - pidl "#include "; - pidl "#include "; - pidl "#include "; - } - 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 = (); -- cgit