build: add a dependency on lib iconv for lib intl if we are not able to find it
authorMatthieu Patou <mat@matws.net>
Sat, 11 Dec 2010 15:50:51 +0000 (18:50 +0300)
committerMatthieu Patou <mat@matws.net>
Sat, 11 Dec 2010 16:21:09 +0000 (19:21 +0300)
This is due that on some platform lib intl depend on lib iconv, failling
to provide this library cause waf to be unable to link with lib intl and
makes it think that the library doesn't exists !

lib/replace/wscript

index 8b5980758d3b06237b85771aac180f61872b6b4b..86a4bdb8d80267db87f903351dbf753d43f83bbf 100644 (file)
@@ -210,7 +210,18 @@ def configure(conf):
     conf.CHECK_FUNCS_IN('res_search', 'resolv', checklibc=True,
                         headers='netinet/in.h arpa/nameser.h resolv.h')
 
-    conf.CHECK_FUNCS_IN('gettext', 'intl', checklibc=True, headers='libintl.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
+        else:
+            conf.CHECK_FUNCS_IN('gettext', 'intl', checklibc=True, headers='libintl.h')
+
+    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)