1 # a set of config tests that use the samba_autoconf functions
2 # to test for commonly needed configuration options
6 def CHECK_ICONV(conf, define='HAVE_NATIVE_ICONV'):
7 '''check if the iconv library is installed
8 optionally pass a define'''
9 if conf.CHECK_FUNCS_IN('iconv_open', 'iconv', checklibc=True, headers='iconv.h'):
10 conf.DEFINE(define, 1)
16 def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'):
17 '''see what we need for largefile support'''
18 if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
21 msg='Checking for large file support'):
23 if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
26 cflags='-D_FILE_OFFSET_BITS=64',
27 msg='Checking for -D_FILE_OFFSET_BITS=64'):
28 conf.DEFINE('_FILE_OFFSET_BITS', 64)
34 def CHECK_C_PROTOTYPE(conf, function, prototype, define, headers=None):
35 '''verify that a C prototype matches the one on the current system'''
36 if not conf.CHECK_DECLS(function, headers=headers):
38 return conf.CHECK_CODE('%s; void *_x = (void *)%s' % (prototype, function),
42 msg='Checking C prototype for %s' % function)
46 def CHECK_CHARSET_EXISTS(conf, charset, outcharset='UCS2-LE', libs=None, headers=None, define=None):
47 '''check that a named charset is able to be used with iconv_open() for conversion
50 msg = 'Checking if can we convert from %s to %s' % (charset, outcharset)
52 define = 'HAVE_CHARSET_%s' % charset.upper().replace('-','_')
53 return conf.CHECK_CODE('''
54 iconv_t cd = iconv_open("%s", "%s");
55 if (cd == 0 || cd == (iconv_t)-1) {
59 ''' % (charset, outcharset),