[PATCH] Fix for Bug 9911

Christian Ambach ambi at samba.org
Mon Aug 5 15:09:14 MDT 2013


Hi list,

the attached patchset fixes Bug 9911 - Build Samba 4.0.x on AIX with IBM
XL C/C++, confirmed by the bug reporter.

Please review and push so that they can be cherry-picked for one of the
next releases.

Thanks,
Christian
-------------- next part --------------
>From 09359c1d60e528fe4a4f1233722a090d1f7d1297 Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Thu, 20 Jun 2013 18:26:04 +0200
Subject: [PATCH 1/4] waf: fix build on AIX7

the same works for AIX 5,6,7 so leave away the version specifics (as autoconf build did)

Signed-off-by: Christian Ambach <ambi at samba.org>
---
 buildtools/wafsamba/wscript | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 17aef27..d115b5f 100755
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -322,7 +322,7 @@ def configure(conf):
     else:
         conf.env.HAVE_LD_VERSION_SCRIPT = False
 
-    if sys.platform == "aix5" or sys.platform == "aix6":
+    if sys.platform.startswith('aix'):
         conf.DEFINE('_ALL_SOURCE', 1, add_to_cflags=True)
         # Might not be needed if ALL_SOURCE is defined
         # conf.DEFINE('_XOPEN_SOURCE', 600, add_to_cflags=True)
-- 
1.8.1.2


>From e812222815d2803e6ab5ca1bac317576c035e2eb Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Tue, 25 Jun 2013 18:37:35 +0200
Subject: [PATCH 2/4] waf: add --without-gettext option

Signed-off-by: Christian Ambach <ambi at samba.org>
---
 buildtools/wafsamba/wscript | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index d115b5f..fe2e515 100755
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -82,6 +82,9 @@ def set_options(opt):
                    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'])
+    opt.add_option('--without-gettext',
+                   help=("Disable use of gettext"),
+                   action="store_true", dest='disable_gettext', default=False)
 
     gr = opt.option_group('developer options')
 
-- 
1.8.1.2


>From 18e8911f887aa62dea1c81568474f47d54b2815b Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Thu, 1 Aug 2013 22:28:05 +0200
Subject: [PATCH 3/4] 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

Signed-off-by: Christian Ambach <ambi at samba.org>
---
 lib/replace/wscript                     | 36 ++++++++++++++++++++++++---------
 source3/wscript                         |  9 ++++-----
 source4/heimdal_build/wscript_configure |  4 +---
 3 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/lib/replace/wscript b/lib/replace/wscript
index 2117f56..d7aea6c 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,33 @@ 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',
+                            'intl', checklibc=True, headers='libintl.h')
+        # gettext and dgettext must exist
+        if conf.CHECK_FUNCS_IN('dgettext gettext', 'intl', checklibc=True, headers='libintl.h'):
+            # save for dependency definitions
+            conf.env.intl_libs='intl'
         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', 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)
diff --git a/source3/wscript b/source3/wscript
index 3c0145b..271314d 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -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
 ''')
 
diff --git a/source4/heimdal_build/wscript_configure b/source4/heimdal_build/wscript_configure
index 2bb465a..bed63d6 100755
--- a/source4/heimdal_build/wscript_configure
+++ b/source4/heimdal_build/wscript_configure
@@ -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')
-- 
1.8.1.2


>From a3be4dfab1866a5dc29fbd4b5d72a4aaed39b46e Mon Sep 17 00:00:00 2001
From: Christian Ambach <ambi at samba.org>
Date: Thu, 1 Aug 2013 23:00:21 +0200
Subject: [PATCH 4/4] waf: replace dependency to libintl with calculated
 dependency

depending on the result of the configure checks (and the potential
use of the --without-gettext option), the dependency on
libintl can also be libintl + libiconv or none of them

exchange the dependencies against the one stored as the result
of the configure check to make sure the binaries are linked against
the correct set of libraries

Signed-off-by: Christian Ambach <ambi at samba.org>
---
 nsswitch/wscript_build              | 2 +-
 source3/wscript_build               | 4 +++-
 source4/heimdal_build/wscript_build | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/nsswitch/wscript_build b/nsswitch/wscript_build
index a7d6489..d5ba1ac 100644
--- a/nsswitch/wscript_build
+++ b/nsswitch/wscript_build
@@ -81,7 +81,7 @@ elif (host_os.rfind('aix') > -1):
 if bld.CONFIG_SET('WITH_PAM_MODULES') and bld.CONFIG_SET('HAVE_PAM_START'):
 	bld.SAMBA_LIBRARY('pamwinbind',
 		source='pam_winbind.c',
-		deps='intl talloc wbclient winbind-client iniparser pam',
+		deps='talloc wbclient winbind-client iniparser pam ' + bld.env.intl_libs,
 		cflags='-DLOCALEDIR=\"%s/locale\"' % bld.env.DATADIR,
 		realname='pam_winbind.so',
 		install_path='${PAMMODULESDIR}'
diff --git a/source3/wscript_build b/source3/wscript_build
index f7988a6..ac11823 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -1267,7 +1267,9 @@ bld.SAMBA3_BINARY('net',
                  talloc
                  netapi
                  addns
-                 intl
+                 '''
+                 + bld.env.intl_libs +
+                 '''
                  popt_samba3
                  pdb
                  libsmb
diff --git a/source4/heimdal_build/wscript_build b/source4/heimdal_build/wscript_build
index 8ca8788..b06c149 100644
--- a/source4/heimdal_build/wscript_build
+++ b/source4/heimdal_build/wscript_build
@@ -670,7 +670,7 @@ if not bld.CONFIG_SET("USING_SYSTEM_KRB5"):
     HEIMDAL_LIBRARY('krb5', KRB5_SOURCE,
         version_script='lib/krb5/version-script.map',
                         includes='../heimdal/lib/krb5 ../heimdal/lib/asn1 ../heimdal/include',
-                deps='roken wind asn1 hx509 hcrypto intl com_err HEIMDAL_CONFIG heimbase execinfo',
+                deps='roken wind asn1 hx509 hcrypto com_err HEIMDAL_CONFIG heimbase execinfo ' + bld.env.intl_libs,
                 vnum='26.0.0',
                         )
     KRB5_PROTO_SOURCE = KRB5_SOURCE + ['lib/krb5/expand_path.c', 'lib/krb5/plugin.c', 'lib/krb5/context.c']
@@ -894,7 +894,7 @@ if not bld.CONFIG_SET('USING_SYSTEM_COM_ERR'):
     HEIMDAL_LIBRARY('com_err',
         'lib/com_err/com_err.c lib/com_err/error.c',
         includes='../heimdal/lib/com_err',
-        deps='roken intl',
+        deps='roken ' + bld.env.intl_libs,
         vnum='0.25',
         version_script='lib/com_err/version-script.map',
         )
-- 
1.8.1.2



More information about the samba-technical mailing list