smbd: Ignore twrp in chdir_below_conn()
[samba4-gss.git] / lib / util / charset / wscript_configure
blob451f7f7bca345e5b11ce036d7d380e43d631744f
1 #!/usr/bin/env python
3 # rather strangely, we need to look for libiconv before checking libc
4 # as the external libiconv can use a macro to override iconv_open to libiconv_open
5 # and then we may find the wrong iconv.h later due to other packages looking
6 # in /usr/local
7 # We check for the lib iconv when building a shared lib has some compiler/linker
8 # managed to link when specifying -liconv a executable even if there is no
9 # libiconv.so or libiconv.a
11 conf.CHECK_LIB("iconv", shlib=True)
13 #HP-UX can use libiconv as an add-on package, which has #define iconv_open libiconv_open
14 if (conf.CHECK_FUNCS_IN('iconv_open', 'iconv', checklibc=False, headers='iconv.h') or
15 conf.CHECK_FUNCS_IN('libiconv_open', 'iconv', checklibc=False, headers='iconv.h') or
16 conf.CHECK_FUNCS('iconv_open', headers='iconv.h')):
18 conf.DEFINE('HAVE_NATIVE_ICONV', 1)
20 conf.CHECK_CODE('''
21 uint8_t inbuf[2] = { 0x30, 0xdf };
22 uint8_t outbuf[4] = { 0 };
23 char *ptr_in = (char *)inbuf;
24 char *ptr_out = (char *)outbuf;
25 size_t size_in = sizeof(inbuf);
26 size_t size_out = sizeof(outbuf);
27 size_t ret;
28 iconv_t cd;
29 cd = iconv_open("UTF-8", "UTF-16LE");
30 if (cd == 0 || cd == (iconv_t)-1) return -1;
31 ret = iconv(cd, &ptr_in, &size_in, &ptr_out, &size_out);
32 if (ret != (size_t)-1 || errno != EILSEQ) return -1;
33 ''',
34 define='HAVE_ICONV_ERRNO_ILLEGAL_MULTIBYTE',
35 execute=True,
36 msg='Checking errno of iconv for illegal multibyte sequence',
37 lib='iconv',
38 headers='errno.h iconv.h')
40 # Since commit 86c7688 (MR !3447), the required ICU libraries are discovered
41 # as a single group. This had the benefit of working around ICU-22610, and also
42 # works with the fix that was merged to ICU main in commit 199bc827.
44 if conf.CHECK_CFG(package='icu-i18n icu-uc',
45 args='--cflags --libs',
46 msg='Checking for icu-i18n icu-uc',
47 uselib_store='ICUI18N'):
48 conf.env['icu-libs'] = 'icui18n'
49 conf.CHECK_LIB(conf.env['icu-libs'], shlib=True, mandatory=True)
50 if not conf.CHECK_HEADERS('unicode/ustring.h', lib='icui18n'):
51 conf.fatal('Found icui18n, but unicode/ustring.h is missing')
52 conf.DEFINE('HAVE_UTF8_NORMALISATION', 1)
53 else:
54 conf.env['icu-libs'] = ''