2 # tastes like -*- python -*-
5 def _CheckIconvPath(context,path):
6 # Some systems have iconv in libc, some have it in libiconv (OSF/1 and
7 # those with the standalone portable libiconv installed).
9 context.Message("checking for iconv in " + path + " ... ")
10 context.env.Append(LIBPATH=path)
12 context.Message("checking for iconv in default path ... ")
14 for l in [None,'giconv','iconv']:
15 for h in ['giconv.h','iconv.h']:
17 context.env['LIBS'] = [l]
18 if context.TryLink("""
24 iconv_t cd = iconv_open("","");
25 iconv(cd,NULL,NULL,NULL,NULL);
35 def CheckIconv(context):
36 look_dirs = [None, '/usr','/usr/local','/sw']
39 if _CheckIconvPath(context,p):
45 iconv_t cd = iconv_open("ASCII", "UCS-2LE");
46 if (cd == 0 || cd == (iconv_t)-1) return -1;
54 if hostenv['configure']:
55 conf = hostenv.Configure( custom_tests = { 'CheckIconv' : CheckIconv })
56 (have_iconv,iconv) = conf.CheckIconv()
60 print "Install iconv for better charset compatibility"
64 charset = hostenv.Library('charset',['iconv.c','charcnv.c',iconv])