summaryrefslogtreecommitdiff
path: root/builds
diff options
context:
space:
mode:
authorSuzuki, Toshiya (鈴木俊哉) <mpsuzuki@hiroshima-u.ac.jp>2008-09-11 08:02:23 +0000
committerSuzuki, Toshiya (鈴木俊哉) <mpsuzuki@hiroshima-u.ac.jp>2008-09-11 08:02:23 +0000
commit59188661e622e078cc0fc16f203573c79fcc2c98 (patch)
tree9f3db8f3c9d9788fb318d2331140f93c8c8e813a /builds
parent8e29645e20e4de8c2b2cbfde12a48da7f84c3713 (diff)
downloadfreetype2-59188661e622e078cc0fc16f203573c79fcc2c98.tar.gz
* Fix Savannah bug #21250: builds/unix/configure installs bi-arch ftconfig.h if it works correctly
Diffstat (limited to 'builds')
-rw-r--r--builds/unix/configure.raw59
-rw-r--r--builds/unix/ftconfig.in53
2 files changed, 108 insertions, 4 deletions
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index 477185be4..140f55cfb 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -126,6 +126,65 @@ AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
+# checks for cpp computation of size of int and long ftconfig.in works
+
+AC_MSG_CHECKING([cpp computation of bit length in ftconfig.in works])
+orig_CPPFLAGS="${CPPFLAGS}"
+CPPFLAGS="-I${srcdir} -I. ${CPPFLAGS}"
+ac_clean_files="ft2build.h ftoption.h ftstdlib.h"
+touch ft2build.h ftoption.h ftstdlib.h
+cat > conftest.c <<\_ACEOF
+#include <limits.h>
+#define FT_CONFIG_OPTIONS_H "ftoption.h"
+#define FT_CONFIG_STANDARD_LIBRARY_H "ftstdlib.h"
+#define FT_UINT_MAX UINT_MAX
+#define FT_ULONG_MAX ULONG_MAX
+#include "ftconfig.in"
+_ACEOF
+echo >> conftest.c "#if FT_SIZEOF_INT == "${ac_cv_sizeof_int}
+echo >> conftest.c "ac_cpp_ft_sizeof_int="${ac_cv_sizeof_int}
+echo >> conftest.c "#endif"
+echo >> conftest.c "#if FT_SIZEOF_LONG == "${ac_cv_sizeof_long}
+echo >> conftest.c "ac_cpp_ft_sizeof_long="${ac_cv_sizeof_long}
+echo >> conftest.c "#endif"
+${CPP} ${CPPFLAGS} conftest.c | ${GREP} ac_cpp_ft > conftest.sh
+eval `cat conftest.sh`
+${RMF} conftest.c conftest.sh confft2build.h ftoption.h ftstdlib.h
+if test x != "x${ac_cpp_ft_sizeof_int}" -a x != x"${ac_cpp_ft_sizeof_long}"
+then
+ unset ft_use_autoconf_sizeof_types
+else
+ ft_use_autoconf_sizeof_types="yes"
+fi
+AC_ARG_ENABLE(biarch-config,
+[ --enable-biarch-config install biarch ftconfig.h to support multiple
+ architechtures by single file], [], [])
+
+case :${ft_use_autoconf_sizeof_types}:${enable_biarch_config}: in
+ :yes:yes: )
+ AC_MSG_RESULT([broken but use])
+ unset ft_use_autoconf_sizeof_types
+ ;;
+ ::no: )
+ AC_MSG_RESULT([works but ignore])
+ ft_use_autoconf_sizeof_types="yes"
+ ;;
+ ::yes: | ::: )
+ AC_MSG_RESULT([yes])
+ unset ft_use_autoconf_sizeof_types
+ ;;
+ * )
+ AC_MSG_RESULT([no])
+ ft_use_autoconf_sizeof_types="yes"
+ ;;
+esac
+if test xyes = x"${ft_use_autoconf_sizeof_types}"
+then
+ AC_DEFINE([FT_USE_AUTOCONF_SIZEOF_TYPES])
+fi
+CPPFLAGS="${orig_CPPFLAGS}"
+
+
# checks for library functions
# Here we check whether we can use our mmap file component.
diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in
index 6430abf76..311b03a24 100644
--- a/builds/unix/ftconfig.in
+++ b/builds/unix/ftconfig.in
@@ -59,15 +59,60 @@ FT_BEGIN_HEADER
#undef HAVE_UNISTD_H
#undef HAVE_FCNTL_H
+#undef HAVE_STDINT_H
+
+ /* There are systems (like the Texas Instruments 'C54x) where a `char' */
+ /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */
+ /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */
+ /* is probably unexpected. */
+ /* */
+ /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */
+ /* `char' type. */
+
+#ifndef FT_CHAR_BIT
+#define FT_CHAR_BIT CHAR_BIT
+#endif
+
+
+#undef FT_USE_AUTOCONF_SIZEOF_TYPES
+#ifdef FT_USE_AUTOCONF_SIZEOF_TYPES
#undef SIZEOF_INT
#undef SIZEOF_LONG
+#define FT_SIZEOF_INT SIZEOF_INT
+#define FT_SIZEOF_LONG SIZEOF_LONG
+#else /* ! FT_USE_AUTOCONF_SIZEOF_TYPES */
+
+ /* Following cpp computation of the bit length of int and long */
+ /* is copied from default include/freetype/config/ftconfig.h. */
+ /* If any improvement is required for this file, it should be */
+ /* applied to the original header file for the builders that */
+ /* does not use configure script. */
+
+ /* The size of an `int' type. */
+#if FT_UINT_MAX == 0xFFFFUL
+#define FT_SIZEOF_INT (16 / FT_CHAR_BIT)
+#elif FT_UINT_MAX == 0xFFFFFFFFUL
+#define FT_SIZEOF_INT (32 / FT_CHAR_BIT)
+#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
+#define FT_SIZEOF_INT (64 / FT_CHAR_BIT)
+#else
+#error "Unsupported size of `int' type!"
+#endif
+ /* The size of a `long' type. A five-byte `long' (as used e.g. on the */
+ /* DM642) is recognized but avoided. */
+#if FT_ULONG_MAX == 0xFFFFFFFFUL
+#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
+#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
+#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
+#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
+#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT)
+#else
+#error "Unsupported size of `long' type!"
+#endif
-#define FT_SIZEOF_INT SIZEOF_INT
-#define FT_SIZEOF_LONG SIZEOF_LONG
-
-#define FT_CHAR_BIT CHAR_BIT
+#endif /* ! FT_USE_AUTOCONF_SIZEOF_TYPES */
/* Preferred alignment of data */
#define FT_ALIGNMENT 8