detect if stdint.h is available. if not, use inttypes. this should fix #239 and make...
[rrdtool.git] / src / rrd_client.h
index 1776c2b..787c2b6 100644 (file)
 #ifndef __RRD_CLIENT_H
 #define __RRD_CLIENT_H 1
 
-#include <stdint.h>
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(HAVE_CONFIG_H)
+#include "../win32/config.h"
+#else
+#ifdef HAVE_CONFIG_H
+#include "../rrd_config.h"
+#endif
+#endif
+
+#ifndef WIN32
+# ifdef HAVE_STDINT_H
+#  include <stdint.h>
+# else
+#   ifdef HAVE_INTTYPES_H
+#      include <inttypes.h>
+#   else
+#      error "you should have stdint.h or inttypes.h to compile this"
+#   endif
+# endif
+#else
+#      include <stdlib.h>
+       typedef signed char     int8_t;
+       typedef unsigned char   uint8_t;
+       typedef signed int      int16_t;
+       typedef unsigned int    uint16_t;
+       typedef signed long int         int32_t;
+       typedef unsigned long int       uint32_t;
+       typedef signed long long int    int64_t;
+       typedef unsigned long long int  uint64_t;
+#endif
+
 
 #ifndef RRDCACHED_DEFAULT_ADDRESS
 # define RRDCACHED_DEFAULT_ADDRESS "unix:/tmp/rrdcached.sock"
 #define RRDCACHED_DEFAULT_PORT "42217"
 #define ENV_RRDCACHED_ADDRESS "RRDCACHED_ADDRESS"
 
+
+// Windows version has no daemon/client support
+
+#ifndef WIN32
 int rrdc_connect (const char *addr);
 int rrdc_is_connected(const char *daemon_addr);
 int rrdc_disconnect (void);
@@ -41,6 +74,13 @@ int rrdc_update (const char *filename, int values_num,
 int rrdc_flush (const char *filename);
 int rrdc_flush_if_daemon (const char *opt_daemon, const char *filename);
 
+#else
+#      define rrdc_flush_if_daemon(a,b) 0
+#      define rrdc_connect(a) 0
+#      define rrdc_is_connected(a) 0
+#      define rrdc_flush(a) 0
+#      define rrdc_update(a,b,c) 0
+#endif
 
 struct rrdc_stats_s
 {