Title: libintl should also check for libiconv
Type: Stage:
Components: Build Versions: Python 3.3
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: alanh, ned.deily
Priority: normal Keywords:

Created on 2013-02-18 16:00 by alanh, last changed 2021-02-03 19:12 by Jeffrey.Armstrong.

Messages (9)
msg182327 - (view) Author: Alan Hourihane (alanh) Date: 2013-02-18 16:00
The script detects libintl but can depend on libiconv.

I added this to force it and to demonstrate, but I think this is not 100% correct and should be massaged into the libintl tests.

---    2013-02-16 09:34:55.000000000 +0000
+++        2013-02-16 09:43:22.000000000 +0000
@@ -2122,6 +2122,15 @@
                                                # pthread (first!) on Linux
+# Check iconv
+AC_CHECK_LIB([iconv], [iconv_open], , [ac_found_iconf=no])
+if test "x$ac_found_iconf" = "xno"; then
+  AC_CHECK_LIB([iconv], [libiconv_open], , [ac_found_iconf=no])
+if test "x$ac_found_iconf" = "xyes"; then
+  LIBS="-liconv $LIBS"
 # check if we need libintl for locale functions
 AC_CHECK_LIB(intl, textdomain,
msg182345 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-02-18 22:52
Do you have a use case where this is needed?  As far as I know, Python itself doesn't reference libiconv directly.  libintl may but we're not building it, merely using it.  If libintl does reference it, the linker in use should try to satisfy the dependency for it.  We shouldn't have to specify the transitive closure of all dependent libraries.
msg182348 - (view) Author: Alan Hourihane (alanh) Date: 2013-02-18 23:24
Hi Yes, when Python is built as static only, on a system when no dynamic loading is available. You have to explicitly link libiconv when libintl references it.
msg182357 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2013-02-19 01:34
That helps a bit but, to be able to even test this, we would still need a specific example of a platform and a configuration where this is the case.  It's not necessary or desirable to add on most platforms, I think.
msg182368 - (view) Author: Alan Hourihane (alanh) Date: 2013-02-19 08:01
Sure this is on an Atari m68k platform called FreeMiNT.

Traditionally in configure scripts you'll see it checked as *-mint*
msg182903 - (view) Author: Jeffrey Armstrong (Jeffrey.Armstrong) * Date: 2013-02-24 22:47
Alan, I was about to file a bug as well because I'm not even getting a libintl dependency to be acknowledged under these build conditions.  What versions of gettext and GCC are you using?

Ned, not sure if it matters, but the libintl page does specify that -liconv must also be linked as it is a dependency:
msg182904 - (view) Author: Jeffrey Armstrong (Jeffrey.Armstrong) * Date: 2013-02-24 22:57
I would suggest a more straightforward patch.  My understanding is that the standard library on the m68k-atari-mint platform does not include the necessary gettext functionality.  This functionality is present in glibc, however.  A more direct test might be to see if gettext is available in the standard library.  If so, proceed.  If not, attempt to link in libintl and its dependency:

--- a/	Sat Feb 23 18:52:51 2013 +0100
+++ b/	Sun Feb 24 17:59:41 2013 -0500
@@ -2180,6 +2180,14 @@
 	[Define to 1 if libintl is needed for locale functions.])
         LIBS="-lintl $LIBS"])
+# search for gettext in either libc or libintl
+AC_CHECK_FUNC(gettext, [],
+	[AC_CHECK_LIB(intl, gettext, 
+                  [LIBS="$LIBS -lintl -liconv"],
+                  [AC_MSG_ERROR([unable to find the gettext() function])],
+                  [-liconv])
+    ])
msg187699 - (view) Author: Alan Hourihane (alanh) Date: 2013-04-24 13:43
Bumping. How does Jeffrey's patch look folks ?
msg197911 - (view) Author: Alan Hourihane (alanh) Date: 2013-09-16 15:58
This works for me...

---    2013-09-10 14:37:20.000000000 +0000
+++        2013-09-10 14:56:27.000000000 +0000
@@ -2190,7 +2190,11 @@
 AC_CHECK_LIB(intl, textdomain,
        [Define to 1 if libintl is needed for locale functions.])
-        LIBS="-lintl $LIBS"])
+        LIBS="-lintl $LIBS"],
+       [AC_SEARCH_LIBS(textdomain, intl,
+               [AC_DEFINE(WITH_LIBINTL, 1,
+               [Define to 1 if libintl is needed for locale functions.])
+               LIBS="-lintl -liconv $LIBS"], , "-liconv")])
 # checks for system dependent C++ extensions support
 case "$ac_sys_system" in
Date User Action Args
2021-02-03 19:12:12Jeffrey.Armstrongsetnosy: - Jeffrey.Armstrong
2013-09-16 15:58:13alanhsetmessages: + msg197911
2013-04-24 13:43:13alanhsetmessages: + msg187699
2013-02-24 22:57:36Jeffrey.Armstrongsetmessages: + msg182904
2013-02-24 22:47:28Jeffrey.Armstrongsetnosy: + Jeffrey.Armstrong
messages: + msg182903
2013-02-19 08:01:57alanhsetmessages: + msg182368
2013-02-19 01:34:22ned.deilysetmessages: + msg182357
2013-02-18 23:24:55alanhsetmessages: + msg182348
2013-02-18 22:52:49ned.deilysetnosy: + ned.deily
messages: + msg182345
2013-02-18 16:00:07alanhcreate