[740] | 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_display_charset=False
|
---|
| 12 | default_unix_charset=False
|
---|
| 13 |
|
---|
| 14 | # check for default dos charset name
|
---|
| 15 | for charset in ['CP850', 'IBM850']:
|
---|
| 16 | if conf.CHECK_CHARSET_EXISTS(charset, headers='iconv.h'):
|
---|
| 17 | default_dos_charset=charset
|
---|
| 18 | break
|
---|
| 19 |
|
---|
| 20 | # check for default display charset name
|
---|
| 21 | for charset in ['ASCII', '646']:
|
---|
| 22 | if conf.CHECK_CHARSET_EXISTS(charset, headers='iconv.h'):
|
---|
| 23 | default_display_charset=charset
|
---|
| 24 | break
|
---|
| 25 |
|
---|
| 26 | # check for default unix charset name
|
---|
| 27 | for charset in ['UTF-8', 'UTF8']:
|
---|
| 28 | if conf.CHECK_CHARSET_EXISTS(charset, headers='iconv.h'):
|
---|
| 29 | default_unix_charset=charset
|
---|
| 30 | break
|
---|
| 31 |
|
---|
| 32 | # At this point, we have a libiconv candidate. We know that
|
---|
| 33 | # we have the right headers and libraries, but we don't know
|
---|
| 34 | # whether it does the conversions we want. We can't test this
|
---|
| 35 | # because we are cross-compiling. This is not necessarily a big
|
---|
| 36 | # deal, since we can't guarantee that the results we get now will
|
---|
| 37 | # match the results we get at runtime anyway.
|
---|
| 38 | if crossbuild:
|
---|
| 39 | default_dos_charset="CP850"
|
---|
| 40 | default_display_charset="ASCII"
|
---|
| 41 | default_unix_charset="UTF-8"
|
---|
| 42 | # TODO: this used to warn about the set charset on cross builds
|
---|
| 43 |
|
---|
| 44 | conf.DEFINE('DEFAULT_DOS_CHARSET', default_dos_charset, quote=True)
|
---|
| 45 | conf.DEFINE('DEFAULT_DISPLAY_CHARSET', default_display_charset, quote=True)
|
---|
| 46 | conf.DEFINE('DEFAULT_UNIX_CHARSET', default_unix_charset, quote=True)
|
---|
| 47 |
|
---|
| 48 | else:
|
---|
| 49 | conf.DEFINE('DEFAULT_DOS_CHARSET', "ASCII", quote=True)
|
---|
| 50 | conf.DEFINE('DEFAULT_DISPLAY_CHARSET', "ASCII", quote=True)
|
---|
| 51 | conf.DEFINE('DEFAULT_UNIX_CHARSET', "UTF8", quote=True)
|
---|
| 52 |
|
---|