]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Fix further build errors under Windows (#826)
authorWolfgang Stöggl <c72578@yahoo.de>
Tue, 26 Sep 2017 16:22:21 +0000 (18:22 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Tue, 26 Sep 2017 16:22:21 +0000 (18:22 +0200)
* Define tzname_ for Windows builds (MSC)

- Fixes compilation error, when building under Windows (e.g. VS2015):
  ..\src\strftime.c(248): error C2065: 'tzname': undeclared identifier
- VS defines these variables with a leading underscore: _tzname

* Include win32/rrd_config.h for def of strncasecmp

- Fixes error, when building under Windows (e.g. VS2015):
  error LNK2001: unresolved external symbol _strncasecmp

* Update win32/rrd_config.h, fix VS build errors

- Fix typo: strcasencmp -> strncasecmp
  Fixes error, when building under Windows (e.g. VS2015):
  error LNK2001: unresolved external symbol _strncasecmp
- Define S_ISREG(m)
  Fixes error, when building under Windows (e.g. VS2015):
  error LNK2001: unresolved external symbol _S_ISREG
- Define HAVE_PCRE_COMPILE for Windows builds
  Fixes compilation error, when building under Windows (e.g. VS2015):
  ..\src\rrd_create.c(30): fatal error C1189: #error:
  "you must have either glib with regexp support or libpcre"

src/rrd_strtod.c
src/strftime.c
win32/rrd_config.h

index 0e9e6398b38bb39243ebc28359519be23ad24c01..f4105d89fc8aa6e930ac773b4cc35406812c734d 100644 (file)
@@ -40,6 +40,9 @@
 #include <stdlib.h>
 
 #include "rrd.h"
+#ifdef _MSC_VER
+#include "rrd_config.h" /* for strncasecmp _strnicmp */
+#endif
 #include "rrd_strtod.h"
 
 static int parse_special(const char *str, double *d) {
index 3928a6f01f11a63c922b4080c33c9f11274a6e82..45c39bd09d345dec7d36dee5b5280c4993ddb50f 100644 (file)
@@ -20,6 +20,9 @@
 /* Define your own defaults in config.h if necessary */
 #if defined(TZNAME_STD) && defined(TZNAME_DST)
 char     *tzname_[2] = { TZNAME_STD, TZNAME_DST };
+#elif defined(_MSC_VER)
+/* VS defines these variables with a leading underscore */
+#define tzname_ _tzname
 #else
 #define tzname_ tzname
 #endif
index 3acc3445a9c50b43c4a8be14b4d19e376baeede3..f87d0595e7dfb864d04c8d247107484b1f518879 100644 (file)
@@ -64,6 +64,9 @@
 /* Define to 1 if you have the `isnan' function. */
 #define HAVE_ISNAN 1
 
+/* Define to 1 if you have the <pcre.h> header file. */
+#define HAVE_PCRE_COMPILE 1
+
 /* is rrd_graph supported by this install */
 #define HAVE_RRD_GRAPH /**/
 
 #define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))
 #define realpath(N,R) _fullpath((R),(N),_MAX_PATH)
 #define strcasecmp _stricmp
-#define strcasencmp _strnicmp
+#define strncasecmp _strnicmp
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
 
 // in MSVC++ 12.0 / Visual Studio 2013 is a definition of round in math.h
 // some values of _MSC_VER