007-endianness-check.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. --- busybox-1.17.2/include/platform.h~ Sat Nov 20 18:16:57 2010
  2. +++ busybox-1.17.2/include/platform.h Sat Nov 20 18:19:34 2010
  3. @@ -152,29 +152,40 @@
  4. #if defined(__digital__) && defined(__unix__)
  5. # include <sex.h>
  6. -# define __BIG_ENDIAN__ (BYTE_ORDER == BIG_ENDIAN)
  7. -# define __BYTE_ORDER BYTE_ORDER
  8. -#elif defined __FreeBSD__
  9. +#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
  10. + || defined(__APPLE__)
  11. +# include <sys/time.h>
  12. # include <sys/resource.h> /* rlimit */
  13. # include <machine/endian.h>
  14. # define bswap_64 __bswap64
  15. # define bswap_32 __bswap32
  16. # define bswap_16 __bswap16
  17. -# define __BIG_ENDIAN__ (_BYTE_ORDER == _BIG_ENDIAN)
  18. -#elif !defined __APPLE__
  19. +#else
  20. # include <byteswap.h>
  21. # include <endian.h>
  22. #endif
  23. -#if defined(__BIG_ENDIAN__) && __BIG_ENDIAN__
  24. +#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
  25. # define BB_BIG_ENDIAN 1
  26. # define BB_LITTLE_ENDIAN 0
  27. -#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
  28. +#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
  29. +# define BB_BIG_ENDIAN 0
  30. +# define BB_LITTLE_ENDIAN 1
  31. +#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _BIG_ENDIAN
  32. # define BB_BIG_ENDIAN 1
  33. # define BB_LITTLE_ENDIAN 0
  34. -#elif (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || defined(__386__)
  35. +#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _LITTLE_ENDIAN
  36. # define BB_BIG_ENDIAN 0
  37. # define BB_LITTLE_ENDIAN 1
  38. +#elif defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
  39. +# define BB_BIG_ENDIAN 1
  40. +# define BB_LITTLE_ENDIAN 0
  41. +#elif defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN
  42. +# define BB_BIG_ENDIAN 0
  43. +# define BB_LITTLE_ENDIAN 1
  44. +#elif defined(__386__)
  45. +# define BB_BIG_ENDIAN 0
  46. +# define BB_LITTLE_ENDIAN 1
  47. #else
  48. # error "Can't determine endianness"
  49. #endif
  50. @@ -230,7 +241,7 @@ typedef uint32_t bb__aliased_uint32_t FI
  51. /* ---- Compiler dependent settings ------------------------- */
  52. #if (defined __digital__ && defined __unix__) \
  53. - || defined __APPLE__ || defined __FreeBSD__
  54. + || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
  55. # undef HAVE_MNTENT_H
  56. # undef HAVE_SYS_STATFS_H
  57. #else
  58. --- busybox-1.17.2/include/libbb.h~ Mon Aug 23 00:46:38 2010
  59. +++ busybox-1.17.2/include/libbb.h Sat Nov 20 18:21:12 2010
  60. @@ -70,7 +70,7 @@
  61. # include <shadow.h>
  62. # endif
  63. #endif
  64. -#if defined __FreeBSD__
  65. +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
  66. # include <netinet/in.h>
  67. # include <arpa/inet.h>
  68. #elif defined __APPLE__