blob: 1a5dc31963244fb420b5fc7fba9cd91260ce0763 [file] [log] [blame]
From ec7f3bc97c53578d5ca332b9e86c4d08d155c5a0 Mon Sep 17 00:00:00 2001
From: Ola Jeppsson <ola.jeppsson@gmail.com>
Date: Mon, 7 Oct 2019 19:57:46 -0400
Subject: [PATCH] configure: Simplify pointer size check
Tested with:
Autoconf 2.59 / Automake 1.7.9
Autoconf 2.69 / Automake 1.16.1
Downloaded from upstream PR:
https://github.com/memcached/memcached/pull/552
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
configure.ac | 31 ++-----------------------------
restart.h | 2 +-
2 files changed, 3 insertions(+), 30 deletions(-)
diff --git a/configure.ac b/configure.ac
index 27dc939..7e5bd5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -271,35 +271,8 @@ return sizeof(void*) == 8 ? 0 : 1;
])
fi
-dnl If data pointer is 64bit or not.
-AC_CHECK_HEADERS([stdint.h])
-AS_IF([test -z "$have_64bit_ptr"],
- [AC_RUN_IFELSE(
- [AC_LANG_PROGRAM([], [return sizeof(void*) == 8 ? 0 : 1;])],
- [have_64bit_ptr=yes ],
- [have_64bit_ptr=no],
- [dnl cross compile (this test requires C99)
- AS_IF([test "x$ac_cv_header_stdint_h" = xyes],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([
- #include <stdint.h>
- #if UINTPTR_MAX == 0xFFFFFFFFFFFFFFFFUL
- /* 64 bit pointer */
- #else
- #error 32 bit pointer
- #endif
- ], [])],
- [have_64bit_ptr=yes],
- [have_64bit_ptr=no])],
- [have_64bit_ptr=unknown])
- ])
-])
-AS_IF([test "$have_64bit_ptr" = "unknown" ],[
- AC_MSG_ERROR([Cannot detect pointer size. Must pass have_64bit_ptr={yes,no} to configure.])
-])
-AS_IF([test "$have_64bit_ptr" = yes],[
- AC_DEFINE(HAVE_64BIT_PTR, 1, [data pointer is 64bit])
-])
+dnl Check if data pointer is 64bit or not
+AC_CHECK_SIZEOF([void *])
# Issue 213: Search for clock_gettime to help people linking
# with a static version of libevent
diff --git a/restart.h b/restart.h
index 76cd0a8..9de5096 100644
--- a/restart.h
+++ b/restart.h
@@ -4,7 +4,7 @@
#define RESTART_TAG_MAXLEN 255
// Track the pointer size for restart fiddling.
-#ifdef HAVE_64BIT_PTR
+#if SIZEOF_VOID_P == 8
typedef uint64_t mc_ptr_t;
#else
typedef uint32_t mc_ptr_t;
--
2.20.1