1/*
2 * Copyright © 2006 Keith Packard
3 * Copyright © 2010 Behdad Esfahbod
4 *
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of the author(s) not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission.  The authors make no
12 * representations about the suitability of this software for any purpose.  It
13 * is provided "as is" without express or implied warranty.
14 *
15 * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
22 */
23#ifndef _FCARCH_H_
24#define _FCARCH_H_
25
26#ifdef HAVE_CONFIG_H
27#include <config.h>
28#endif
29
30/*
31 * Each unique machine architecture needs an entry in this file
32 * So far the differences boil down to: endianness, 32 vs 64 bit pointers,
33 * and on 32bit ones, whether double is aligned to one word or two words.
34 * Those result in the 6 formats listed below.
35 *
36 * If any of the assertion errors in fcarch.c fail, you need to add a new
37 * architecture.  Contact the fontconfig mailing list in that case.
38 *
39 * name		endianness	pointer-size	double-alignment
40 *
41 * le32d4	4321		4		4
42 * le32d8	4321		4		8
43 * le64		4321		8		8
44 * be32d4	1234		4		4
45 * be32d8	1234		4		8
46 * be64		1234		8		8
47 */
48
49#if defined(__DARWIN_BYTE_ORDER) && __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
50# define FC_ARCH_ENDIAN "le"
51#elif defined(__DARWIN_BYTE_ORDER) && __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN
52# define FC_ARCH_ENDIAN "be"
53#elif defined(__DARWIN_BYTE_ORDER) && __DARWIN_BYTE_ORDER == __DARWIN_PDP_ENDIAN
54# define FC_ARCH_ENDIAN "pe"
55#elif defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN
56# define FC_ARCH_ENDIAN "be"
57#else
58# define FC_ARCH_ENDIAN "le"
59#endif
60
61#if SIZEOF_VOID_P == 4
62# if ALIGNOF_DOUBLE == 4
63#  define FC_ARCH_SIZE_ALIGN "32d4"
64# else /* ALIGNOF_DOUBLE != 4 */
65#  define FC_ARCH_SIZE_ALIGN "32d8"
66# endif
67#else /* SIZEOF_VOID_P != 4 */
68# define FC_ARCH_SIZE_ALIGN "64"
69#endif
70
71/* config.h might override this */
72#ifndef FC_ARCHITECTURE
73# define FC_ARCHITECTURE FC_ARCH_ENDIAN FC_ARCH_SIZE_ALIGN
74#endif
75
76#endif /* _FCARCH_H_ */
77