Subject: syntax error? in tools/compat/configure.ac
To: None <tech-toolchain@NetBSD.org>
From: Tetsuya Isaki <isaki@par.odn.ne.jp>
List: tech-toolchain
Date: 02/05/2005 14:55:05
I'm trying to build netbsd-2-0 on OpenBSD/i386-3.6.
tools/compat/configure.ac seems syntax error.
and htobe16()-series are often defined as macros,
so AC_CHECK_FUNCS returns 'no'.  I think that
compat_defs.h also has to be corrected.

I'm not sure whether this solution is good or not.
Please correct it.

Thanks in advance.

# By the way, building on OpenBSD needs more fixes..
---
Tetsuya ISAKI <isaki@par.odn.ne.jp>

RCS file: /cvsroot/src/tools/compat/configure.ac,v
retrieving revision 1.49
diff -u -r1.49 configure.ac
--- configure.ac	13 Jan 2005 00:52:40 -0000	1.49
+++ configure.ac	5 Feb 2005 04:44:48 -0000
@@ -121,13 +121,9 @@
 	strsuftoll strtoll \
 	user_from_uid vasprintf vasnprintf vsnprintf)
 
-AC_CHECK_FUNCS([htobe16, htobe32, htobe64, htole16, htole32, htole64, be16toh, be32toh, be64toh, le16toh, le32toh, le64toh],,, [
-#include <sys/types.h>
-])
+AC_CHECK_FUNCS(htobe16 htobe32 htobe64 htole16 htole32 htole64 be16toh be32toh be64toh le16toh le32toh le64toh)
 
-AC_CHECK_FUNCS([bswap16, bswap32, bswap64],,, [
-#include <machine/bswap.h>
-])
+AC_CHECK_FUNCS(bswap16 bswap32 bswap64)
 
 AC_CHECK_FUNCS([fstatvfs],,, [
 #include <sys/statvfs.h>
--- compat_defs.h.ORG	Sat Jun 26 09:37:55 2004
+++ compat_defs.h	Fri Feb  4 15:30:30 2005
@@ -527,60 +527,60 @@
 /* <sys/endian.h> */
 
 #if WORDS_BIGENDIAN
-#if !HAVE_HTOBE16
+#if !defined(HAVE_HTOBE16) && !defined(htobe16)
 #define htobe16(x)	(x)
 #endif
-#if !HAVE_HTOBE32
+#if !defined(HAVE_HTOBE32) && !defined(htobe32)
 #define htobe32(x)	(x)
 #endif
-#if !HAVE_HTOBE64
+#if !defined(HAVE_HTOBE64) && !defined(htobe64)
 #define htobe64(x)	(x)
 #endif
-#if !HAVE_HTOLE16
+#if !defined(HAVE_HTOLE16) && !defined(htole16)
 #define htole16(x)	bswap16((u_int16_t)(x))
 #endif
-#if !HAVE_HTOLE32
+#if !defined(HAVE_HTOLE32) && !defined(htole32)
 #define htole32(x)	bswap32((u_int32_t)(x))
 #endif
-#if !HAVE_HTOLE64
+#if !defined(HAVE_HTOLE64) && !defined(htole64)
 #define htole64(x)	bswap64((u_int64_t)(x))
 #endif
 #else
-#if !HAVE_HTOBE16
+#if !defined(HAVE_HTOBE16) && !defined(htobe16)
 #define htobe16(x)	bswap16((u_int16_t)(x))
 #endif
-#if !HAVE_HTOBE32
+#if !defined(HAVE_HTOBE32) && !defined(htobe32)
 #define htobe32(x)	bswap32((u_int32_t)(x))
 #endif
-#if !HAVE_HTOBE64
+#if !defined(HAVE_HTOBE64) && !defined(htobe64)
 #define htobe64(x)	bswap64((u_int64_t)(x))
 #endif
-#if !HAVE_HTOLE16
+#if !defined(HAVE_HTOLE16) && !defined(htole16)
 #define htole16(x)	(x)
 #endif
-#if !HAVE_HTOLE32
+#if !defined(HAVE_HTOLE32) && !defined(htole32)
 #define htole32(x)	(x)
 #endif
-#if !HAVE_HTOLE64
+#if !defined(HAVE_HTOLE64) && !defined(htole64)
 #define htole64(x)	(x)
 #endif
 #endif
-#if !HAVE_BE16TOH
+#if !defined(HAVE_BE16TOH) && !defined(be16toh)
 #define be16toh(x)	htobe16(x)
 #endif
-#if !HAVE_BE32TOH
+#if !defined(HAVE_BE32TOH) && !defined(be32toh)
 #define be32toh(x)	htobe32(x)
 #endif
-#if !HAVE_BE64TOH
+#if !defined(HAVE_BE64TOH) && !defined(be64toh)
 #define be64toh(x)	htobe64(x)
 #endif
-#if !HAVE_LE16TOH
+#if !defined(HAVE_LE16TOH) && !defined(le16toh)
 #define le16toh(x)	htole16(x)
 #endif
-#if !HAVE_LE32TOH
+#if !defined(HAVE_LE32TOH) && !defined(le32toh)
 #define le32toh(x)	htole32(x)
 #endif
-#if !HAVE_LE64TOH
+#if !defined(HAVE_LE64TOH) && !defined(le64toh)
 #define le64toh(x)	htole64(x)
 #endif