Add a configure check to see if uint64_t and unsigned long are identical.
This is needed to get vvp to compile under MacOS 10.6 and possibly other 64 bit systems that define uint64_t as unsigned long long vs unsigned long (both are 64 bits).
This commit is contained in:
parent
2229ad896b
commit
39f243b18e
25
configure.in
25
configure.in
|
|
@ -167,6 +167,31 @@ AC_SEARCH_LIBS([nan], [m], [AC_DEFINE([HAVE_NAN], [1])])
|
||||||
AC_SEARCH_LIBS([fmin], [m], [AC_DEFINE([HAVE_FMIN], [1])])
|
AC_SEARCH_LIBS([fmin], [m], [AC_DEFINE([HAVE_FMIN], [1])])
|
||||||
AC_SEARCH_LIBS([fmax], [m], [AC_DEFINE([HAVE_FMAX], [1])])
|
AC_SEARCH_LIBS([fmax], [m], [AC_DEFINE([HAVE_FMAX], [1])])
|
||||||
|
|
||||||
|
# Check to see if an unsigned long and uint64_t are the same from
|
||||||
|
# a compiler perspective. We can not just check that they are the
|
||||||
|
# same size since unsigned long and unsigned long long are not the
|
||||||
|
# same from an overloading perspective even though they could be
|
||||||
|
# the same size on some 64 bit machines. The result from this test
|
||||||
|
# is only used if inttypes.h is available, so if the test fails for
|
||||||
|
# that reason we don't care.
|
||||||
|
AC_LANG(C++)
|
||||||
|
AC_MSG_CHECKING(if uint64_t and unsigned long are identical)
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "inttypes.h"
|
||||||
|
static bool check(unsigned long val)
|
||||||
|
{
|
||||||
|
return val != 0;
|
||||||
|
}
|
||||||
|
static bool check(uint64_t val)
|
||||||
|
{
|
||||||
|
return val != 0;
|
||||||
|
}]], [[unsigned long ulval = 1;
|
||||||
|
bool result = check(ulval);
|
||||||
|
uint64_t uival = 1;
|
||||||
|
result &= check(uival);
|
||||||
|
return !result;]])],
|
||||||
|
[AC_MSG_RESULT(no)],
|
||||||
|
[AC_DEFINE([UINT64_T_AND_ULONG_SAME], [1]) AC_MSG_RESULT(yes)])
|
||||||
|
|
||||||
# Linker option used when compiling the target
|
# Linker option used when compiling the target
|
||||||
AX_LD_RDYNAMIC
|
AX_LD_RDYNAMIC
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@
|
||||||
# undef HAVE_INTTYPES_H
|
# undef HAVE_INTTYPES_H
|
||||||
# undef HAVE_LROUND
|
# undef HAVE_LROUND
|
||||||
# undef HAVE_NAN
|
# undef HAVE_NAN
|
||||||
|
# undef UINT64_T_AND_ULONG_SAME
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define this if you want to compile vvp with memory freeing and
|
* Define this if you want to compile vvp with memory freeing and
|
||||||
|
|
@ -89,7 +90,7 @@ typedef uint64_t vvp_time64_t;
|
||||||
# define TIME_FMT_U PRIu64
|
# define TIME_FMT_U PRIu64
|
||||||
# define TIME_FMT_X PRIx64
|
# define TIME_FMT_X PRIx64
|
||||||
|
|
||||||
# if SIZEOF_UNSIGNED_LONG == 8
|
# if UINT64_T_AND_ULONG_SAME
|
||||||
# define UL_AND_TIME64_SAME
|
# define UL_AND_TIME64_SAME
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue