Commit 7284c25b authored by Nick Mathewson's avatar Nick Mathewson 🎨
Browse files

Cope better on platforms that define some of intFOO_t in sys/types.h or elsewhere


svn:r377
parent 52675184
......@@ -133,11 +133,17 @@ LIBS="$saved_LIBS -lcrypto"
dnl The warning message here is no longer strictly accurate.
AC_CHECK_HEADERS(unistd.h string.h signal.h netdb.h ctype.h poll.h sys/poll.h sys/types.h sys/fcntl.h sys/ioctl.h sys/socket.h sys/time.h netinet/in.h arpa/inet.h errno.h assert.h stdint.h, , AC_MSG_WARN(some headers were not found, compilation may fail))
AC_CHECK_HEADERS(unistd.h string.h signal.h netdb.h ctype.h poll.h sys/poll.h sys/types.h sys/fcntl.h sys/ioctl.h sys/socket.h sys/time.h netinet/in.h arpa/inet.h errno.h assert.h , , AC_MSG_WARN(some headers were not found, compilation may fail))
dnl These headers are not essential
AC_CHECK_HEADERS(stdint.h sys/types.h)
dnl In case we aren't given a working stdint.h, we'll need to grow our own.
dnl Watch out.
AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t])
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
......
......@@ -7,15 +7,20 @@
#ifdef HAVE_STDINT_H
#include <stdint.h>
#else
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#ifndef HAVE_INT8_T
#if (SIZEOF_CHAR == 1)
typedef unsigned char uint8_t;
typedef signed char int8_t;
#else
#error "sizeof(char) != 1"
#endif
#endif
#ifndef HAVE_INT16_T
#if (SIZEOF_SHORT == 2)
typedef unsigned short uint16_t;
typedef signed short int16_t;
......@@ -25,7 +30,9 @@ typedef signed int int16_t;
#else
#error "sizeof(short) != 2 && sizeof(int) != 2"
#endif
#endif
#ifndef HAVE_INT32_T
#if (SIZEOF_INT == 4)
typedef unsigned int uint32_t;
typedef signed int int32_t;
......@@ -35,7 +42,9 @@ typedef signed long int32_t;
#else
#error "sizeof(int) != 4 && sizeof(long) != 4"
#endif
#endif
#ifndef HAVE_INT64_T
#if (SIZEOF_LONG == 8)
typedef unsigned long uint64_t;
typedef signed long int64_t;
......@@ -48,6 +57,7 @@ typedef signed __int64 int64_t;
#else
#error "sizeof(long) != 8 && sizeof(long long) != 8 && sizeof(__int64) != 8"
#endif
#endif
#endif /* HAVE_STDINT_H */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment