cd ${ORIG_DIR}
echo 'Replacing <sys/byteorder.h>'
+if [ \! -d $LIB/sys ]; then
+ mkdir $LIB/sys
+fi
rm -f ${LIB}/sys/byteorder.h
cat <<'__EOF__' >${LIB}/sys/byteorder.h
#ifndef _SYS_BYTEORDER_H
#error You lose! This file is only useful with GNU compilers.
#endif
+#ifndef __BYTE_ORDER__
+/* Byte order defines. These are as defined on UnixWare 1.1, but with
+ double underscores added at the front and back. */
+#define __LITTLE_ENDIAN__ 1234
+#define __BIG_ENDIAN__ 4321
+#define __PDP_ENDIAN__ 3412
+#endif
+
#ifdef __GNUC__
#define __STATIC static
#else
#if defined (__i386__)
+#ifndef __BYTE_ORDER__
+#define __BYTE_ORDER__ __LITTLE_ENDIAN__
+#endif
+
/* Convert a host long to a network long. */
/* We must use a new-style function definition, so that this will also
|| defined (__ns32k__) || defined (__vax__) \
|| defined (__spur__) || defined (__arm__))
+#ifndef __BYTE_ORDER__
+#define __BYTE_ORDER__ __LITTLE_ENDIAN__
+#endif
+
/* For other little-endian machines, using C code is just as efficient as
using assembly code. */
#else /* must be a big-endian machine */
+#ifndef __BYTE_ORDER__
+#define __BYTE_ORDER__ __BIG_ENDIAN__
+#endif
+
/* Convert a host long to a network long. */
__STATIC __inline__ unsigned long
#undef __STATIC
+__EOF__
+
+if [ -r ${INPUT}/sys/byteorder.h ]; then
+ if grep BYTE_ORDER ${INPUT}/sys/byteorder.h >/dev/null 2>/dev/null; then
+ cat <<'__EOF__' >>${LIB}/sys/byteorder.h
+#ifndef BYTE_ORDER
+#define LITTLE_ENDIAN __LITTLE_ENDIAN__
+#define BIG_ENDIAN __BIG_ENDIAN__
+#define PDP_ENDIAN __PDP_ENDIAN__
+#define BYTE_ORDER __BYTE_ORDER__
+#endif
+
+__EOF__
+ fi
+fi
+
+cat <<'__EOF__' >>${LIB}/sys/byteorder.h
#endif /* !defined (_SYS_BYTEORDER_H) */
__EOF__