intltool.m4 gets DATADIRNAME wrong for non-glibc platforms

Bug #846609 reported by kalev
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
intltool
Triaged
Medium
Unassigned

Bug Description

intltool.m4 has a AC_LANG_PROGRAM check for checking if _nl_msg_cat_cntr symbol is available. However, the check only looks in libc, and thus fails if the symbols are in an external library. In e.g. a mingw environment, the symbol is in libintl library instead.

As a quick hack, I've added LIBS="$LIBS -lintl" to intltool.m4 and it fixes the check for me. Hardcoding -lintl here isn't obviously correct. How should we handle this?

 # Set DATADIRNAME correctly if it is not set yet
 # (copied from glib-gettext.m4)
 if test -z "$DATADIRNAME"; then
+ intl_save_LIBS=$LIBS
+ LIBS="$LIBS -lintl"
   AC_LINK_IFELSE(
     [AC_LANG_PROGRAM([[]],
                      [[extern int _nl_msg_cat_cntr;
                        return _nl_msg_cat_cntr]])],
     [DATADIRNAME=share],
     [case $host in
     *-*-solaris*)
     dnl On Solaris, if bind_textdomain_codeset is in libc,
     dnl GNU format message catalog is always supported,
     dnl since both are added to the libc all together.
     dnl Hence, we'd like to go with DATADIRNAME=share
     dnl in this case.
     AC_CHECK_FUNC(bind_textdomain_codeset,
       [DATADIRNAME=share], [DATADIRNAME=lib])
     ;;
     *)
     [DATADIRNAME=lib]
     ;;
     esac])
+ LIBS=$intl_save_LIBS
 fi
 AC_SUBST(DATADIRNAME)

Revision history for this message
kalev (kalev) wrote :

Also compare to how glib-gettext.m4 sets LIBS= to the detected intl library before doing a similar check:
http://git.gnome.org/browse/glib/tree/m4macros/glib-gettext.m4#n206

Revision history for this message
Данило Шеган (danilo) wrote :

We generally try to stay synced with gettext.m4 instead, which has a similar logic.

Changed in intltool:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Antoine Jacoutot (ajacoutot-bsdfrog) wrote :

This fix could work as well for OpenBSD, but using -lintl is not enough for us, you also need -liconv.
So using this line:
LIBS="$LIBS -liconv -lintl"
would work.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.