s4-dns: Check DLZ_DLOPEN_VERSION for different BIND versions
[Samba.git] / source3 / build / charset.py
blob003355773614740884d673b63e8d188f50df8fa9
1 # tests for charsets for Samba3
3 from Configure import conf
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
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
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
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
36 if default_dos_charset is False or default_unix_charset is False:
37 # we found iconv, but it failed to convert anything (e.g. on AIX)
38 conf.undefine('HAVE_NATIVE_ICONV');
39 default_dos_charset = "ASCII"
40 default_unix_charset = "UTF-8"
42 conf.DEFINE('DEFAULT_DOS_CHARSET', default_dos_charset, quote=True)
43 conf.DEFINE('DEFAULT_UNIX_CHARSET', default_unix_charset, quote=True)
45 else:
46 conf.DEFINE('DEFAULT_DOS_CHARSET', "ASCII", quote=True)
47 conf.DEFINE('DEFAULT_UNIX_CHARSET', "UTF8", quote=True)