summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-24 16:56:57 -0600
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:27:07 +1000
commit2cac0c27cf5b8606fce53ca02fe0d47504e57514 (patch)
treeaf37da428caf104fd62073a770e95ab107327c7b /buildtools
parent8f5551c4b3bc56a64f4c8f260821114b23fad693 (diff)
downloadsamba-2cac0c27cf5b8606fce53ca02fe0d47504e57514.tar.gz
samba-2cac0c27cf5b8606fce53ca02fe0d47504e57514.tar.bz2
samba-2cac0c27cf5b8606fce53ca02fe0d47504e57514.zip
build: started a library of common config tests for s3/s4
Pair-Programmed-With: Kai Blin <kai@samba.org>
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_autoconf.py31
-rw-r--r--buildtools/wafsamba/samba_conftests.py64
-rw-r--r--buildtools/wafsamba/wafsamba.py1
3 files changed, 65 insertions, 31 deletions
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 31106d7819..ec069485da 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -463,37 +463,6 @@ def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False, header
return ret
-@conf
-def CHECK_C_PROTOTYPE(conf, function, prototype, define, headers=None):
- '''verify that a C prototype matches the one on the current system'''
- if not conf.CHECK_DECLS(function, headers=headers):
- return False
- return conf.CHECK_CODE('%s; void *_x = (void *)%s' % (prototype, function),
- define=define,
- local_include=False,
- headers=headers,
- msg='Checking C prototype for %s' % function)
-
-
-@conf
-def CHECK_LARGEFILE(conf):
- '''see what we need for largefile support'''
- if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
- 'HAVE_LARGEFILE',
- execute=True,
- msg='Checking for large file support'):
- return True
- if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
- 'HAVE_LARGEFILE',
- execute=True,
- cflags='-D_FILE_OFFSET_BITS=64',
- msg='Checking for -D_FILE_OFFSET_BITS=64'):
- conf.DEFINE('_FILE_OFFSET_BITS', 64)
- return True
- return False
-
-
-
#################################################
# write out config.h in the right directory
@conf
diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py
new file mode 100644
index 0000000000..347142c76c
--- /dev/null
+++ b/buildtools/wafsamba/samba_conftests.py
@@ -0,0 +1,64 @@
+# a set of config tests that use the samba_autoconf functions
+# to test for commonly needed configuration options
+
+
+@conf
+def CHECK_ICONV(conf, define='HAVE_NATIVE_ICONV'):
+ '''check if the iconv library is installed
+ optionally pass a define'''
+ if conf.CHECK_FUNCS_IN('iconv_open', 'iconv', checklibc=True, headers='iconv.h'):
+ conf.DEFINE(define, 1)
+ return True
+ return False
+
+
+@conf
+def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'):
+ '''see what we need for largefile support'''
+ if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
+ define,
+ execute=True,
+ msg='Checking for large file support'):
+ return True
+ if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
+ define,
+ execute=True,
+ cflags='-D_FILE_OFFSET_BITS=64',
+ msg='Checking for -D_FILE_OFFSET_BITS=64'):
+ conf.DEFINE('_FILE_OFFSET_BITS', 64)
+ return True
+ return False
+
+
+@conf
+def CHECK_C_PROTOTYPE(conf, function, prototype, define, headers=None):
+ '''verify that a C prototype matches the one on the current system'''
+ if not conf.CHECK_DECLS(function, headers=headers):
+ return False
+ return conf.CHECK_CODE('%s; void *_x = (void *)%s' % (prototype, function),
+ define=define,
+ local_include=False,
+ headers=headers,
+ msg='Checking C prototype for %s' % function)
+
+
+@conf
+def CHECK_CHARSET_EXISTS(conf, charset, outcharset='UCS2-LE', libs=None, headers=None, define=None):
+ '''check that a named charset is able to be used with iconv_open() for conversion
+ to a target charset
+ '''
+ msg = 'Checking if can we convert from %s to %s' % (charset, outcharset)
+ if define is None:
+ define = 'HAVE_CHARSET_%s' % charset.upper().replace('-','_')
+ return conf.CHECK_CODE('''
+ iconv_t cd = iconv_open("%s", "%s");
+ if (cd == 0 || cd == (iconv_t)-1) {
+ return -1;
+ }
+ return 0;
+ ''' % (charset, outcharset),
+ define=define,
+ execute=True,
+ libs=libs,
+ msg=msg,
+ headers=headers)
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index ad104a2e89..cb7e1a55ce 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -17,6 +17,7 @@ from samba_asn1 import *
from samba_autoproto import *
from samba_python import *
from samba_deps import *
+import samba_conftests
LIB_PATH="shared"