1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

build: improve autoconf macros

- enable headers to be specified
- enable both forms of DECL check
- more libreplace checks
- more heimdal checks
- more sysdep checks
This commit is contained in:
Andrew Tridgell 2010-03-17 20:40:03 +11:00
parent 54e26fcb48
commit dd05b6512a
4 changed files with 35 additions and 9 deletions

View File

@ -55,14 +55,26 @@ def CHECK_TYPE(conf, t, alternate):
return False
@conf
def CHECK_VARIABLE(conf, v, define=None, always=False):
def CHECK_VARIABLE(conf, v, define=None, always=False, headers=None):
hdrs=''
for h in conf.env.hlist:
if headers is not None:
hlist = headers.split()
else:
hlist = conf.env.hlist
for h in hlist:
hdrs += '#include <%s>\n' % h
if define is None:
define = 'HAVE_%s' % v.upper()
if conf.check(fragment=
'%s\nint main(void) {void *_x; _x=(void *)&%s; return 0;}\n' % (hdrs, v),
'''
%s
int main(void) {
#ifndef %s
void *_x; _x=(void *)&%s;
#endif
return 0;
}\n
''' % (hdrs, v, v),
execute=0,
msg="Checking for variable %s" % v):
conf.DEFINE(define, 1)
@ -72,12 +84,19 @@ def CHECK_VARIABLE(conf, v, define=None, always=False):
return False
@conf
def CHECK_DECLS(conf, vars):
def CHECK_DECLS(conf, vars, reverse=False, headers=None):
'''check a list of variable declarations, using the HAVE_DECL_xxx form
of define'''
of define
When reverse==True then use HAVE_xxx_DECL instead of HAVE_DECL_xxx
'''
ret = True
for v in vars.split():
if not CHECK_VARIABLE(conf, v, define='HAVE_DECL_%s' % v.upper()):
if not reverse:
define='HAVE_DECL_%s' % v.upper()
else:
define='HAVE_%s_DECL' % v.upper()
if not CHECK_VARIABLE(conf, v, define=define, headers=headers):
ret = False
return ret

View File

@ -131,6 +131,9 @@ def configure(conf):
conf.CHECK_DECLS('snprintf vsnprintf asprintf vasprintf')
conf.CHECK_DECLS('dirfd environ errno getgrent_r getpwent_r', reverse=True)
conf.CHECK_DECLS('pread pwrite setenv setresgid setresuid', reverse=True)
conf.check_cc(fragment='''
#include <stdarg.h>
va_list ap1,ap2;

View File

@ -24,7 +24,9 @@ conf.DEFINE('VOID_RETSIGTYPE', 1)
conf.CHECK_VARIABLE('h_errno')
# strangely enough, we need it with another define too
conf.CHECK_VARIABLE('h_errno', define='HAVE_DECL_H_ERRNO')
conf.CHECK_DECLS('h_errno')
conf.CHECK_DECLS('_res')
conf.CHECK_HEADERS('arpa/nameser.h dns.h')
conf.CHECK_FUNCS_IN('res_search res_nsearch res_ndestroy dns_search dn_expand', 'resolv')

View File

@ -3,5 +3,7 @@ conf.CHECK_HEADERS('linux/inotify.h asm/unistd.h sys/inotify.h', add_headers=Fal
conf.CHECK_FUNCS('inotify_init')
conf.CHECK_VARIABLE('__NR_inotify_init')
conf.CHECK_VARIABLE('F_SETLEASE')
conf.CHECK_VARIABLE('SA_SIGINFO')
conf.CHECK_DECLS('F_SETLEASE', headers='linux/fcntl.h', reverse=True)
conf.CHECK_DECLS('SA_SIGINFO', headers='signal.h', reverse=True)
conf.CHECK_DECLS('__NR_inotify_init', reverse=True, headers='asm/unistd.h')