[binutils-gdb/binutils-2_37-branch] Fix Solaris gprof build with --disable-nls
Rainer Orth
ro@sourceware.org
Wed Jul 7 11:56:41 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0316a68cc04afca2cb203485ba4c3e955e704bf7
commit 0316a68cc04afca2cb203485ba4c3e955e704bf7
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date: Wed Jul 7 13:56:21 2021 +0200
Fix Solaris gprof build with --disable-nls
gprof fails to compile on Solaris 10 and 11.3 with --disable-nls:
In file included from /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/gprof.h:33,
from /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/basic_blocks.c:24:
/usr/include/libintl.h:45:14: error: expected identifier or '(' before 'const'
45 | extern char *dcgettext(const char *, const char *, const int);
| ^~~~~~~~~
/usr/include/libintl.h:46:14: error: expected identifier or '(' before 'const'
46 | extern char *dgettext(const char *, const char *);
| ^~~~~~~~
/usr/include/libintl.h:47:14: error: expected identifier or '(' before 'const'
47 | extern char *gettext(const char *);
| ^~~~~~~
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/../bfd/sysdep.h:165:33:
error: expected identifier or '(' before 'do'
165 | # define textdomain(Domainname) do {} while (0)
| ^~
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/../bfd/sysdep.h:165:39:
error: expected identifier or '(' before 'while'
165 | # define textdomain(Domainname) do {} while (0)
| ^~~~~
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/../bfd/sysdep.h:166:46:
error: expected identifier or '(' before 'do'
166 | # define bindtextdomain(Domainname, Dirname) do {} while (0)
| ^~
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/gprof/../bfd/sysdep.h:166:52:
error: expected identifier or '(' before 'while'
166 | # define bindtextdomain(Domainname, Dirname) do {} while (0)
| ^~~~~
/usr/include/libintl.h:55:14: error: expected identifier or '(' before 'unsigned'
55 | extern char *dcngettext(const char *, const char *,
| ^~~~~~~~~~
/usr/include/libintl.h:57:14: error: expected identifier or '(' before 'unsigned'
57 | extern char *dngettext(const char *, const char *,
| ^~~~~~~~~
/usr/include/libintl.h:59:14: error: expected identifier or '(' before 'unsigned'
59 | extern char *ngettext(const char *, const char *, unsigned long int);
| ^~~~~~~~
This is a known issue already partially fixed in binutils/sysdep.h. For
gprof, the same fix needs to be applied in bfd/sysdep.h, as the
following patch does. Tested on i386-pc-solaris2.10 and
i386-pc-solaris2.11.
2021-07-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
bfd:
* sysdep.h [!ENABLE_NLS]: Prevent inclusion of <libintl.h> on
Solaris.
Diff:
---
bfd/ChangeLog | 5 +++++
bfd/sysdep.h | 11 +++++++++++
2 files changed, 16 insertions(+)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f2af3b01ef0..e4f708f9aae 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2021-07-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * sysdep.h [!ENABLE_NLS]: Prevent inclusion of <libintl.h> on
+ Solaris.
+
2021-07-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac: Check for strnlen declaration.
diff --git a/bfd/sysdep.h b/bfd/sysdep.h
index aa6b095fd05..8919e7689fd 100644
--- a/bfd/sysdep.h
+++ b/bfd/sysdep.h
@@ -126,6 +126,17 @@ extern int fseeko64 (FILE *stream, off64_t offset, int whence);
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
+#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 defintions 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>
+
#ifdef ENABLE_NLS
# include <libintl.h>
/* Note the redefinition of gettext and ngettext here to use PACKAGE.
More information about the Binutils-cvs
mailing list