1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
samba-mirror/source3/build/charset.py
Andrew Bartlett 125a2ff262 lib/util/charset: Remove 'display charset'
As discussed in 'CH_DISPLAY and gettext' on the samba-technical list:
http://lists.samba.org/archive/samba-technical/2011-June/078190.html

Setting this to a value other than 'unix charset' does not make sense,
as any system where the filesytem charset does not equal the terminal
charset will already have problems with programs as simple as 'ls'.
It also means that our output could not be pasted as our input in
interactive programs or onto our command line, as we never did
translate in the DISPLAY -> UNIX direction.

The d_printf() calls are retained in case we need to revisit this, and
to support display_set_stderr().

Andrew Bartlett
2011-06-23 13:47:27 +02:00

43 lines
1.5 KiB
Python

# tests for charsets for Samba3
from Configure import conf
@conf
def CHECK_SAMBA3_CHARSET(conf, crossbuild=False):
'''Check for default charsets for Samba3
'''
if conf.CHECK_ICONV(define='HAVE_NATIVE_ICONV'):
default_dos_charset=False
default_unix_charset=False
# check for default dos charset name
for charset in ['CP850', 'IBM850']:
if conf.CHECK_CHARSET_EXISTS(charset, headers='iconv.h'):
default_dos_charset=charset
break
# check for default unix charset name
for charset in ['UTF-8', 'UTF8']:
if conf.CHECK_CHARSET_EXISTS(charset, headers='iconv.h'):
default_unix_charset=charset
break
# At this point, we have a libiconv candidate. We know that
# we have the right headers and libraries, but we don't know
# whether it does the conversions we want. We can't test this
# because we are cross-compiling. This is not necessarily a big
# deal, since we can't guarantee that the results we get now will
# match the results we get at runtime anyway.
if crossbuild:
default_dos_charset="CP850"
default_unix_charset="UTF-8"
# TODO: this used to warn about the set charset on cross builds
conf.DEFINE('DEFAULT_DOS_CHARSET', default_dos_charset, quote=True)
conf.DEFINE('DEFAULT_UNIX_CHARSET', default_unix_charset, quote=True)
else:
conf.DEFINE('DEFAULT_DOS_CHARSET', "ASCII", quote=True)
conf.DEFINE('DEFAULT_UNIX_CHARSET', "UTF8", quote=True)