From 5c2e5e60f2b60018d8846a42dbd804cd818c679f Mon Sep 17 00:00:00 2001 From: strk Date: Fri, 4 May 2012 08:13:33 +0000 Subject: [PATCH] Update PGAC_TYPE_64BIT_INT for better cross-compiler support (#534) git-svn-id: http://svn.osgeo.org/geos/branches/3.3@3617 5242fede-7e19-0410-aef8-94bd7d2200fb --- NEWS | 1 + acsite.m4 | 31 ++++++++++++++----------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/NEWS b/NEWS index 920cb4c4..dfcfa971 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ Changes in 3.3.4 - Bug fixes / improvements - Do not abort on NaN overlay input (#530) - Reduce CommonBitsRemover harmful effects during overlay op (#527) + - Better cross-compiler support (#534) Changes in 3.3.3 2012-04-01 diff --git a/acsite.m4 b/acsite.m4 index e7e2badb..50bf8764 100644 --- a/acsite.m4 +++ b/acsite.m4 @@ -1,6 +1,6 @@ -# This has been taken from postgres-7.3.4 local macros -# -# +# This has been taken from postgres-9.1+ local macros +# ( REL9_1_BETA2-1484-g293ec33 ) + # PGAC_TYPE_64BIT_INT(TYPE) # ------------------------- # Check if TYPE is a working 64 bit integer type. Set HAVE_TYPE_64 to @@ -10,24 +10,20 @@ AC_DEFUN([PGAC_TYPE_64BIT_INT], define([Ac_cachevar], [translit([pgac_cv_type_$1_64], [ *], [_p])])dnl AC_CACHE_CHECK([whether $1 is 64 bits], [Ac_cachevar], [AC_TRY_RUN( -[ - -#include - -typedef $1 int64; +[typedef $1 ac_int64; /* * These are globals to discourage the compiler from folding all the * arithmetic tests down to compile-time constants. */ -int64 a = 20000001; -int64 b = 40000005; +ac_int64 a = 20000001; +ac_int64 b = 40000005; int does_int64_work() { - int64 c,d; + ac_int64 c,d; - if (sizeof(int64) != 8) + if (sizeof(ac_int64) != 8) return 0; /* definitely not the right size */ /* Do perfunctory checks to see if 64-bit arithmetic seems to work */ @@ -42,15 +38,16 @@ main() { }], [Ac_cachevar=yes], [Ac_cachevar=no], -[Ac_cachevar=no -dnl We will do better here with Autoconf 2.50 -AC_MSG_WARN([64 bit arithmetic disabled when cross-compiling])])]) +[# If cross-compiling, check the size reported by the compiler and +# trust that the arithmetic works. +AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([], [sizeof($1) == 8])], + Ac_cachevar=yes, + Ac_cachevar=no)])]) Ac_define=$Ac_cachevar if test x"$Ac_cachevar" = xyes ; then - AC_DEFINE(Ac_define,, [Set to 1 if `]$1[' is 64 bits]) + AC_DEFINE(Ac_define, 1, [Define to 1 if `]$1[' works and is 64 bits.]) fi undefine([Ac_define])dnl undefine([Ac_cachevar])dnl ])# PGAC_TYPE_64BIT_INT - -- 2.11.4.GIT