Problems with --disable-nls under Solaris

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems with --disable-nls under Solaris

Matthias Kurz

Hi.

I could not build the current CVS version under Solaris with
--disable-nls. Explanation and patch:

- Prevent inclusion of <libintl.h>, when ENABLE_NLS is not set.
  When ENABLE_NLS is not set, some parts of binutils are declaring dummy
  versions of bindtextdomain, texdomain etc.
  <locale.h> under Solaris includes <libintl.h>, which leads to problems,
  because the dummy definitions conflict with the definitions in libintl.h.
- Finally the dummy routines lead to a compilation error in gprof.c, because
  they generate a warning ("statement without effect", or so) and the
  compiler switch -Werror is used.

Index: binutils/bucomm.h
--- binutils/bucomm.h.orig 2005-08-16 21:35:21.000000000 +0200
+++ binutils/bucomm.h 2005-09-13 16:55:29.276456000 +0200
@@ -125,6 +125,11 @@
 # endif /* HAVE_ALLOCA_H */
 #endif
 
+#ifndef ENABLE_NLS
+# define _LIBINTL_H
+# define _LIBGETTEXT_H
+#endif
+
 #ifdef HAVE_LOCALE_H
 # include <locale.h>
 #endif
Index: gas/asintl.h
--- gas/asintl.h.orig 2005-05-05 11:12:43.000000000 +0200
+++ gas/asintl.h 2005-09-13 16:58:29.082469000 +0200
@@ -20,6 +20,11 @@
    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
    02110-1301, USA.  */
 
+#ifndef ENABLE_NLS
+# define _LIBINTL_H
+# define _LIBGETTEXT_H
+#endif
+
 #ifdef HAVE_LOCALE_H
 # include <locale.h>
 #endif
Index: gprof/gprof.c
--- gprof/gprof.c.orig 2005-04-23 19:13:31.000000000 +0200
+++ gprof/gprof.c 2005-09-13 17:13:52.242443000 +0200
@@ -189,8 +189,10 @@
 #if defined (HAVE_SETLOCALE)
   setlocale (LC_CTYPE, "");
 #endif
+#ifdef ENABLE_NLS
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
+#endif
 
   whoami = argv[0];
   xmalloc_set_program_name (whoami);
Index: ld/ld.h
--- ld/ld.h.orig 2005-06-09 04:05:46.000000000 +0200
+++ ld/ld.h 2005-09-13 17:24:03.767249000 +0200
@@ -23,6 +23,11 @@
 #ifndef LD_H
 #define LD_H
 
+#ifndef ENABLE_NLS
+# define _LIBINTL_H
+# define _LIBGETTEXT_H
+#endif
+
 #ifdef HAVE_LOCALE_H
 # include <locale.h>
 #endif


Well, perhaps omitting the inclusion of locale.h when --disable-nls is
given is probably also a solution, but i did not have the leisure to try
this.


   (mk)

--
Matthias Kurz; Fuldastr. 3; D-28199 Bremen; VOICE +49 421 53 600 47
  >> Im pr?motorischen Cortex kann jeder ein Held sein. (bdw) <<
Reply | Threaded
Open this post in threaded view
|

Re: Problems with --disable-nls under Solaris

Nick Clifton
Hi Matthias,

> - Prevent inclusion of <libintl.h>, when ENABLE_NLS is not set.
>   When ENABLE_NLS is not set, some parts of binutils are declaring dummy
>   versions of bindtextdomain, texdomain etc.
>   <locale.h> under Solaris includes <libintl.h>, which leads to problems,
>   because the dummy definitions conflict with the definitions in libintl.h.
> - Finally the dummy routines lead to a compilation error in gprof.c, because
>   they generate a warning ("statement without effect", or so) and the
>   compiler switch -Werror is used.

Thanks for reporting this problem and submitting a patch to fix it.  I
have applied your patch with one small change:  I moved the definitions
of _LIBINTL_H and _LIBGETTEXT_H to inside the block that includes
<locale.h> and I added a comment describing what was going on, like this:

#ifdef HAVE_LOCALE_H
# ifndef ENABLE_NLS
    /* The Solaris version of locale.h always includes libintl.h.  If we
have
       been configured with --disable-nls then ENABLE_NLS will not be
defined
       and the dummy definitions of bindtextdomain (et al) below will
conflict
       with the definitions in libintl.h.  So we define these values to
prevent
       the bogus inclusion of libintl.h.  */
#  define _LIBINTL_H
#  define _LIBGETTEXT_H
# endif
# include <locale.h>
#endif

I also created ChangeLog entries for your changes:

binutils/gas/ld ChangeLog
2005-09-30  Matthias Kurz  <[hidden email]>

        * bucomm.h: Prevent the inclusion of <libintl.h> from the Solaris
        version of <locale.h> when ENABLE_NLS is not defined.


gprof/ChangeLog
2005-09-30  Matthias Kurz  <[hidden email]>

        * gprof.c (main):Only invoke bindtextdomain() and textdomain() if
        ENABLE_NLS is defined.


Cheers
   Nick