summaryrefslogtreecommitdiff
path: root/source3/build
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2010-03-25 06:58:35 -0600
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:27:07 +1000
commitecafbd3ec8b03f773d04a5e7b305a91aa08e18a5 (patch)
tree2ab0b96b737a8a9b070227abb5ff9394c18b8321 /source3/build
parent6663f7825606d40077dede0ad5ee0df8ab19c708 (diff)
downloadsamba-ecafbd3ec8b03f773d04a5e7b305a91aa08e18a5.tar.gz
s3-waf: check for default charsets
Diffstat (limited to 'source3/build')
-rw-r--r--source3/build/__init__.py0
-rw-r--r--source3/build/charset.py52
2 files changed, 52 insertions, 0 deletions
diff --git a/source3/build/__init__.py b/source3/build/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/source3/build/__init__.py
diff --git a/source3/build/charset.py b/source3/build/charset.py
new file mode 100644
index 00000000000..fce1f4af31d
--- /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")
+