summaryrefslogtreecommitdiffstats
path: root/source4/lib/charset
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-09-23 16:32:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:48 -0500
commit4be0ae794e4af2354d678fddd7bf1e822ffa9148 (patch)
tree128989d970334e4a896329992e827c4f09b8c035 /source4/lib/charset
parentda46c9252ee887602b3e629065ca87b9ed11466f (diff)
downloadsamba-4be0ae794e4af2354d678fddd7bf1e822ffa9148.tar.gz
samba-4be0ae794e4af2354d678fddd7bf1e822ffa9148.tar.xz
samba-4be0ae794e4af2354d678fddd7bf1e822ffa9148.zip
r10456: More SCons fixes:
- Add framework for fallback generating code - Move pread / pwrite replacement functions to libreplace - Support pidl builds correctly - Support asn1 builds correctly - Move OS-specific checks to lib/replace/SConscript (This used to be commit fbbfad0a1f7dedbf48e835a864f8285f283d72f3)
Diffstat (limited to 'source4/lib/charset')
-rw-r--r--source4/lib/charset/SConscript92
1 files changed, 84 insertions, 8 deletions
diff --git a/source4/lib/charset/SConscript b/source4/lib/charset/SConscript
index 53e5db44bb..b3305579e1 100644
--- a/source4/lib/charset/SConscript
+++ b/source4/lib/charset/SConscript
@@ -1,15 +1,91 @@
+#!/usr/bin/env python
+# tastes like -*- python -*-
+
Import('hostenv')
-SConscript('../../build/scons/iconv.py')
-# tastes like -*- python -*-
-#conf = Configure( custom_tests = { 'CheckIconv' : CheckIconv })
-#(have_iconv,iconv) = conf.CheckIconv()
-#conf.Finish()
+def _CheckIconvPath(context,path):
+ # Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+ # those with the standalone portable libiconv installed).
+ context.Message("checking for iconv in " + path + " ... ")
+
+ main = """
+int main()
+{
+ iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);
+ return 0;
+}"""
+
+ have_giconv_iconv = context.TryLink("""
+#include <stdlib.h>
+#include <giconv.h>
+""" + main, '.c')
+ if have_giconv_iconv:
+ context.Result(1)
+ return ("giconv.h", "")
+
+ have_iconv_iconv = context.TryLink("""
+#include <stdlib.h>
+#include <iconv.h>
+""" + main, '.c')
+
+ if have_iconv_iconv:
+ context.Result(1)
+ return ("iconv.h", "")
+
+ #FIXME: Add -lgiconv
+ have_giconv_lib_iconv = context.TryLink("""
+#include <stdlib.h>
+#include <giconv.h>
+""" + main, '.c')
+ if have_giconv_lib_iconv:
+ context.Result(1)
+ return ("giconv.h", "-lgiconv")
+
+ #FIXME: Add -liconv
+ have_iconv_lib_iconv = context.TryLink("""
+#include <stdlib.h>
+#include <iconv.h>
+"""+main,'.c')
+
+ if have_iconv_lib_iconv:
+ context.Result(1)
+ return ("iconv.h", "-liconv")
+
+ return None
+
+def CheckIconv(context):
+ context.Message("checking for iconv ... ")
+
+ look_dirs = ['/usr','/usr/local','/sw']
+
+ for p in look_dirs:
+ _CheckIconvPath(context,p) #FIXME: Handle return value
+
+ if context.TryRun("""
+#include <iconv.h>
+main() {
+ iconv_t cd = iconv_open("ASCII", "UCS-2LE");
+ if (cd == 0 || cd == (iconv_t)-1) return -1;
+ return 0;
+}
+""", '.c'):
+ context.Result(1)
+ return (1,[])
+
+ context.Result(0)
+ return (0,[])
-#if not have_iconv:
-# print "Install iconv for better charset compatibility"
+if hostenv['configure']:
+ conf = hostenv.Configure( custom_tests = { 'CheckIconv' : CheckIconv })
+ (have_iconv,iconv) = conf.CheckIconv()
+ conf.Finish()
-iconv = []
+ if not have_iconv:
+ print "Install iconv for better charset compatibility"
+else:
+ iconv = [] # FIXME
charset = hostenv.StaticLibrary('charset',['iconv.c','charcnv.c',iconv])
Export('charset')