From 3385103f60be439e95c6b02d3c176bcc615b6caa Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Wed, 4 Dec 2013 22:50:11 +0100 Subject: [PATCH 1/8] waf: improve iconv checks there are broken iconv implementations around (e.g. on AIX) that you can compile against but that refuse any mapping requests make sure we do the same as the autoconf-based build did and fall back to our own code Bug: https://bugzilla.samba.org/show_bug.cgi?id=10308 Signed-off-by: Christian Ambach Reviewed-by: Andrew Bartlett (cherry picked from commit 15b2d1a658b3fc428c20a7a461168f464951f40f) --- source3/build/charset.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source3/build/charset.py b/source3/build/charset.py index 44852a6..0033557 100644 --- a/source3/build/charset.py +++ b/source3/build/charset.py @@ -33,6 +33,12 @@ def CHECK_SAMBA3_CHARSET(conf, crossbuild=False): default_unix_charset="UTF-8" # TODO: this used to warn about the set charset on cross builds + if default_dos_charset is False or default_unix_charset is False: + # we found iconv, but it failed to convert anything (e.g. on AIX) + conf.undefine('HAVE_NATIVE_ICONV'); + default_dos_charset = "ASCII" + default_unix_charset = "UTF-8" + conf.DEFINE('DEFAULT_DOS_CHARSET', default_dos_charset, quote=True) conf.DEFINE('DEFAULT_UNIX_CHARSET', default_unix_charset, quote=True) -- 1.8.3.2 From 63a07a74d45dfb2e0ad462b6e5989483f787cd9a Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Thu, 2 Jan 2014 23:28:20 +0100 Subject: [PATCH 2/8] waf:lib/replace correct detection of libiconv add -liconv as a complete command line argument, not all characters on their own Bug: https://bugzilla.samba.org/show_bug.cgi?id=9911 Signed-off-by: Christian Ambach Reviewed-by: Andrew Bartlett (cherry picked from commit 1a42ff7d8db63b26e2beb43268a1c4664723358e) --- lib/replace/wscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/replace/wscript b/lib/replace/wscript index e4d8b6b..0288905 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -369,7 +369,7 @@ removeea setea # 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.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 -- 1.8.3.2 From e92cd67278b53784cc3f0160f6a7a3e78c4ab099 Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Thu, 2 Jan 2014 22:23:16 +0100 Subject: [PATCH 3/8] waf:lib/replace fix up libintl related checks on a default installation of AIX, libintl.a exists but libintl.h does not So check for the declarations of those functions as well to make sure that the build works. Bug: https://bugzilla.samba.org/show_bug.cgi?id=9911 Signed-off-by: Christian Ambach Reviewed-by: Andrew Bartlett (cherry picked from commit df6ddcfbfcd33274c1b768ce26829b0ad9278cd0) --- lib/replace/wscript | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/replace/wscript b/lib/replace/wscript index 0288905..c622550 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -350,6 +350,7 @@ removeea setea if not Options.options.disable_gettext: conf.CHECK_HEADERS('libintl.h') conf.CHECK_LIB('intl') + conf.CHECK_DECLS('dgettext gettext bindtextdomain textdomain bind_textdomain_codeset', headers="libintl.h") # *textdomain functions are not strictly necessary conf.CHECK_FUNCS_IN('bindtextdomain textdomain bind_textdomain_codeset', '', checklibc=True, headers='libintl.h') -- 1.8.3.2 From 69621280a80cc31d19c3e202de0030dd903b2efe Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Thu, 12 Dec 2013 22:12:07 +0100 Subject: [PATCH 4/8] waf:lib/replace change detection of gettext convert this to an automatic check: if no option is given, try to find gettext and if found, use it if user has specified --with-gettext, then bail out if it could not be found in case of --without-gettext, skip all gettext related configure checks Bug: https://bugzilla.samba.org/show_bug.cgi?id=9911 Signed-off-by: Christian Ambach Reviewed-by: Andrew Bartlett (cherry picked from commit a83f491810d34cc8b6eb4b0f40bbbb1440e0f84d) --- buildtools/wafsamba/wscript | 3 +-- lib/replace/wscript | 9 +++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript index fe2e515..7984227 100755 --- a/buildtools/wafsamba/wscript +++ b/buildtools/wafsamba/wscript @@ -80,8 +80,7 @@ def set_options(opt): match = ['Checking for library iconv', 'Checking for iconv_open', 'Checking for header iconv.h']) opt.add_option('--with-gettext', help='additional directory to search for gettext', - action='store', dest='gettext_location', default='/usr/local', - match = ['Checking for library intl', 'Checking for header libintl.h']) + action='store', dest='gettext_location', default='None') opt.add_option('--without-gettext', help=("Disable use of gettext"), action="store_true", dest='disable_gettext', default=False) diff --git a/lib/replace/wscript b/lib/replace/wscript index c622550..9372f9b 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -346,6 +346,7 @@ removeea setea headers='netinet/in.h arpa/nameser.h resolv.h') + # try to find libintl (if --without-gettext is not given) conf.env.intl_libs='' if not Options.options.disable_gettext: conf.CHECK_HEADERS('libintl.h') @@ -377,10 +378,10 @@ removeea setea 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= or ' + - '--without-gettext to build without''') + + # did the user insist on gettext (--with-gettext)? + if Options.options.gettext_location != 'None' and (not conf.env['HAVE_GETTEXT'] or not conf.env['HAVE_DGETTEXT']): + conf.fatal('library gettext not found at specified location') conf.CHECK_FUNCS_IN('pthread_create', 'pthread', checklibc=True, headers='pthread.h') -- 1.8.3.2 From c2a04add1900d3395c4a83e79e9e679a3ebfac62 Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Thu, 12 Dec 2013 22:10:36 +0100 Subject: [PATCH 5/8] waf:lib/replace fix gettext detection if the user has specified a path for gettext, add it to CFLAGS and LDFLAGS so we can find it during configure and build Bug: https://bugzilla.samba.org/show_bug.cgi?id=9911 Signed-off-by: Christian Ambach Reviewed-by: Andrew Bartlett (cherry picked from commit 31db0c8acdd68f396417e1f6504a91a40295bc89) --- lib/replace/wscript | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/replace/wscript b/lib/replace/wscript index 9372f9b..ad9669d 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -349,6 +349,13 @@ removeea setea # try to find libintl (if --without-gettext is not given) conf.env.intl_libs='' if not Options.options.disable_gettext: + # any extra path given to look at? + if not Options.options.gettext_location == 'None': + conf.env['CFLAGS'].extend(["-I%s" % Options.options.gettext_location]); + conf.env['LDFLAGS'].extend(["-L%s" % Options.options.gettext_location]); + else: + conf.env['CFLAGS'].extend(["-I/usr/local"]); + conf.env['LDFLAGS'].extend(["-L/usr/local"]); conf.CHECK_HEADERS('libintl.h') conf.CHECK_LIB('intl') conf.CHECK_DECLS('dgettext gettext bindtextdomain textdomain bind_textdomain_codeset', headers="libintl.h") -- 1.8.3.2 From aa7a57c4321eb2230d6b18d0641eb95c0f020299 Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Thu, 25 Jul 2013 19:41:02 +0200 Subject: [PATCH 6/8] waf:lib/replace gettext configure checks Make sure we only try to work with gettext if we found the prototypes and were able to link Bug: https://bugzilla.samba.org/show_bug.cgi?id=9911 Signed-off-by: Christian Ambach Reviewed-by: Andrew Bartlett Autobuild-User(master): Christian Ambach Autobuild-Date(master): Fri Jan 17 19:30:33 CET 2014 on sn-devel-104 (cherry picked from commit da891e2101c568d2f0b9a2bda78702826ea68f3c) --- lib/replace/wscript | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/replace/wscript b/lib/replace/wscript index ad9669d..0dc85ac 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -386,6 +386,15 @@ removeea setea # save for dependency definitions conf.env.intl_libs='iconv intl' + # did we find both prototypes and a library to link against? + # if not, unset the detected values (see Bug #9911) + if not (conf.env['HAVE_GETTEXT'] and conf.env['HAVE_DECL_GETTEXT']): + conf.undefine('HAVE_GETTEXT') + conf.undefine('HAVE_DECL_GETTEXT') + if not (conf.env['HAVE_DGETTEXT'] and conf.env['HAVE_DECL_DGETTEXT']): + conf.undefine('HAVE_DGETTEXT') + conf.undefine('HAVE_DECL_DGETTEXT') + # did the user insist on gettext (--with-gettext)? if Options.options.gettext_location != 'None' and (not conf.env['HAVE_GETTEXT'] or not conf.env['HAVE_DGETTEXT']): conf.fatal('library gettext not found at specified location') -- 1.8.3.2 From 7bcc91a6f94320838045cdc3e06e875d5d36cfab Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Wed, 29 Jan 2014 20:48:38 +0100 Subject: [PATCH 7/8] waf:lib/replace fix iconv checks on HP/UX we need to copy away the list of LDFLAGS to be tried before modifying it instead of just creating a new reference and then continuing with a modified list while it should have been reset back to the original value Bug: https://bugzilla.samba.org/show_bug.cgi?id=9911 Signed-off-by: Christian Ambach Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Thu Feb 13 02:01:03 CET 2014 on sn-devel-104 (cherry picked from commit 6a7c420a79cc1258528f152f4de9a0608767729f) --- lib/replace/wscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/replace/wscript b/lib/replace/wscript index 0dc85ac..61a25ec 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -377,7 +377,7 @@ removeea setea else: # 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']; + oldflags = list(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') -- 1.8.3.2 From 47976e64703077360401e9904db2435b10a2c62c Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Wed, 19 Feb 2014 22:17:01 +0100 Subject: [PATCH 8/8] heimdal_build: only enable libintl functions if everything was found do not rely on intl.h being available but also on the functions being usable This should fix the build on HP-UX Bug: https://bugzilla.samba.org/show_bug.cgi?id=9911 Signed-off-by: Christian Ambach Change-Id: I5dd88d2d5216b778624778455cca99b32d0be58f Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Thu Feb 20 01:28:24 CET 2014 on sn-devel-104 (cherry picked from commit 8f0d06fa5e654f647664727db6f12901579ec2c7) --- source4/heimdal_build/config.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source4/heimdal_build/config.h b/source4/heimdal_build/config.h index bd5a1b8..2d113ae 100644 --- a/source4/heimdal_build/config.h +++ b/source4/heimdal_build/config.h @@ -41,7 +41,8 @@ #endif /*Workaround for heimdal define vs samba define*/ -#ifdef HAVE_LIBINTL_H +#if defined(HAVE_LIBINTL_H) && defined(HAVE_BINDTEXTDOMAIN) &&\ + defined(HAVE_TEXTDOMAIN) #define LIBINTL #endif -- 1.8.3.2