Commit 12ef831fc314518bff45278008a568608501a8e4

Alexei Podtelezhnikov 2021-09-24T22:27:27

[builds/unix] Do not use autoconf SIZEOF. * builds/unix/ftconfig.h.in [FT_USE_AUTOCONF_SIZEOF_TYPES]: Removed. * builds/unix/configure.raw: Remove AC_CHECK_SIZEOF and update. After this commit, autoconf builds will fully rely on <limits.h> rather than falling back on it if AC_CHECK_SIZEOF failed for some reason. There is a risk that misconfigured cross-compilation might have wrong headers. Note that Meson and CMake builds always relied on <limits.h> for sizes and availability of integer types.

diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index 56e0a8e..b035a29 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -103,78 +103,6 @@ AC_CHECK_HEADERS([fcntl.h unistd.h])
 # checks for typedefs, structures, and compiler characteristics
 
 AC_C_CONST
-AC_CHECK_SIZEOF([int])
-AC_CHECK_SIZEOF([long])
-AC_TYPE_LONG_LONG_INT
-
-
-# check whether cpp computation of size of int and long in ftconfig.h.in works
-
-AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.h.in works])
-orig_CPPFLAGS="${CPPFLAGS}"
-CPPFLAGS="-I${srcdir} -I. -I${srcdir}/../../include ${CPPFLAGS}"
-
-ac_clean_files=
-if test ! -f ft2build.h; then
-  ac_clean_files=ft2build.h
-  touch ft2build.h
-fi
-
-cat > conftest.c <<\_ACEOF
-#include <limits.h>
-#define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h>
-#define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h>
-#define FT_UINT_MAX  UINT_MAX
-#define FT_ULONG_MAX ULONG_MAX
-#include "ftconfig.h.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`
-rm -f conftest.* $ac_clean_files
-
-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
-                          architectures by single file], [], [])
-
-case :${ft_use_autoconf_sizeof_types}:${enable_biarch_config}: in
-  :yes:yes:)
-    AC_MSG_RESULT([broken but use it])
-    unset ft_use_autoconf_sizeof_types
-    ;;
-  ::no:)
-    AC_MSG_RESULT([works but ignore it])
-    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 x"${ft_use_autoconf_sizeof_types}" = xyes; then
-  AC_DEFINE([FT_USE_AUTOCONF_SIZEOF_TYPES], [],
-            [Define if autoconf sizeof types should be used.])
-fi
-
-CPPFLAGS="${orig_CPPFLAGS}"
 
 AC_ARG_ENABLE([freetype-config],
   AS_HELP_STRING([--enable-freetype-config], [install freetype-config]),
diff --git a/builds/unix/ftconfig.h.in b/builds/unix/ftconfig.h.in
index 9fbbc6c..b42fe42 100644
--- a/builds/unix/ftconfig.h.in
+++ b/builds/unix/ftconfig.h.in
@@ -42,16 +42,6 @@
 #undef HAVE_UNISTD_H
 #undef HAVE_FCNTL_H
 
-#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
-
-#endif /* FT_USE_AUTOCONF_SIZEOF_TYPES */
-
 #include <freetype/config/integer-types.h>
 #include <freetype/config/public-macros.h>
 #include <freetype/config/mac-support.h>