From 835919c4feb596714a6e4db3d452b261d74d42ca Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Thu, 6 Oct 2016 18:31:29 +0000 Subject: [PATCH] added check for __uint128_t into configure.ac --- stix/configure | 40 ++++++++++++++++++++++++++++++++++++++++ stix/configure.ac | 3 +++ stix/lib/stix-cfg.h.in | 6 ++++++ stix/lib/stix-cmn.h | 5 ++++- 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/stix/configure b/stix/configure index dc82f17..716a70f 100755 --- a/stix/configure +++ b/stix/configure @@ -18893,6 +18893,40 @@ cat >>confdefs.h <<_ACEOF _ACEOF +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of __uint128_t" >&5 +$as_echo_n "checking size of __uint128_t... " >&6; } +if ${ac_cv_sizeof___uint128_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (__uint128_t))" "ac_cv_sizeof___uint128_t" " +"; then : + +else + if test "$ac_cv_type___uint128_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (__uint128_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof___uint128_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof___uint128_t" >&5 +$as_echo "$ac_cv_sizeof___uint128_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF___UINT128_T $ac_cv_sizeof___uint128_t +_ACEOF + + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -19257,6 +19291,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ac_cv_sizeof___int128_t=0 + ac_cv_sizeof___uint128_t=0 fi @@ -19476,6 +19511,11 @@ cat >>confdefs.h <<_ACEOF _ACEOF +cat >>confdefs.h <<_ACEOF +#define STIX_SIZEOF___UINT128_T ${ac_cv_sizeof___uint128_t} +_ACEOF + + cat >>confdefs.h <<_ACEOF #define STIX_SIZEOF_VOID_P ${ac_cv_sizeof_void_p} _ACEOF diff --git a/stix/configure.ac b/stix/configure.ac index bc8d3ae..e20ca92 100644 --- a/stix/configure.ac +++ b/stix/configure.ac @@ -210,6 +210,7 @@ AC_CHECK_SIZEOF(__int16_t,,[[]]) AC_CHECK_SIZEOF(__int32_t,,[[]]) AC_CHECK_SIZEOF(__int64_t,,[[]]) AC_CHECK_SIZEOF(__int128_t,,[[]]) +AC_CHECK_SIZEOF(__uint128_t,,[[]]) dnl AC_CHECK_SIZEOF doesn't work without white-space between void and * AC_CHECK_SIZEOF(void *,,[[]]) AC_CHECK_SIZEOF(float,,[[]]) @@ -252,6 +253,7 @@ then [ AC_MSG_RESULT(no) ac_cv_sizeof___int128_t=0 + ac_cv_sizeof___uint128_t=0 ] ) fi @@ -336,6 +338,7 @@ AC_DEFINE_UNQUOTED(STIX_SIZEOF___INT32, ${ac_cv_sizeof___int32}, [sizeof(__int32 AC_DEFINE_UNQUOTED(STIX_SIZEOF___INT64, ${ac_cv_sizeof___int64}, [sizeof(__int64)]) AC_DEFINE_UNQUOTED(STIX_SIZEOF___INT128, ${ac_cv_sizeof___int128}, [sizeof(__int128)]) AC_DEFINE_UNQUOTED(STIX_SIZEOF___INT128_T, ${ac_cv_sizeof___int128_t}, [sizeof(__int128_t)]) +AC_DEFINE_UNQUOTED(STIX_SIZEOF___UINT128_T, ${ac_cv_sizeof___uint128_t}, [sizeof(__uint128_t)]) AC_DEFINE_UNQUOTED(STIX_SIZEOF_VOID_P, ${ac_cv_sizeof_void_p}, [sizeof(void*)]) AC_DEFINE_UNQUOTED(STIX_SIZEOF_FLOAT, ${ac_cv_sizeof_float}, [sizeof(float)]) AC_DEFINE_UNQUOTED(STIX_SIZEOF_DOUBLE, ${ac_cv_sizeof_double}, [sizeof(double)]) diff --git a/stix/lib/stix-cfg.h.in b/stix/lib/stix-cfg.h.in index a80eef0..a8067b7 100644 --- a/stix/lib/stix-cfg.h.in +++ b/stix/lib/stix-cfg.h.in @@ -414,6 +414,9 @@ /* The size of `__int8_t', as computed by sizeof. */ #undef SIZEOF___INT8_T +/* The size of `__uint128_t', as computed by sizeof. */ +#undef SIZEOF___UINT128_T + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS @@ -513,6 +516,9 @@ /* sizeof(__int8) */ #undef STIX_SIZEOF___INT8 +/* sizeof(__uint128_t) */ +#undef STIX_SIZEOF___UINT128_T + /* Version number of package */ #undef VERSION diff --git a/stix/lib/stix-cmn.h b/stix/lib/stix-cmn.h index 6588c30..db815c0 100644 --- a/stix/lib/stix-cmn.h +++ b/stix/lib/stix-cmn.h @@ -197,7 +197,10 @@ #elif defined(STIX_SIZEOF___INT128_T) && (STIX_SIZEOF___INT128_T == 16) # define STIX_HAVE_UINT128_T # define STIX_HAVE_INT128_T - #if defined(__clang__) + #if defined(STIX_SIZEOF___UINT128_T) && (STIX_SIZEOF___UINT128_T == STIX_SIZEOF___INT128_T) + typedef __uint128_t stix_uint128_t; + typedef __int128_t stix_int128_t; + #elif defined(__clang__) typedef __uint128_t stix_uint128_t; typedef __int128_t stix_int128_t; #else