0002-configure-Simplify-pointer-size-check.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. From ec7f3bc97c53578d5ca332b9e86c4d08d155c5a0 Mon Sep 17 00:00:00 2001
  2. From: Ola Jeppsson <ola.jeppsson@gmail.com>
  3. Date: Mon, 7 Oct 2019 19:57:46 -0400
  4. Subject: [PATCH] configure: Simplify pointer size check
  5. Tested with:
  6. Autoconf 2.59 / Automake 1.7.9
  7. Autoconf 2.69 / Automake 1.16.1
  8. Downloaded from upstream PR:
  9. https://github.com/memcached/memcached/pull/552
  10. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  11. ---
  12. configure.ac | 31 ++-----------------------------
  13. restart.h | 2 +-
  14. 2 files changed, 3 insertions(+), 30 deletions(-)
  15. diff --git a/configure.ac b/configure.ac
  16. index 27dc939..7e5bd5d 100644
  17. --- a/configure.ac
  18. +++ b/configure.ac
  19. @@ -271,35 +271,8 @@ return sizeof(void*) == 8 ? 0 : 1;
  20. ])
  21. fi
  22. -dnl If data pointer is 64bit or not.
  23. -AC_CHECK_HEADERS([stdint.h])
  24. -AS_IF([test -z "$have_64bit_ptr"],
  25. - [AC_RUN_IFELSE(
  26. - [AC_LANG_PROGRAM([], [return sizeof(void*) == 8 ? 0 : 1;])],
  27. - [have_64bit_ptr=yes ],
  28. - [have_64bit_ptr=no],
  29. - [dnl cross compile (this test requires C99)
  30. - AS_IF([test "x$ac_cv_header_stdint_h" = xyes],
  31. - [AC_COMPILE_IFELSE(
  32. - [AC_LANG_PROGRAM([
  33. - #include <stdint.h>
  34. - #if UINTPTR_MAX == 0xFFFFFFFFFFFFFFFFUL
  35. - /* 64 bit pointer */
  36. - #else
  37. - #error 32 bit pointer
  38. - #endif
  39. - ], [])],
  40. - [have_64bit_ptr=yes],
  41. - [have_64bit_ptr=no])],
  42. - [have_64bit_ptr=unknown])
  43. - ])
  44. -])
  45. -AS_IF([test "$have_64bit_ptr" = "unknown" ],[
  46. - AC_MSG_ERROR([Cannot detect pointer size. Must pass have_64bit_ptr={yes,no} to configure.])
  47. -])
  48. -AS_IF([test "$have_64bit_ptr" = yes],[
  49. - AC_DEFINE(HAVE_64BIT_PTR, 1, [data pointer is 64bit])
  50. -])
  51. +dnl Check if data pointer is 64bit or not
  52. +AC_CHECK_SIZEOF([void *])
  53. # Issue 213: Search for clock_gettime to help people linking
  54. # with a static version of libevent
  55. diff --git a/restart.h b/restart.h
  56. index 76cd0a8..9de5096 100644
  57. --- a/restart.h
  58. +++ b/restart.h
  59. @@ -4,7 +4,7 @@
  60. #define RESTART_TAG_MAXLEN 255
  61. // Track the pointer size for restart fiddling.
  62. -#ifdef HAVE_64BIT_PTR
  63. +#if SIZEOF_VOID_P == 8
  64. typedef uint64_t mc_ptr_t;
  65. #else
  66. typedef uint32_t mc_ptr_t;
  67. --
  68. 2.20.1