From 42688a8366a32363d0d285f7b016d53be5c0d7bc Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Sat, 20 Oct 2001 21:28:09 +0000 Subject: [PATCH] Add check for stdint.h, since Solaris doesn't have it. This is needed on Linux for uint64_t, but Solaris defines this in sys/types.h. Use check where appropriate, and also add typedefs for Win32. svn path=/trunk/icecast/; revision=2206 --- configure.in | 2 ++ src/compat.h | 16 ++++++++++++++++ src/connection.h | 3 ++- src/timing/timing.c | 6 ++++-- src/timing/timing.h | 9 ++++++++- 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 src/compat.h diff --git a/configure.in b/configure.in index c5c0d64a..fb510df3 100644 --- a/configure.in +++ b/configure.in @@ -61,6 +61,8 @@ AC_SEARCH_LIBS(getipnodebyname, nsl, dnl Checks for header files. AC_HEADER_STDC +AC_CHECK_HEADER(stdint.h, AC_DEFINE(HAVE_STDINT_H, 1),,) + dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST diff --git a/src/compat.h b/src/compat.h new file mode 100644 index 00000000..8bc430f0 --- /dev/null +++ b/src/compat.h @@ -0,0 +1,16 @@ +/* compat.h + * + * This file contains most of the ugliness for header portability + * and common types across various systems like Win32, Linux and + * Solaris. + */ + +/* Make sure we define 64 bit types */ +#ifdef _WIN32 +# define int64_t __int64 +# define uint64_t unsigned __int64 +#else +# ifdef HAVE_STDINT_H +# include +# endif +#endif diff --git a/src/connection.h b/src/connection.h index 5bf62bac..75e367ef 100644 --- a/src/connection.h +++ b/src/connection.h @@ -1,7 +1,8 @@ #ifndef __CONNECTION_H__ #define __CONNECTION_H__ -#include +#include +#include "compat.h" typedef struct connection_tag { diff --git a/src/timing/timing.c b/src/timing/timing.c index 9ac5d7b4..2e3ff0df 100644 --- a/src/timing/timing.c +++ b/src/timing/timing.c @@ -3,13 +3,15 @@ */ #include -#include #include #include #include +#ifdef HAVE_STDINT_H +# include +#endif #ifdef _WIN32 -#include +# include #endif #include "timing.h" diff --git a/src/timing/timing.h b/src/timing/timing.h index 051d9116..1febca1f 100644 --- a/src/timing/timing.h +++ b/src/timing/timing.h @@ -1,7 +1,14 @@ #ifndef __TIMING_H__ #define __TIMING_H__ -#include +#include +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef _WIN32 +typedef int64_t __int64; +typedef uint64_t unsigned __int64; +#endif uint64_t timing_get_time(void); void timing_sleep(uint64_t sleeptime);