]> git.wh0rd.org - fontconfig.git/commitdiff
Make fc-arch stuff cross-compiling-safe
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 28 Dec 2010 06:59:19 +0000 (00:59 -0600)
committerBehdad Esfahbod <behdad@behdad.org>
Tue, 28 Dec 2010 07:22:34 +0000 (01:22 -0600)
Fixes:
Bug 32679 - fontconfig-2.8.0 does not cross compile
Bug 25462 - Cross-compilation doesn't work

12 files changed:
Makefile.am
configure.in
fc-arch/Makefile.am [deleted file]
fc-arch/fc-arch.c [deleted file]
fc-arch/fcarch.tmpl.h [deleted file]
fc-cache/fc-cache.c
fc-cat/fc-cat.c
src/Makefile.am
src/fcarch.c [new file with mode: 0644]
src/fcarch.h [new file with mode: 0644]
src/fccache.c
src/fcint.h

index ce365058712a34fc138ff61a40e6850b82aea880..7931717a25320e4bf674416d013cbfdd01821ffd 100644 (file)
@@ -22,7 +22,7 @@
 #  PERFORMANCE OF THIS SOFTWARE.
 
 DOCSRC=@DOCSRC@
-SUBDIRS=fontconfig fc-case fc-lang fc-glyphname fc-arch src \
+SUBDIRS=fontconfig fc-case fc-lang fc-glyphname src \
        fc-cache fc-cat fc-list fc-match fc-pattern fc-query fc-scan \
        conf.d $(DOCSRC) test
         
index 0a7b1b0d8b7ae8ebb031b210eec260acfd98dca0..5d92b5f98da55059f2e3e23191409a8c8519d258 100644 (file)
@@ -56,7 +56,7 @@ AC_SUBST(LIBT_CURRENT_MINUS_AGE)
 
 dnl ==========================================================================
 
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS(config.h)
 
 AC_PROG_CC
 AC_PROG_INSTALL
@@ -98,59 +98,12 @@ AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
 
 dnl ==========================================================================
 
-# Setup for compiling build tools (fc-glyphname, etc)
-AC_MSG_CHECKING([for a C compiler for build tools])
-if test $cross_compiling = yes; then
-  AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
-else
-  CC_FOR_BUILD=$CC
-fi
-AC_MSG_RESULT([$CC_FOR_BUILD])
-AC_SUBST(CC_FOR_BUILD)
-
-AC_MSG_CHECKING([for suffix of executable build tools])
-if test $cross_compiling = yes; then
-  cat >conftest.c <<\_______EOF
-int
-main ()
-{
-  exit (0);
-}
-_______EOF
-  for i in .exe ""; do
-    compile="$CC_FOR_BUILD conftest.c -o conftest$i"
-    if AC_TRY_EVAL(compile); then
-      if (./conftest) 2>&AC_FD_CC; then
-       EXEEXT_FOR_BUILD=$i
-       break
-      fi
-    fi
-  done
-  rm -f conftest*
-  if test "${EXEEXT_FOR_BUILD+set}" != set; then
-    AC_MSG_ERROR([Cannot determine suffix of executable build tools])
-  fi
-else
-  EXEEXT_FOR_BUILD=$EXEEXT
-fi
-AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
-AC_SUBST(EXEEXT_FOR_BUILD)
-
-dnl ==========================================================================
-
 AC_ARG_WITH(arch,      [  --with-arch=ARCH      Force architecture to ARCH], arch="$withval", arch=auto)
 
-if test $cross_compiling = yes; then
-       case "$arch" in
-       auto)
-               AC_MSG_ERROR([Cannot autodetect architecture in cross compile environment]
-                            [Use --with-arch=ARCH to specify architecture])
-               ;;
-       esac
+if test "x$arch" != xauto; then
+       AC_DEFINE_UNQUOTED([FC_ARCHITECTURE], "$arch", [Architecture prefix to use for cache file names])
 fi
 
-ARCHITECTURE=$arch
-AC_SUBST(ARCHITECTURE)
 
 dnl ==========================================================================
 
@@ -529,13 +482,20 @@ fi
 AC_SUBST(DOCSRC)
 AC_SUBST(DOCMAN3)
 
