mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
waf: consolidate libintl related checks
consolidate the dealing with functions from libintl and the handling of checking if libiconv is required or not to a common place in lib/replace also add a new samba_intl subsystem that has dependencies on the appropriate set of libraries (libintl, libintl+libiconv or none) that can be used as a general dependency by code that depends on the internationalization libraries Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
a742e87b39
commit
07b3a04872
@ -89,7 +89,7 @@ struct foo bar = { .y = 'X', .x = 1 };
|
||||
sys/sockio.h sys/un.h''', together=True)
|
||||
conf.CHECK_HEADERS('sys/uio.h ifaddrs.h direct.h dirent.h')
|
||||
conf.CHECK_HEADERS('windows.h winsock2.h ws2tcpip.h')
|
||||
conf.CHECK_HEADERS('libintl.h errno.h')
|
||||
conf.CHECK_HEADERS('errno.h')
|
||||
conf.CHECK_HEADERS('gcrypt.h getopt.h iconv.h')
|
||||
conf.CHECK_HEADERS('sys/inotify.h memory.h nss.h sasl/sasl.h')
|
||||
conf.CHECK_HEADERS('security/pam_appl.h zlib.h asm/unistd.h')
|
||||
@ -363,17 +363,41 @@ removeea setea
|
||||
headers='netinet/in.h arpa/nameser.h resolv.h')
|
||||
|
||||
|
||||
if not conf.CHECK_FUNCS_IN('gettext', 'intl', checklibc=True, headers='libintl.h'):
|
||||
# Some hosts need lib iconv for linking with lib intl
|
||||
# So we try with flags just in case it helps.
|
||||
oldflags = conf.env['LDFLAGS_INTL']
|
||||
conf.env['LDFLAGS_INTL'] = "-liconv"
|
||||
if not conf.CHECK_LIB('intl'):
|
||||
conf.env['LDFLAGS_INTL'] = oldflags
|
||||
conf.env.intl_libs=''
|
||||
if not Options.options.disable_gettext:
|
||||
conf.CHECK_HEADERS('libintl.h')
|
||||
conf.CHECK_LIB('intl')
|
||||
# *textdomain functions are not strictly necessary
|
||||
conf.CHECK_FUNCS_IN('bindtextdomain textdomain bind_textdomain_codeset',
|
||||
'', checklibc=True, headers='libintl.h')
|
||||
# gettext and dgettext must exist
|
||||
# on some systems (the ones with glibc, those are in libc)
|
||||
if conf.CHECK_FUNCS_IN('dgettext gettext', '', checklibc=True, headers='libintl.h'):
|
||||
# save for dependency definitions
|
||||
conf.env.intl_libs=''
|
||||
# others (e.g. FreeBSD) have seperate libintl
|
||||
elif conf.CHECK_FUNCS_IN('dgettext gettext', 'intl', checklibc=False, headers='libintl.h'):
|
||||
# save for dependency definitions
|
||||
conf.env.intl_libs='intl'
|
||||
# recheck with libintl
|
||||
conf.CHECK_FUNCS_IN('bindtextdomain textdomain bind_textdomain_codeset',
|
||||
'intl', checklibc=False, headers='libintl.h')
|
||||
else:
|
||||
conf.CHECK_FUNCS_IN('gettext', 'intl', checklibc=True, headers='libintl.h')
|
||||
# Some hosts need lib iconv for linking with lib intl
|
||||
# So we try with flags just in case it helps.
|
||||
oldflags = conf.env['EXTRA_LDFLAGS'];
|
||||
conf.env['EXTRA_LDFLAGS'].extend("-liconv")
|
||||
conf.CHECK_FUNCS_IN('dgettext gettext bindtextdomain textdomain bind_textdomain_codeset',
|
||||
'intl', checklibc=False, headers='libintl.h')
|
||||
conf.env['EXTRA_LDFLAGS'] = oldflags
|
||||
if conf.env['HAVE_GETTEXT'] and conf.env['HAVE_DGETTEXT']:
|
||||
# save for dependency definitions
|
||||
conf.env.intl_libs='iconv intl'
|
||||
else:
|
||||
conf.fatal('library gettext not found, try specifying the path to ' +
|
||||
'it with --with-gettext=</path/to/gettext> or ' +
|
||||
'--without-gettext to build without''')
|
||||
|
||||
conf.CHECK_FUNCS_IN('dgettext gettext', 'intl', headers='libintl.h')
|
||||
conf.CHECK_FUNCS_IN('pthread_create', 'pthread', checklibc=True, headers='pthread.h')
|
||||
|
||||
conf.CHECK_FUNCS_IN('crypt', 'crypt', checklibc=True)
|
||||
@ -627,6 +651,8 @@ def build(bld):
|
||||
target='stdbool.h',
|
||||
enabled = not bld.CONFIG_SET('HAVE_STDBOOL_H'))
|
||||
|
||||
bld.SAMBA_SUBSYSTEM('samba_intl', source='', use_global_deps=False,deps=bld.env.intl_libs)
|
||||
|
||||
def dist():
|
||||
'''makes a tarball for distribution'''
|
||||
samba_dist.dist()
|
||||
|
@ -98,7 +98,6 @@ def configure(conf):
|
||||
conf.CHECK_FUNCS('memalign posix_memalign hstrerror')
|
||||
conf.CHECK_FUNCS('shmget')
|
||||
conf.CHECK_FUNCS_IN('shm_open', 'rt', checklibc=True)
|
||||
conf.CHECK_FUNCS('gettext dgettext bindtextdomain textdomain bind_textdomain_codeset')
|
||||
#FIXME: for some reason this one still fails
|
||||
conf.CHECK_FUNCS_IN('yp_get_default_domain', 'nsl')
|
||||
conf.CHECK_FUNCS_IN('dn_expand _dn_expand __dn_expand', 'resolv')
|
||||
@ -331,8 +330,8 @@ if (0) {
|
||||
|
||||
conf.CHECK_FUNCS('''
|
||||
_acl __acl atexit
|
||||
bindtextdomain _chdir __chdir chflags chmod _close __close _closedir
|
||||
__closedir crypt16 devnm dgettext dirfd
|
||||
_chdir __chdir chflags chmod _close __close _closedir
|
||||
__closedir crypt16 devnm dirfd
|
||||
DNSServiceRegister _dup __dup _dup2 __dup2 endmntent execl
|
||||
_facl __facl _fchdir
|
||||
__fchdir fchmod fchown _fcntl __fcntl fcvt fcvtl fdatasync
|
||||
@ -341,7 +340,7 @@ fsetxattr _fstat __fstat fsync
|
||||
futimens futimes __fxstat getauthuid
|
||||
getcwd _getcwd __getcwd getdents __getdents getdirentries
|
||||
getgrent getgrnam getgrouplist getgrset getmntent getpagesize
|
||||
getpwanam getpwent_r getrlimit gettext
|
||||
getpwanam getpwent_r getrlimit
|
||||
glob grantpt hstrerror initgroups innetgr
|
||||
llseek _llseek __llseek _lseek __lseek
|
||||
_lstat __lstat lutimes
|
||||
@ -357,7 +356,7 @@ setmntent setpgid setpriv setsid setuidx
|
||||
shmget shm_open sigaction sigblock sigprocmask sigset
|
||||
_stat __stat statvfs
|
||||
strcasecmp strchr strpbrk strsignal strtol strupr sysconf sysctl sysctlbyname
|
||||
__sys_llseek syslog _telldir __telldir textdomain timegm
|
||||
__sys_llseek syslog _telldir __telldir timegm
|
||||
utimensat vsyslog _write __write __xstat
|
||||
''')
|
||||
|
||||
|
@ -19,7 +19,7 @@ conf.CHECK_HEADERS('ifaddrs.h')
|
||||
conf.CHECK_HEADERS('''crypt.h errno.h inttypes.h netdb.h signal.h sys/bswap.h
|
||||
sys/file.h sys/stropts.h sys/timeb.h sys/times.h sys/uio.h sys/un.h
|
||||
sys/utsname.h time.h timezone.h ttyname.h netinet/in.h
|
||||
netinet/in6.h netinet6/in6.h libintl.h''')
|
||||
netinet/in6.h netinet6/in6.h''')
|
||||
|
||||
conf.CHECK_HEADERS('curses.h term.h termcap.h', together=True)
|
||||
|
||||
@ -42,8 +42,6 @@ conf.CHECK_FUNCS_IN('''getnameinfo sendmsg socket getipnodebyname gethostent get
|
||||
'socket nsl',
|
||||
checklibc=True)
|
||||
|
||||
conf.CHECK_FUNCS_IN('dgettext gettext', 'intl', headers='libintl.h')
|
||||
|
||||
conf.CHECK_FUNCS('iruserok')
|
||||
|
||||
conf.CHECK_FUNCS('bswap16')
|
||||
|
Loading…
Reference in New Issue
Block a user