Hi Po,

Po Lu <luang...@yahoo.com> writes:

> but because Gnulib's definitions are `inline', the functions provided in
> the system endian.h acquire external linkage, and are duplicated across
> every unit by which the redefinitions are included:
>
>   CCLD     libemacs.so
> /home/.../.../android-ndk-r10b/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld:
>  error: frame.o: multiple definition of 'htobe16'

My fault... I mistakenly assumed all non-glibc systems would be missing
these functions or implement them as macros.

If I am understanding correctly then I think this patch should fix it.

Can you test it for me? If it works then I can commit it and I assume
you can pull it into Emacs.

Collin

diff --git a/lib/endian.in.h b/lib/endian.in.h
index bd65ae8aab..68e79acd8b 100644
--- a/lib/endian.in.h
+++ b/lib/endian.in.h
@@ -69,8 +69,9 @@ _GL_INLINE_HEADER_BEGIN
 # define BYTE_ORDER LITTLE_ENDIAN
 #endif
 
-/* Make sure function-like macros get undefined.  */
 #if @HAVE_ENDIAN_H@
+
+/* Make sure we don't have any system definitions.  */
 # undef be16toh
 # undef be32toh
 # undef be64toh
@@ -83,6 +84,21 @@ _GL_INLINE_HEADER_BEGIN
 # undef htole16
 # undef htole32
 # undef htole64
+
+/* Define our own.  */
+# define be16toh __gl_endian_be16toh
+# define be32toh __gl_endian_be32toh
+# define be64toh __gl_endian_be64toh
+# define htobe16 __gl_endian_htobe16
+# define htobe32 __gl_endian_htobe32
+# define htobe64 __gl_endian_htobe64
+# define le16toh __gl_endian_le16toh
+# define le32toh __gl_endian_le32toh
+# define le64toh __gl_endian_le64toh
+# define htole16 __gl_endian_htole16
+# define htole32 __gl_endian_htole32
+# define htole64 __gl_endian_htole64
+
 #endif
 
 #ifdef __cplusplus

Reply via email to