[GRASS-dev] build without NLS broken

In r34485 there were a bunch of changes to lib/gis/gisinit.c, one of which calls G_init_locale(). However, this is not necessarily defined in locale.c. I'm not really a C guy, but this seemed to fix it for me. For reference, the build fails on an undefined reference to G_init_locale. I tried it on an Ubuntu machine and on OS X.

Cheers,

David

Index: lib/gis/gisinit.c

--- lib/gis/gisinit.c (revision 34654)
+++ lib/gis/gisinit.c (working copy)
@@ -138,7 +138,9 @@
      G_init_logging();
      G__init_window();
      G__check_for_auto_masking();
+ #if defined(HAVE_LIBINTL_H) && defined(USE_NLS)
      G_init_locale();
+ #endif
      G_init_debug();
      G_verbose();
      G_init_tempfile();

David Mahoney wrote:

In r34485 there were a bunch of changes to lib/gis/gisinit.c, one of
which calls G_init_locale(). However, this is not necessarily defined
in locale.c. I'm not really a C guy, but this seemed to fix it for
me. For reference, the build fails on an undefined reference to
G_init_locale. I tried it on an Ubuntu machine and on OS X.

Oops.

I have changed lib/gis/locale.c (r34662) so that only the code which
depends upon libintl.h is conditionalised, but G_init_locale() is
defined unconditionally. This ensures that the setlocale() calls still
occur, which is necessary to ensure that e.g. printf("%f") isn't
localised.

--
Glynn Clements <glynn@gclements.plus.com>

On Tue, Dec 2, 2008 at 5:45 AM, Glynn Clements <glynn@gclements.plus.com> wrote:

David Mahoney wrote:

In r34485 there were a bunch of changes to lib/gis/gisinit.c, one of
which calls G_init_locale(). However, this is not necessarily defined
in locale.c. I'm not really a C guy, but this seemed to fix it for
me. For reference, the build fails on an undefined reference to
G_init_locale. I tried it on an Ubuntu machine and on OS X.

Oops.

I have changed lib/gis/locale.c (r34662) so that only the code which
depends upon libintl.h is conditionalised, but G_init_locale() is
defined unconditionally. This ensures that the setlocale() calls still
occur, which is necessary to ensure that e.g. printf("%f") isn't
localised.

Does this affect 6?

Markus

Markus Neteler wrote:

>> In r34485 there were a bunch of changes to lib/gis/gisinit.c, one of
>> which calls G_init_locale(). However, this is not necessarily defined
>> in locale.c. I'm not really a C guy, but this seemed to fix it for
>> me. For reference, the build fails on an undefined reference to
>> G_init_locale. I tried it on an Ubuntu machine and on OS X.
>
> Oops.
>
> I have changed lib/gis/locale.c (r34662) so that only the code which
> depends upon libintl.h is conditionalised, but G_init_locale() is
> defined unconditionally. This ensures that the setlocale() calls still
> occur, which is necessary to ensure that e.g. printf("%f") isn't
> localised.

Does this affect 6?

r34662 fixes a bug in r34485, so r34662 should only be back-ported if
r34485 was back-ported (I presume it wasn't).

--
Glynn Clements <glynn@gclements.plus.com>