[PATCH] some fixes for waf issues

Christian Ambach ambi at samba.org
Thu Dec 12 14:26:02 MST 2013


Hi list,

the attached patchset fixes some issues with waf configure
checks on AIX, as reported in Bugs 9911 and 10308.

Please review

Cheers,
Christian
-------------- next part --------------
>From 8d14e1314f67849e9813420f0993ead0903cbf30 Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Wed, 4 Dec 2013 22:50:11 +0100
Subject: [PATCH 1/4] 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 <ambi at samba.org>
---
 source3/build/charset.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/source3/build/charset.py b/source3/build/charset.py
index 44852a6..cbbb320 100644
--- a/source3/build/charset.py
+++ b/source3/build/charset.py
@@ -33,8 +33,14 @@ def CHECK_SAMBA3_CHARSET(conf, crossbuild=False):
 	    default_unix_charset="UTF-8"
             # TODO: this used to warn about the set charset on cross builds
 
-        conf.DEFINE('DEFAULT_DOS_CHARSET', default_dos_charset, quote=True)
-        conf.DEFINE('DEFAULT_UNIX_CHARSET', default_unix_charset, quote=True)
+        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');
+            conf.DEFINE('DEFAULT_DOS_CHARSET', "ASCII", quote=True)
+            conf.DEFINE('DEFAULT_UNIX_CHARSET', "UTF8", quote=True)
+        else:
+            conf.DEFINE('DEFAULT_DOS_CHARSET', default_dos_charset, quote=True)
+            conf.DEFINE('DEFAULT_UNIX_CHARSET', default_unix_charset, quote=True)
 
     else:
         conf.DEFINE('DEFAULT_DOS_CHARSET', "ASCII", quote=True)
-- 
1.8.1.2


>From a310d6fbdca7861c07d0bab8d4840ef0ff3e6095 Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Thu, 21 Nov 2013 23:02:38 +0100
Subject: [PATCH 2/4] waf:lib/replace fix up libintl related checks

checklibc=True and link=True gives back false-positives
on AIX for gettext/dgettext and so the build fails later when
libintl.h is not available

So let's check this very pedantically

BUG: https://bugzilla.samba.org/show_bug.cgi?id=9911

Signed-off-by: Christian Ambach <ambi at samba.org>
---
 lib/replace/wscript | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/replace/wscript b/lib/replace/wscript
index b6fb10b..3e43366 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -369,26 +369,28 @@ removeea setea
         conf.CHECK_LIB('intl')
         # *textdomain functions are not strictly necessary
         conf.CHECK_FUNCS_IN('bindtextdomain textdomain bind_textdomain_codeset',
-                            '', checklibc=True, headers='libintl.h')
+                            '', checklibc=False, link=False, 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'):
+        if conf.CHECK_FUNCS_IN('dgettext gettext', '', checklibc=False,
+                               link=False, 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'):
+        elif conf.CHECK_FUNCS_IN('dgettext gettext', 'intl', checklibc=False,
+                                 link=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')
+                            'intl', checklibc=False, link=False, headers='libintl.h')
         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'];
             conf.env['EXTRA_LDFLAGS'].extend("-liconv")
             conf.CHECK_FUNCS_IN('dgettext gettext bindtextdomain textdomain bind_textdomain_codeset',
-                                'intl', checklibc=False, headers='libintl.h')
+                                'intl', checklibc=False, link=False, headers='libintl.h')
             conf.env['EXTRA_LDFLAGS'] = oldflags
             if conf.env['HAVE_GETTEXT'] and conf.env['HAVE_DGETTEXT']:
                 # save for dependency definitions
-- 
1.8.1.2


>From 8208249ce57ffb5ed07bb133953ab124bf51fd00 Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Thu, 12 Dec 2013 22:10:36 +0100
Subject: [PATCH 3/4] 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 <ambi at samba.org>
---
 lib/replace/wscript | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/replace/wscript b/lib/replace/wscript
index 3e43366..e0728f9 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -365,6 +365,10 @@ removeea setea
 
     conf.env.intl_libs=''
     if not Options.options.disable_gettext:
+        # any extra path given to look at?
+        if Options.options.gettext_location:
+           conf.env['CFLAGS'].extend("-I%s" % Options.options.gettext_location);
+           conf.env['LDFLAGS'].extend("-L%s" % Options.options.gettext_location);
         conf.CHECK_HEADERS('libintl.h')
         conf.CHECK_LIB('intl')
         # *textdomain functions are not strictly necessary
-- 
1.8.1.2


>From ba28292b0185e008db886a3125d91cacb43fb758 Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Thu, 12 Dec 2013 22:12:07 +0100
Subject: [PATCH 4/4] waf:lib/replace change detection of gettext

convert this to an automatic check: if no option is given, try to find gettext
and use it if found
if user has specified --with-gettext, then bail out it it could not be found
in case of --without-gettext, skip all gettext related configure checks

Bug:ihttps://bugzilla.samba.org/show_bug.cgi?id=9911
Signed-off-by: Christian Ambach <ambi at samba.org>
---
 lib/replace/wscript | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/replace/wscript b/lib/replace/wscript
index e0728f9..3ca1eb0 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -363,6 +363,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:
         # any extra path given to look at?
@@ -399,10 +400,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=</path/to/gettext> or ' +
-                           '--without-gettext to build without''')
+
+    # did the user insist on gettext (--with-gettext)?
+    if Options.options.gettext_location and not conf.env['HAVE_GETTEXT'] and 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.1.2



More information about the samba-technical mailing list