diff --git a/configure.in b/configure.in index 7a1822047..0258d1c1f 100644 --- a/configure.in +++ b/configure.in @@ -178,6 +178,82 @@ AC_SUBST(MINGW_LIBS) AC_SUBST(MINGW_GUIAPP) +dnl +dnl Test if the 64bit integer types are available, and if not if they +dnl can be typedef'ed manually. +dnl +AC_MSG_CHECKING(for int64_t) +AC_LANG_PUSH(C++) +AC_CACHE_VAL(has_int64_t,[ + AC_TRY_RUN([ +#ifdef __BEOS__ +#include +#endif +#include +int64_t foo; +int main() {return 0;} + ], + has_int64_t=yes, + has_int64_t=no, + has_int64_t=no) + ]) +AC_MSG_RESULT($has_int64_t) + +AC_MSG_CHECKING(for uint64_t) +AC_CACHE_VAL(has_uint64_t,[ + AC_TRY_RUN([ +#ifdef __BEOS__ +#include +#endif +#include +int64_t foo; +int main() {return 0;} + ], + has_uint64_t=yes, + has_uint64_t=no, + has_uint64_t=no) + ]) +AC_MSG_RESULT($has_uint64_t) + +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long long) + +if test x$has_int64_t = "xyes" ; then + TYPE64="int64_t" +else + case 8 in + $ac_cv_sizeof_int) TYPE64="int";; + $ac_cv_sizeof_long) TYPE64="long";; + $ac_cv_sizeof_long_long) TYPE64="long long";; + esac + AC_DEFINE(HAVE_NO_INT64_T, 1, [int64_t does not exist]) + AC_DEFINE_UNQUOTED(INT64_TYPE, $TYPE64, + [the type to define int64_t manually]) +fi + +if test x$has_uint64_t = "xyes" ; then + TYPEU64="int64_t" +else + case 8 in + $ac_cv_sizeof_int) TYPEU64="unsigned int";; + $ac_cv_sizeof_long) TYPEU64="unsigned long";; + $ac_cv_sizeof_long_long) TYPEU64="unsigned long long";; + esac + AC_DEFINE(HAVE_NO_UINT64_T, 1, [uint64_t does not exist]) + AC_DEFINE_UNQUOTED(UINT64_TYPE, $TYPEU64, + [the type to define uint64_t manually]) +fi + +if test -z "$TYPE64"; then + AC_MSG_ERROR(No 64 bit type found on this platform!) +fi +if test -z "$TYPEU64"; then + AC_MSG_ERROR(No unsigned 64 bit type found on this platform!) +fi + +AC_LANG_POP + dnl dnl Test for libiconv diff --git a/src/common/os.h b/src/common/os.h index e59cca378..c616b3fc5 100644 --- a/src/common/os.h +++ b/src/common/os.h @@ -33,6 +33,8 @@ # define SYS_UNIX # if defined(__bsdi__) || defined(__FreeBSD__) # define SYS_BSD +# elif defined(__sun) && defined(__SVR4) +# define SYS_SOLARIS # else # define SYS_LINUX # endif @@ -82,6 +84,9 @@ typedef _fsize_t ssize_t; # define LLU "%llu" #endif // COMP_MINGW || COMP_MSC +#if defined(HAVE_SYS_TYPES_H) +#include +#endif // HAVE_SYS_TYPES_H #if defined(HAVE_STDINT_H) #include #endif // HAVE_STDINT_H @@ -89,6 +94,13 @@ typedef _fsize_t ssize_t; #include #endif // HAVE_INTTYPES_H +#if defined(HAVE_NO_INT64_T) +typedef INT64_TYPE int64_t; +#endif +#if defined(HAVE_NO_UINT64_T) +typedef UINT64_TYPE uint64_t; +#endif + #if defined(SYS_WINDOWS) # define PATHSEP '\\' #else