+
+dnl Figure out what cache format suffix to use for this architecture
+AC_C_BIGENDIAN
+AC_CHECK_SIZEOF([void *])
+AC_CHECK_ALIGNOF([double])
+
+
+
 AC_OUTPUT([
-Makefile 
+Makefile
 fontconfig/Makefile
 fc-lang/Makefile
 fc-glyphname/Makefile
 fc-case/Makefile
-fc-arch/Makefile
 src/Makefile
 conf.d/Makefile
 fc-cache/Makefile
diff --git a/fc-arch/Makefile.am b/fc-arch/Makefile.am
deleted file mode 100644 (file)
index b1ecbf4..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# $Id $
-#
-# Copyright © 2003 Keith Packard
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of the author(s) not be used in
-# advertising or publicity pertaining to distribution of the software without
-# specific, written prior permission.  The authors make no
-# representations about the suitability of this software for any purpose.  It
-# is provided "as is" without express or implied warranty.
-#
-# THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-# EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-#
-
-CC = @CC_FOR_BUILD@
-EXEEXT = @EXEEXT_FOR_BUILD@
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-
-INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS)
-
-TMPL=fcarch.tmpl.h
-STMPL=${top_srcdir}/fc-arch/fcarch.tmpl.h
-TARG=fcarch.h
-
-ARCHITECTURE=@ARCHITECTURE@
-.PRECIOUS: $(TARG)
-
-noinst_PROGRAMS=fc-arch
-
-EXTRA_DIST=$(TMPL)
-
-$(TARG):fc-arch${EXEEXT} $(STMPL) ${top_srcdir}/src/fcint.h ../config.h
-       $(AM_V_GEN) $(RM) $(TARG); \
-       ./fc-arch${EXEEXT} $(ARCHITECTURE) < $(STMPL) > $(TARG).tmp && \
-       mv $(TARG).tmp $(TARG)
-
-ALIAS_FILES = fcalias.h fcaliastail.h
-
-BUILT_SOURCES = $(ALIAS_FILES) $(TARG)
-
-$(ALIAS_FILES): 
-       touch $(ALIAS_FILES)
-
-CLEANFILES=$(TARG) $(ALIAS_FILES)
diff --git a/fc-arch/fc-arch.c b/fc-arch/fc-arch.c
deleted file mode 100644 (file)
index 1ef0cf1..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright © 2006 Keith Packard
- * Copyright © 2005 Patrick Lam
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that copyright
- * notice and this permission notice appear in supporting documentation, and
- * that the name of the copyright holders not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  The copyright holders make no representations
- * about the suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- * OF THIS SOFTWARE.
- */
-
-#include "fcint.h"
-#include <ctype.h>
-
-#define ENDIAN_TEST 0x01020304
-#define MACHINE_SIGNATURE_SIZE 1024
-
-static char *
-FcCacheMachineSignature (void)
-{
-    static char buf[MACHINE_SIGNATURE_SIZE];
-    int32_t magic = ENDIAN_TEST;
-    char * m = (char *)&magic;
-
-    sprintf (buf, "%01x%01x%01x%01x_"
-            "%02x_%02x_%02x_%02x_%02x_%02x_%02x_%02x_%02x_%02x_%02x_%02x_"
-            "%02x_%02x_%02x_%02x_%02x_%02x_%02x_%02x_%02x_%02x",
-            m[0], m[1], m[2], m[3],
-            (unsigned int)sizeof (FcAlign),
-            (unsigned int)sizeof (char),
-            (unsigned int)sizeof (char *),
-            (unsigned int)sizeof (int),
-            (unsigned int)sizeof (intptr_t),
-            (unsigned int)sizeof (FcPattern),
-            (unsigned int)sizeof (FcPatternEltPtr),
-            (unsigned int)sizeof (struct  FcPatternElt *),
-            (unsigned int)sizeof (FcPatternElt),
-            (unsigned int)sizeof (FcObject),
-            (unsigned int)sizeof (FcValueListPtr),
-            (unsigned int)sizeof (FcValue),
-            (unsigned int)sizeof (FcValueBinding),
-            (unsigned int)sizeof (struct  FcValueList *),
-            (unsigned int)sizeof (FcStrSet *), /* For FcLangSet */
-            (unsigned int)sizeof (FcCharSet),
-            (unsigned int)sizeof (FcCharLeaf **),
-            (unsigned int)sizeof (FcChar16 *),
-            (unsigned int)sizeof (FcChar16),
-            (unsigned int)sizeof (FcCharLeaf),
-            (unsigned int)sizeof (FcChar32),
-            (unsigned int)sizeof (FcCache));
-
-    return buf;
-}
-
-int
-main (int argc, char **argv)
-{
-    static char                line[1024];
-    char               *signature;
-    int                        signature_length;
-    char               *space;
-    char               *arch = NULL;
-    int                        lineno = 0;
-    
-    if (argc != 2)
-       fprintf (stderr, "Usage: %s <architecture>|auto < fcarch.tmpl.h > fcarch.h\n",
-                argv[0]);
-    arch = argv[1];
-    /*
-     * Scan the input until the marker is found
-     */
-    
-    while (fgets (line, sizeof (line), stdin))
-    {
-       lineno++;
-       if (!strncmp (line, "@@@", 3))
-           break;
-       fputs (line, stdout);
-    }
-    signature = FcCacheMachineSignature();
-    signature_length = strlen (signature);
-    
-    if (strcmp (arch, "auto") == 0)
-    {
-       arch = NULL;
-       /*
-        * Search for signature
-        */
-       while (fgets (line, sizeof (line), stdin)) 
-       {
-           lineno++;
-           /*
-            * skip comments
-            */
-           if (!strncmp (line, "@@@", 3))
-               continue;
-           space = line;
-           while (*space && !isspace (*space))
-               space++;
-           if (!space)
-           {
-               fprintf (stderr, "%s: malformed input on line %d\n",
-                        argv[0], lineno);
-               exit (1);
-           }
-           *space++ = '\0';
-           while (isspace (*space))
-               space++;
-           if (!strncmp (space, signature, signature_length))
-           {
-               arch = line;
-               break;
-           }
-       }
-    }
-    if (!arch)
-    {
-       fprintf (stderr, "%s: unknown signature \"%s\"\n", argv[0], signature);
-       fprintf (stderr, "\tPlease update fcarch.tmpl.h and rebuild\n");
-       exit (1);
-    }
-    printf ("#define FC_ARCHITECTURE \"%s\"\n", arch);
-    fflush (stdout);
-    exit (ferror (stdout));
-}
-
diff --git a/fc-arch/fcarch.tmpl.h b/fc-arch/fcarch.tmpl.h
deleted file mode 100644 (file)
index 2f972ba..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright © 2006 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the author(s) not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  The authors make no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-@@@ 
-@@@ Each unique machine architecture needs an entry in this file
-@@@ If fc-arch runs and doesn't find a matching entry, it will print
-@@@ out the archtecture signature in the error message. Take that
-@@@ signature and place it in this file along with a suitable architecture
-@@@ name. Architecture names are used to construct file names, so
-@@@ use something reasonable and don't include any spaces
-@@@
-@@@ So far the differences boil down to: endianness, 32 vs 64 bit pointers,
-@@@ and on 32bit ones, whether double is aligned to one word or two words.
-@@@ Those result in the 6 formats listed below.
-@@@
-@@@ ,name (endianness,pointer-size,double-alignment)
-@@@ |   ,endian
-@@@ |   |    ,FcAlign
-@@@ |   |    |  ,char
-@@@ |   |    |  |  ,char*
-@@@ |   |    |  |  |  ,int
-@@@ |   |    |  |  |  |  ,intptr_t
-@@@ |   |    |  |  |  |  |  ,Pattern
-@@@ |   |    |  |  |  |  |  |  ,EltPtr
-@@@ |   |    |  |  |  |  |  |  |  ,Elt *
-@@@ |   |    |  |  |  |  |  |  |  |  ,Elt
-@@@ |   |    |  |  |  |  |  |  |  |  |  ,ObjPtr
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  ,ValueListPtr
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  |  ,Value
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  |  |  ,ValueBinding
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  |  |  |  ,ValueList *
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  |  |  |  |  ,StrSet *
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ,CharSet
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ,CharLeaf **
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ,Char16 *
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ,Char16
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ,CharLeaf
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ,Char32
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  ,Cache
-@@@ |   |    |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
-le32d4 4321_08_01_04_04_04_10_04_04_08_04_04_0c_04_04_04_10_04_04_02_20_04_20
-le32d8 4321_08_01_04_04_04_10_04_04_08_04_04_10_04_04_04_10_04_04_02_20_04_20
-le64   4321_08_01_08_04_08_18_08_08_10_04_08_10_04_08_08_18_08_08_02_20_04_38
-be32d4 1234_08_01_04_04_04_10_04_04_08_04_04_0c_04_04_04_10_04_04_02_20_04_20
-be32d8 1234_08_01_04_04_04_10_04_04_08_04_04_10_04_04_04_10_04_04_02_20_04_20
-be64   1234_08_01_08_04_08_18_08_08_10_04_08_10_04_08_08_18_08_08_02_20_04_38
index a0da50e5ec03141bf5b6f2fdcde67163d6ea7a47..d2653507eff17f2b7e7348ca7f4bf6e29e1f789f 100644 (file)
@@ -22,7 +22,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "../fc-arch/fcarch.h"
+#include "../src/fcarch.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index 40c38c485af775bd36e07ebe08d4eec0d48b6779..c6c399343de4aed651f1ce4f7dca2824299b5a71 100644 (file)
@@ -32,7 +32,7 @@
 #endif
 
 #include <fontconfig/fontconfig.h>
-#include "../fc-arch/fcarch.h"
+#include "../src/fcarch.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 59b9c75bade50ff1db13eeec042d790d7853353f..e300fe9491b180717ff012fa188dfee9c6a3009c 100644 (file)
@@ -84,13 +84,12 @@ noinst_HEADERS=fcint.h fcftint.h fcdeprecate.h
 ALIAS_FILES = fcalias.h fcaliastail.h fcftalias.h fcftaliastail.h
 
 BUILT_SOURCES = $(ALIAS_FILES) \
-       ../fc-arch/fcarch.h \
        ../fc-case/fccase.h \
        ../fc-glyphname/fcglyphname.h \
        ../fc-lang/fclang.h
 
-../fc-arch/fcarch.h:
-       cd ../fc-arch && $(MAKE) $(AM_MAKEFLAGS) fcarch.h
+noinst_PROGRAMS = fcarch
+
 ../fc-case/fccase.h:
        cd ../fc-case && $(MAKE) $(AM_MAKEFLAGS) fccase.h
 ../fc-glyphname/fcglyphname.h:
@@ -99,6 +98,7 @@ BUILT_SOURCES = $(ALIAS_FILES) \
        cd ../fc-lang && $(MAKE) $(AM_MAKEFLAGS) fclang.h
 
 libfontconfig_la_SOURCES = \
+       fcarch.h \
        fcatomic.c \
        fcblanks.c \
        fccache.c \
diff --git a/src/fcarch.c b/src/fcarch.c
new file mode 100644 (file)
index 0000000..36d0ce5
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright © 2002 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the author(s) not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  The authors make no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* If architecture is hardcoded, skip the assert tests */
+
+#ifndef FC_ARCHITECTURE
+
+#include "fcarch.h"
+
+/* Make sure the cache structure is consistent with what we expect */
+
+#include "fcint.h"
+
+FC_ASSERT_STATIC (1 == sizeof (char));
+FC_ASSERT_STATIC (2 == sizeof (FcChar16));
+FC_ASSERT_STATIC (4 == sizeof (int));
+FC_ASSERT_STATIC (4 == sizeof (FcChar32));
+FC_ASSERT_STATIC (4 == sizeof (FcObject));
+FC_ASSERT_STATIC (4 == sizeof (FcValueBinding));
+FC_ASSERT_STATIC (8 == sizeof (FcAlign));
+FC_ASSERT_STATIC (0x20 == sizeof (FcCharLeaf));
+
+FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (intptr_t));
+FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (FcPatternEltPtr));
+FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (FcValueListPtr));
+FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (char *));
+FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (struct FcPatternElt *));
+FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (FcValueList *));
+FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (FcStrSet *));
+FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (FcCharLeaf **));
+FC_ASSERT_STATIC (SIZEOF_VOID_P == sizeof (FcChar16 *));
+
+FC_ASSERT_STATIC (0x08 + 1*SIZEOF_VOID_P == sizeof (FcValue));
+FC_ASSERT_STATIC (0x00 + 2*SIZEOF_VOID_P == sizeof (FcPatternElt));
+FC_ASSERT_STATIC (0x08 + 2*SIZEOF_VOID_P == sizeof (FcPattern));
+FC_ASSERT_STATIC (0x08 + 2*SIZEOF_VOID_P == sizeof (FcCharSet));
+FC_ASSERT_STATIC (0x08 + 6*SIZEOF_VOID_P == sizeof (FcCache));
+
+#endif
+
+
+int
+main (int argc, char **argv)
+{
+    printf ("%s\n", FC_ARCHITECTURE);
+    return 0;
+}
diff --git a/src/fcarch.h b/src/fcarch.h
new file mode 100644 (file)
index 0000000..0c8cd05
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright © 2006 Keith Packard
+ * Copyright © 2010 Behdad Esfahbod
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the author(s) not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission.  The authors make no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+#ifndef _FCARCH_H_
+#define _FCARCH_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*
+ * Each unique machine architecture needs an entry in this file
+ * So far the differences boil down to: endianness, 32 vs 64 bit pointers,
+ * and on 32bit ones, whether double is aligned to one word or two words.
+ * Those result in the 6 formats listed below.
+ *
+ * If any of the assertion errors in fccache.c fail, you need to add a new
+ * architecture.  Contact the fontconfig mailing list in that case.
+ *
+ * name                endianness      pointer-size    double-alignment
+ *
+ * le32d4      4321            4               4
+ * le32d8      4321            4               8
+ * le64                4321            8               8
+ * be32d4      1234            4               4
+ * be32d8      1234            4               8
+ * be64                1234            8               8
+ */
+
+#if defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN
+# define FC_ARCH_ENDIAN "be"
+#else /* !WORDS_BIGENDIAN */
+# define FC_ARCH_ENDIAN "le"
+#endif
+
+#if SIZEOF_VOID_P == 4
+# if ALIGNOF_DOUBLE == 4
+#  define FC_ARCH_SIZE_ALIGN "32d4"
+# else /* ALIGNOF_DOUBLE != 4 */
+#  define FC_ARCH_SIZE_ALIGN "32d8"
+# endif
+#else /* SIZEOF_VOID_P != 4 */
+# define FC_ARCH_SIZE_ALIGN "64"
+#endif
+
+#ifdef ARCHITECTURE
+# define ARCHITECTURE FC_ARCHITECTURE
+#else
+# define FC_ARCHITECTURE FC_ARCH_ENDIAN FC_ARCH_SIZE_ALIGN
+#endif
+
+#endif /* _FCARCH_H_ */
index d557d340399fdcf30b69525cef9601a15a1335df..1bbd79975602b1b9ae13c530d3646da592771e7c 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 #include "fcint.h"
-#include "../fc-arch/fcarch.h"
+#include "fcarch.h"
 #include <stdio.h>
 #include <fcntl.h>
 #include <dirent.h>
@@ -41,6 +41,7 @@
 #define O_BINARY 0
 #endif
 
+
 struct MD5Context {
         FcChar32 buf[4];
         FcChar32 bits[2];
index 2bc7878c1ab652dd35ce10679dd063b73479791c..a8599138f85d625355606861a1578bbf912d762f 100644 (file)
 
 #define FC_MEM_NUM         30
 
+#define _FC_ASSERT_STATIC1(_line, _cond) typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1]
+#define _FC_ASSERT_STATIC0(_line, _cond) _FC_ASSERT_STATIC1 (_line, (_cond))
+#define FC_ASSERT_STATIC(_cond) _FC_ASSERT_STATIC0 (__LINE__, (_cond))
+
 #define FC_MIN(a,b) ((a) < (b) ? (a) : (b))
 #define FC_MAX(a,b) ((a) > (b) ? (a) : (b))
 #define FC_ABS(a)   ((a) < 0 ? -(a) : (a))