.mo are installed in /usr/lib rather than /usr/share under FreeBSD

Bug #398571 reported by dobey
50
This bug affects 8 people
Affects Status Importance Assigned to Milestone
intltool
Fix Released
High
dobey

Bug Description

intltool.m4 defaults DATADIRNAME to 'lib' when it can't link the
_nl_msg_cat_cntr function - i.e. GNU gettext.

This is a bug in the following situation:
- FreeBSD is used: unlike under GNU/Linux, gettext isn't present unless you
explicitely specify -lintl -L/usr/local/lib
- The project doesn't link with libintl/gettext directly, but uses it
indirectly as part of a framework (in my case, wxGtk/wxWidgets)

Relevant M4 code in /usr/share/aclocal/intltool.m4:

  # Set DATADIRNAME correctly if it is not set yet
  # (copied from glib-gettext.m4)
  if test -z "$DATADIRNAME"; then
    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])
  fi
  AC_SUBST(DATADIRNAME)

Steps to reproduce:
1. Install FreeBSD 6.4
2. Download http://www.freedink.org/releases/dfarc-3.2.1.tar.bz2
3. pkg_add -r wxgtk2-unicode
   pkg_add -r bzip2 # also installs libbz2
   pkg_add -r intltool
   pkg_add -r gmake
4. ./configure && gmake
5. cd po/ && gmake install
# incidentally Makefile.in.in doesn't seem to work in FreeBSD's make

Actual results:
DATADIRNAME is set to 'lib' and .mo files are installed in /usr/local/lib/

freebsd# cd po
freebsd# make install
Error expanding embedded variable.
freebsd# gmake install
/bin/sh /root/dfarc-3.2.1/autotools/install-sh -d /usr/local/lib/locale
linguas="fr pl fi "; \
        for lang in $linguas; do \
          dir=/usr/local/lib/locale/$lang/LC_MESSAGES; \
          /bin/sh /root/dfarc-3.2.1/autotools/install-sh -d $dir; \
          if test -r $lang.gmo; then \
            /usr/bin/install -c -m 644 $lang.gmo $dir/dfarc.mo; \
            echo "installing $lang.gmo as $dir/dfarc.mo"; \
          else \
            /usr/bin/install -c -m 644 ./$lang.gmo $dir/dfarc.mo; \
            echo "installing ./$lang.gmo as" \
                 "$dir/dfarc.mo"; \
          fi; \
          if test -r $lang.gmo.m; then \
            /usr/bin/install -c -m 644 $lang.gmo.m $dir/dfarc.mo.m; \
            echo "installing $lang.gmo.m as $dir/dfarc.mo.m"; \
          else \
            if test -r ./$lang.gmo.m ; then \
              /usr/bin/install -c -m 644 ./$lang.gmo.m \
                $dir/dfarc.mo.m; \
              echo "installing ./$lang.gmo.m as" \
                   "$dir/dfarc.mo.m"; \
            else \
              true; \
            fi; \
          fi; \
        done
installing fr.gmo as /usr/local/lib/locale/fr/LC_MESSAGES/dfarc.mo
installing pl.gmo as /usr/local/lib/locale/pl/LC_MESSAGES/dfarc.mo
installing fi.gmo as /usr/local/lib/locale/fi/LC_MESSAGES/dfarc.mo

Expected results:
DATADIRNAME is set to 'share' and .mo files are installed in /usr/local/share/

Does this happen every time?
Yes

Other information:
Currently the FreeBSD package is using a quick patch:

http://www.freebsd.org/cgi/cvsweb.cgi/ports/games/freedink-dfarc/files/patch-po_Makefile.in.in?rev=1.1

It would be nice to fix intltool.m4 so as to avoid this patch.

Related branches

dobey (dobey)
Changed in intltool:
assignee: nobody → Rodney Dawes (dobey)
milestone: none → 0.41.0
status: New → Triaged
dobey (dobey)
Changed in intltool:
milestone: 0.41.0 → 0.41.1
dobey (dobey)
Changed in intltool:
importance: Undecided → High
Changed in intltool:
milestone: 0.41.1 → 0.42.0
Revision history for this message
Данило Шеган (danilo) wrote :

Useful info related to Mingw and OpenBSD in duplicate bug reports as well.

Changed in intltool:
milestone: 0.50.0 → 0.51.0
Revision history for this message
elmarco (marcandre-lureau) wrote :

danilo, what do you need to get this issue fixed? There are already some patches attached in dups, but they get older.

(I also had some headache because of that bug http://lists.freedesktop.org/archives/spice-devel/2012-January/007013.html)

Revision history for this message
Pacho Ramos (pacho) wrote :

Looks like https://bugs.launchpad.net/intltool/+bug/1030541 is a duplicate of this one, can be finally solved?

Revision history for this message
dobey (dobey) wrote :

I've proposed a branch to fix this bug. If someone could test it, particularly someone on Solaris, that would be excellent.

Revision history for this message
Pacho Ramos (pacho) wrote :

I cannot test on Solaris... but it works fine and fixes the location of translations for me on Gentoo linux, would be nice if could be committed

dobey (dobey)
Changed in intltool:
status: Triaged → Fix Committed
Revision history for this message
Pacho Ramos (pacho) wrote :

When is a new release including this planned? (to know if we should backport the patch downstream or wait for next version from you)

Thanks!

Revision history for this message
Ignacio Casal Quinteiro (nacho-resa) wrote :

ping? this seems to be there still in 0.50.2...

dobey (dobey)
Changed in intltool:
status: Fix Committed → Fix Released
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.