Rename geos_svn_revision.h to geos_revision.h
[geos.git] / acsite.m4
blob2b8d2df74d7974aaf7dfdfc2ef4e8b2025186053
1 # This has been taken from postgres-9.1+ local macros
2 # ( REL9_1_BETA2-1484-g293ec33 )
4 # PGAC_TYPE_64BIT_INT(TYPE)
5 # -------------------------
6 # Check if TYPE is a working 64 bit integer type. Set HAVE_TYPE_64 to
7 # yes or no respectively, and define HAVE_TYPE_64 if yes.
8 AC_DEFUN([PGAC_TYPE_64BIT_INT],
9 [define([Ac_define], [translit([have_$1_64], [a-z *], [A-Z_P])])dnl
10 define([Ac_cachevar], [translit([pgac_cv_type_$1_64], [ *], [_p])])dnl
11 AC_CACHE_CHECK([whether $1 is 64 bits], [Ac_cachevar],
12 [AC_TRY_RUN(
13 [typedef $1 ac_int64;
16  * These are globals to discourage the compiler from folding all the
17  * arithmetic tests down to compile-time constants.
18  */
19 ac_int64 a = 20000001;
20 ac_int64 b = 40000005;
22 int does_int64_work()
24   ac_int64 c,d;
26   if (sizeof(ac_int64) != 8)
27     return 0;                   /* definitely not the right size */
29   /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
30   c = a * b;
31   d = (c + b) / b;
32   if (d != a+1)
33     return 0;
34   return 1;
36 main() {
37   if (does_int64_work())
38     exit(0);
39   exit(-1);
40 }],
41 [Ac_cachevar=yes],
42 [Ac_cachevar=no],
43 [# If cross-compiling, check the size reported by the compiler and
44 # trust that the arithmetic works.
45 AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([], [sizeof($1) == 8])],
46                   Ac_cachevar=yes,
47                   Ac_cachevar=no)])])
49 Ac_define=$Ac_cachevar
50 if test x"$Ac_cachevar" = xyes ; then
51   AC_DEFINE(Ac_define, 1, [Define to 1 if `]$1[' works and is 64 bits.])
53 undefine([Ac_define])dnl
54 undefine([Ac_cachevar])dnl
55 ])# PGAC_TYPE_64BIT_INT