From ecafbd3ec8b03f773d04a5e7b305a91aa08e18a5 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Thu, 25 Mar 2010 06:58:35 -0600 Subject: s3-waf: check for default charsets --- source3/build/__init__.py | 0 source3/build/charset.py | 52 +++++++++++++++++++++++++++++++++++++++++++++++ source3/wscript | 3 +++ source3/wscript_build | 1 + 4 files changed, 56 insertions(+) create mode 100644 source3/build/__init__.py create mode 100644 source3/build/charset.py (limited to 'source3') diff --git a/source3/build/__init__.py b/source3/build/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/source3/build/charset.py b/source3/build/charset.py new file mode 100644 index 0000000000..fce1f4af31 --- /dev/null +++ b/source3/build/charset.py @@ -0,0 +1,52 @@ +# 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_display_charset=False + default_unix_charset=False + + # check for default dos charset name + for charset in ['CP850', 'IBM850']: + if conf.CHECK_CHARSET_EXISTS(charset): + default_dos_charset=charset + break + + # check for default display charset name + for charset in ['ASCII', '646']: + if conf.CHECK_CHARSET_EXISTS(charset): + default_display_charset=charset + break + + # check for default unix charset name + for charset in ['UTF-8', 'UTF8']: + if conf.CHECK_CHARSET_EXISTS(charset): + 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_display_charset="ASCII" + 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) + conf.DEFINE('DEFAULT_DISPLAY_CHARSET', default_display_charset) + conf.DEFINE('DEFAULT_UNIX_CHARSET', default_unix_charset) + + else: + conf.DEFINE('DEFAULT_DOS_CHARSET', "ASCII") + conf.DEFINE('DEFAULT_DISPLAY_CHARSET', "ASCII") + conf.DEFINE('DEFAULT_UNIX_CHARSET', "UTF8") + diff --git a/source3/wscript b/source3/wscript index 20e017bc85..f8dd5cb809 100644 --- a/source3/wscript +++ b/source3/wscript @@ -6,6 +6,7 @@ blddir = 'bin' import sys, os sys.path.insert(0, srcdir+"/buildtools/wafsamba") import wafsamba, Options +import build.charset def set_options(opt): opt.recurse('../lib/replace') @@ -220,4 +221,6 @@ yp_get_default_domain conf.CHECK_TYPE('struct timespec', headers='sys/time.h time.h') + conf.CHECK_SAMBA3_CHARSET() # see build/charset.py + conf.SAMBA_CONFIG_H('include/config.h') diff --git a/source3/wscript_build b/source3/wscript_build index 8145f77df4..c380aa7735 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -574,6 +574,7 @@ PRINTBACKEND_SRC = 'printing/printing.c printing/nt_printing.c ${PRINTBASE_SRC}' SMBD_SRC = '''${SMBD_SRC_BASE} ${SMBD_SRC_MAIN}''' +LIBS='ICONV' bld.env.AWK = 'gawk' -- cgit