[geos-commits] r3617 - branches/3.3

svn_geos at osgeo.org svn_geos at osgeo.org
Fri May 4 04:13:33 EDT 2012


Author: strk
Date: 2012-05-04 01:13:33 -0700 (Fri, 04 May 2012)
New Revision: 3617

Modified:
   branches/3.3/NEWS
   branches/3.3/acsite.m4
Log:
Update PGAC_TYPE_64BIT_INT for better cross-compiler support (#534)

Modified: branches/3.3/NEWS
===================================================================
--- branches/3.3/NEWS	2012-05-03 10:08:27 UTC (rev 3616)
+++ branches/3.3/NEWS	2012-05-04 08:13:33 UTC (rev 3617)
@@ -4,6 +4,7 @@
 - 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

Modified: branches/3.3/acsite.m4
===================================================================
--- branches/3.3/acsite.m4	2012-05-03 10:08:27 UTC (rev 3616)
+++ branches/3.3/acsite.m4	2012-05-04 08:13:33 UTC (rev 3617)
@@ -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 @@
 define([Ac_cachevar], [translit([pgac_cv_type_$1_64], [ *], [_p])])dnl
 AC_CACHE_CHECK([whether $1 is 64 bits], [Ac_cachevar],
 [AC_TRY_RUN(
-[
+[typedef $1 ac_int64;
 
-#include <inttypes.h>
-
-typedef $1 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 @@
 }],
 [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
-



More information about the geos-commits mailing list