blob: c8f6b3bfd2e57aa0fe2e9fcc2dea9dc6cf29bbcc [file] [log] [blame]
Emeric Vigier2f625822012-08-06 11:09:52 -04001dnl Copyright (C) 1999-2005 Open Source Telecom Corporation.
2dnl Copyright (C) 2006-2008 David Sugar, Tycho Softworks.
3dnl
4dnl This program is free software; you can redistribute it and/or modify
5dnl it under the terms of the GNU General Public License as published by
6dnl the Free Software Foundation; either version 2 of the License, or
7dnl (at your option) any later version.
8dnl
9dnl This program is distributed in the hope that it will be useful,
10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12dnl GNU General Public License for more details.
13dnl
14dnl You should have received a copy of the GNU General Public License
15dnl along with this program; if not, write to the Free Software
16dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17dnl
18dnl As a special exception to the GNU General Public License, if you
19dnl distribute this file as part of a program that contains a configuration
20dnl script generated by Autoconf, you may include it under the same
21dnl distribution terms that you use for the rest of that program.
22
23AC_DEFUN([OST_CC_ENDIAN],[
24 AC_REQUIRE([AC_CANONICAL_SYSTEM])
25 AC_REQUIRE([OST_SYS_POSIX])
26 AC_CHECK_HEADER(endian.h,[
27 AC_DEFINE(HAVE_ENDIAN_H, [1], [have endian header])
28 ],[
29 AC_CHECK_HEADER(sys/isa_defs.h,[
30 AC_DEFINE(HAVE_SYS_ISA_DEFS_H, [1], [solaris endian])
31 ],[
32 case "$target_cpu" in
33 alpha* | i?86)
34 AC_DEFINE(__BYTE_ORDER, [1234], [endian byte order])
35 ;;
36 hppa* | m68* | mips* | powerpc* | sparc*)
37 AC_DEFINE(__BYTE_ORDER, [4321])
38 ;;
39 esac
40 ])
41 ])
42 AH_BOTTOM([
43#if defined(HAVE_ENDIAN_H)
44 #include <endian.h>
45#elif defined(HAVE_SYS_ISA_DEFS_H)
46 #include <sys/isa_defs.h>
47 #ifdef _LITTLE_ENDIAN
48 #define __BYTE_ORDER 1234
49 #else
50 #define __BYTE_ORDER 4321
51 #endif
52 #if _ALIGNMENT_REQUIRED > 0
53 #define __BYTE_ALIGNMENT _MAX_ALIGNMENT
54 #else
55 #define __BYTE_ALIGNMENT 1
56 #endif
57#endif
58
59#ifndef __LITTLE_ENDIAN
60#define __LITTLE_ENDIAN 1234
61#define __BIG_ENDIAN 4321
62#endif
63
64#ifndef __BYTE_ORDER
65#define __BYTE_ORDER 1234
66#endif
67
68#ifndef __BYTE_ALIGNMENT
69#if defined(SPARC) || defined(sparc)
70#if defined(__arch64__) || defined(__sparcv9)
71#define __BYTE_ALIGNMENT 8
72#else
73#define __BYTE_ALIGNMENT 4
74#endif
75#endif
76#endif
77
78#ifndef __BYTE_ALIGNMENT
79#define __BYTE_ALIGNMENT 1
80#endif
81
82 ])
83])
84