s3-param: Rename loadparm_s3_context -> loadparm_s3_helpers
[kai/samba.git] / source3 / build / charset.py
1 # tests for charsets for Samba3
2
3 from Configure import conf
4
5 @conf
6 def CHECK_SAMBA3_CHARSET(conf, crossbuild=False):
7     '''Check for default charsets for Samba3
8     '''
9     if conf.CHECK_ICONV(define='HAVE_NATIVE_ICONV'):
10         default_dos_charset=False
11         default_unix_charset=False
12
13         # check for default dos charset name
14         for charset in ['CP850', 'IBM850']:
15             if conf.CHECK_CHARSET_EXISTS(charset, headers='iconv.h'):
16                 default_dos_charset=charset
17                 break
18
19         # check for default unix charset name
20         for charset in ['UTF-8', 'UTF8']:
21             if conf.CHECK_CHARSET_EXISTS(charset, headers='iconv.h'):
22                 default_unix_charset=charset
23                 break
24
25         # At this point, we have a libiconv candidate. We know that
26         # we have the right headers and libraries, but we don't know
27         # whether it does the conversions we want. We can't test this
28         # because we are cross-compiling. This is not necessarily a big
29         # deal, since we can't guarantee that the results we get now will
30         # match the results we get at runtime anyway.
31         if crossbuild:
32             default_dos_charset="CP850"
33             default_unix_charset="UTF-8"
34             # TODO: this used to warn about the set charset on cross builds
35
36         conf.DEFINE('DEFAULT_DOS_CHARSET', default_dos_charset, quote=True)
37         conf.DEFINE('DEFAULT_UNIX_CHARSET', default_unix_charset, quote=True)
38
39     else:
40         conf.DEFINE('DEFAULT_DOS_CHARSET', "ASCII", quote=True)
41         conf.DEFINE('DEFAULT_UNIX_CHARSET', "UTF8", quote=True)
42