diff options
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/scons/iconv.py | 75 | ||||
-rw-r--r-- | source4/build/scons/pidl.py | 32 | ||||
-rw-r--r-- | source4/build/scons/proto.py | 26 |
3 files changed, 133 insertions, 0 deletions
diff --git a/source4/build/scons/iconv.py b/source4/build/scons/iconv.py new file mode 100644 index 0000000000..ef82dc475d --- /dev/null +++ b/source4/build/scons/iconv.py @@ -0,0 +1,75 @@ +# Based on the M4 macro by Bruno Haible. + +def _CheckIconvPath(path): + # Some systems have iconv in libc, some have it in libiconv (OSF/1 and + # those with the standalone portable libiconv installed). + context.Message("checking for iconv in " + path) + + main = """ +int main() +{ + iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + return 0; +}""" + + have_giconv_iconv = context.TryLink(""" +#include <stdlib.h> +#include <giconv.h> +""" + main, '.c') + if have_giconv_iconv: + context.Result(1) + return ("giconv.h", "") + + have_iconv_iconv = context.TryLink(""" +#include <stdlib.h> +#include <iconv.h> +""" + main, '.c') + + if have_iconv_iconv: + context.Result(1) + return ("iconv.h", "") + + #FIXME: Add -lgiconv + have_giconv_lib_iconv = context.TryLink(""" +#include <stdlib.h> +#include <giconv.h> +""" + main, '.c') + if have_giconv_lib_iconv: + context.Result(1) + return ("giconv.h", "-lgiconv") + + #FIXME: Add -liconv + have_iconv_lib_iconv = context.TryLink(""" +#include <stdlib.h> +#include <iconv.h> +"""+main,'.c') + + if have_iconv_lib_iconv: + context.Result(1) + return ("iconv.h", "-liconv") + + return None + +def CheckIconv(context): + context.Message("checking for iconv") + + look_dirs = ['/usr','/usr/local','/sw'] + + for p in look_dirs: + _CheckIconvPath(p) #FIXME: Handle return value + + if context.TryRun(""" +#include <iconv.h> +main() { + iconv_t cd = iconv_open("ASCII", "UCS-2LE"); + if (cd == 0 || cd == (iconv_t)-1) return -1; + return 0; +} +""", '.c'): + context.Result(1) + return (1,[]) + + context.Result(0) + return (0,[]) diff --git a/source4/build/scons/pidl.py b/source4/build/scons/pidl.py new file mode 100644 index 0000000000..c0c29d2035 --- /dev/null +++ b/source4/build/scons/pidl.py @@ -0,0 +1,32 @@ +"""SCons.Tool.pidl + +Tool-specific initialization for pidl (Perl-based IDL compiler) + +""" + +import SCons.Defaults +import SCons.Scanner.IDL +import SCons.Util + +idl_scanner = SCons.Scanner.IDL.IDLScan() + +pidl_builder = SCons.Builder.Builder(action='$PIDLCOM', + src_suffix = '.idl', + suffix='.c', + scanner = idl_scanner) + +def generate(env): + env['PIDL'] = 'pidl' + env['PIDLCPP'] = env['CPP'] + env['PIDLFLAGS'] = [] + env['PIDLCOM'] = 'CPP=$PIDLCPP $PIDL $PIDLFLAGS -- $SOURCE' + env['BUILDERS']['NdrMarshaller'] = pidl_builder + +def exists(env): + if (env.Detect('./pidl/pidl')): + return 1 + + if (env.Detect('pidl')): + return 1 + + return 0 diff --git a/source4/build/scons/proto.py b/source4/build/scons/proto.py new file mode 100644 index 0000000000..6a53bfb4ab --- /dev/null +++ b/source4/build/scons/proto.py @@ -0,0 +1,26 @@ +"""SCons.Tool.proto + +Tool-specific initialization for mkproto (C Proto File generator) + +""" + +import SCons.Defaults +import SCons.Scanner.C +import SCons.Util + +c_scanner = SCons.Scanner.C.CScan() + +proto_builder = SCons.Builder.Builder(action='$PROTOCOM', + src_suffix = '.idl', + suffix='.h', + scanner = c_scanner) + +def generate(env): + env['MKPROTO'] = './script/mkproto.sh' + env['PROTOCOM'] = '$MKPROTO "$PERL" -h _PROTO_H_ ${TARGETS[0]} $SOURCE' + env['BUILDERS']['ProtoHeader'] = proto_builder + +def exists(env): + return env.Detect('./script/mkproto.sh') + + |