diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-03-22 18:38:38 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-04-06 20:27:00 +1000 |
commit | 570847054cb0d9b257d794b8f4dce38ddc5fe679 (patch) | |
tree | 61d2cd880ba1f00c720ccd2cfb791793fbd8148c | |
parent | cc2284cca12e7b8a1153b4d1f46484f4c79ba5c3 (diff) | |
download | samba-570847054cb0d9b257d794b8f4dce38ddc5fe679.tar.gz samba-570847054cb0d9b257d794b8f4dce38ddc5fe679.tar.xz samba-570847054cb0d9b257d794b8f4dce38ddc5fe679.zip |
build: added CHECK_C_PROTOTYPE() configure function
-rw-r--r-- | buildtools/wafsamba/samba_autoconf.py | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index 7e910ad8a4..ab3191dec0 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -82,7 +82,7 @@ def CHECK_TYPE(conf, t, alternate=None, headers=None, define=None): @conf -def CHECK_VARIABLE(conf, v, define=None, always=False, headers=None): +def CHECK_VARIABLE(conf, v, define=None, always=False, headers=None, msg=None): '''check for a variable declaration (or define)''' hdrs='' if headers is not None: @@ -93,6 +93,13 @@ def CHECK_VARIABLE(conf, v, define=None, always=False, headers=None): hdrs += '#include <%s>\n' % h if define is None: define = 'HAVE_%s' % v.upper() + + if CONFIG_SET(conf, define): + return True + + if msg is None: + msg="Checking for variable %s" % v + if conf.check(fragment= ''' %s @@ -104,7 +111,7 @@ def CHECK_VARIABLE(conf, v, define=None, always=False, headers=None): } ''' % (hdrs, v, v), execute=0, - msg="Checking for variable %s" % v): + msg=msg): conf.DEFINE(define, 1) return True elif always: @@ -124,7 +131,10 @@ def CHECK_DECLS(conf, vars, reverse=False, headers=None): define='HAVE_DECL_%s' % v.upper() else: define='HAVE_%s_DECL' % v.upper() - if not CHECK_VARIABLE(conf, v, define=define, headers=headers): + if not CHECK_VARIABLE(conf, v, + define=define, + headers=headers, + msg='Checking for declaration of %s' % v): ret = False return ret @@ -190,7 +200,7 @@ def CHECK_SIZEOF(conf, vars, headers=None, define=None): def CHECK_CODE(conf, code, define, always=False, execute=False, addmain=True, mandatory=False, headers=None, msg=None, cflags='', includes='# .', - local_include=True): + local_include=True, lib='c'): '''check if some code compiles and/or runs''' hdrs='' if headers is not None: @@ -227,6 +237,7 @@ def CHECK_CODE(conf, code, define, mandatory = mandatory, ccflags=TO_LIST(cflags), includes=includes, + lib=lib, # how do I make this conditional, so I can avoid the -lc? msg=msg): conf.DEFINE(define, 1) return True @@ -352,6 +363,18 @@ 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;\n%s()' % (prototype, function), + define=define, + msg='Checking C prototype for %s' % function) + + + + ################################################# # write out config.h in the right directory @conf |