summaryrefslogtreecommitdiff
path: root/lib/replace
diff options
context:
space:
mode:
authorChristian Ambach <ambi@samba.org>2013-08-01 22:28:05 +0200
committerChristian Ambach <ambi@samba.org>2013-08-09 22:46:57 +0200
commit07b3a048724a6b41282e1f673aea5ce2c1202a5e (patch)
tree74f0fc72835969aaf34bc2a732b71df5da0874d2 /lib/replace
parenta742e87b39bed97ac59f5ec8bff9bf3cedf8b68a (diff)
downloadsamba-07b3a048724a6b41282e1f673aea5ce2c1202a5e.tar.gz
samba-07b3a048724a6b41282e1f673aea5ce2c1202a5e.tar.bz2
samba-07b3a048724a6b41282e1f673aea5ce2c1202a5e.zip
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>
Diffstat (limited to 'lib/replace')
-rw-r--r--lib/replace/wscript46
1 files changed, 36 insertions, 10 deletions
diff --git a/lib/replace/wscript b/lib/replace/wscript
index 2117f56e22..b6fb10b9b0 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -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()