summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildtools/wafsamba/samba_autoconf.py27
-rw-r--r--lib/util/wscript_configure2
2 files changed, 29 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index c5114e5a28..3dc2a30884 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -166,6 +166,33 @@ def CHECK_SIZEOF(conf, vars, headers=None, define=None):
@conf
+def CHECK_CODE_COMPILES(conf, code, define,
+ always=False, headers=None):
+ '''check if some code compiles'''
+ hdrs=''
+ if headers is not None:
+ hlist = to_list(headers)
+ else:
+ hlist = conf.env.hlist
+ for h in hlist:
+ hdrs += '#include <%s>\n' % h
+ if conf.check(fragment='''
+ %s
+ int main(void) {
+ %s;
+ return 0;
+ }
+ ''' % (hdrs, code),
+ execute=0,
+ msg="Checking %s" % define):
+ conf.DEFINE(define, 1)
+ return True
+ elif always:
+ conf.DEFINE(define, 0)
+ return False
+
+
+@conf
def CHECK_STRUCTURE_MEMBER(conf, structname, member,
always=False, define=None, headers=None):
'''check for a structure member'''
diff --git a/lib/util/wscript_configure b/lib/util/wscript_configure
index 0b2949cd83..a2f1c256a3 100644
--- a/lib/util/wscript_configure
+++ b/lib/util/wscript_configure
@@ -10,3 +10,5 @@ conf.CHECK_HEADERS('sys/attributes.h attr/xattr.h sys/xattr.h')
conf.CHECK_FUNCS_IN('flistxattr', 'attr', checklibc=True)
conf.CHECK_STRUCTURE_MEMBER('struct statvfs', 'f_frsize', define='HAVE_FRSIZE')
+
+conf.CHECK_CODE_COMPILES('gettimeofday(NULL, NULL)', 'HAVE_GETTIMEOFDAY_TZ')