summaryrefslogtreecommitdiffstats
path: root/source3/build
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:20:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:20:00 +0000
commit8daa83a594a2e98f39d764422bfbdbc62c9efd44 (patch)
tree4099e8021376c7d8c05bdf8503093d80e9c7bad0 /source3/build
parentInitial commit. (diff)
downloadsamba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.tar.xz
samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.zip
Adding upstream version 2:4.20.0+dfsg.upstream/2%4.20.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'source3/build')
-rw-r--r--source3/build/__init__.py0
-rw-r--r--source3/build/charset.py48
2 files changed, 48 insertions, 0 deletions
diff --git a/source3/build/__init__.py b/source3/build/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source3/build/__init__.py
diff --git a/source3/build/charset.py b/source3/build/charset.py
new file mode 100644
index 0000000..6fc1575
--- /dev/null
+++ b/source3/build/charset.py
@@ -0,0 +1,48 @@
+# tests for charsets for Samba3
+
+from waflib.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
+
+ if default_dos_charset is False or default_unix_charset is False:
+ # we found iconv, but it failed to convert anything (e.g. on AIX)
+ conf.undefine('HAVE_NATIVE_ICONV')
+ default_dos_charset = "ASCII"
+ default_unix_charset = "UTF-8"
+
+ 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)