1 AC_DEFUN([AM_ICONV_INTERNAL],
3 AC_MSG_CHECKING(for iconv name for Unicode in uint32_t)
8 void helper_BE( uint32_t * a, unsigned char ** b, unsigned char x );
11 helper_BE( uint32_t * a, unsigned char ** b, unsigned char x )
24 unsigned char * dst = ( unsigned char * )( & b );
26 /* The following sequence will result in the same value in a and b
27 * if the machine is big endian. (Four values are picked, rather than
28 * trying every possible value! This is why the test is not "if and only if".)
29 * It is only after all four steps have been completed that the two
30 * would be the same, since b is written left to right, while a is
31 * shifted before each new value.
33 helper_BE( & a, & dst, 0x01 );
34 helper_BE( & a, & dst, 0x80 );
35 helper_BE( & a, & dst, 0x04 );
36 helper_BE( & a, & dst, 0x20 );
38 return ( a == b ) ? 0 : 1;
42 UCS_4_INTERNAL=[\"UCS-4BE\"]
47 void helper_LE( uint32_t * a, unsigned char ** b, unsigned char x );
50 helper_LE( uint32_t * a, unsigned char ** b, unsigned char x )
63 unsigned char * dst = ( unsigned char * )( & b ) + sizeof( b );
65 /* The following sequence will result in the same value in a and b
66 * if the machine is big endian. (Four values are picked, rather than
67 * trying every possible value! This is why the test is not "if and only if".)
68 * It is only after all four steps have been completed that the two
69 * would be the same, since b is written left to right, while a is
70 * shifted before each new value.
72 helper_LE( & a, & dst, 0x01 );
73 helper_LE( & a, & dst, 0x80 );
74 helper_LE( & a, & dst, 0x04 );
75 helper_LE( & a, & dst, 0x20 );
77 return ( a == b ) ? 0 : 1;
81 UCS_4_INTERNAL=[\"UCS-4LE\"]
83 AC_MSG_WARN([Neither big nor little endian - hopefully, UCS-4-INTERNAL is supported anyway.])
84 UCS_4_INTERNAL=[\"UCS-4-INTERNAL\"]
87 AC_MSG_RESULT($UCS_4_INTERNAL)
88 AC_DEFINE_UNQUOTED(UCS_4_INTERNAL, $UCS_4_INTERNAL, [Name to use with iconv to refer to Unicode in uint32_t.])