commit 62c8b62c5efa78dadf25a3ffdcdfe84601ef33d0
Author: Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Mon Oct 9 10:36:44 2017 +0200
Commit: Fabian Greffrath <fabian@greffrath.com>
CommitDate: Mon Oct 9 10:36:48 2017 +0200
config: only define str[n]casecmp if necessary
Recent versions of MinGW-W64 already have these symbols defined and
throw a warning if we attempt to re-define them.
---
configure.ac | 1 +
src/doomtype.h | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 05e83b78..b367be91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,6 +77,7 @@ AC_CHECK_LIB(m, log)
AC_CHECK_HEADERS([linux/kd.h dev/isa/spkrio.h dev/speaker/speaker.h])
AC_CHECK_FUNCS(mmap ioperm)
+AC_CHECK_DECLS([strcasecmp, strncasecmp], [], [], [[#include <strings.h>]])
# OpenBSD I/O i386 library for I/O port access.
# (64 bit has the same thing with a different name!)
diff --git a/src/doomtype.h b/src/doomtype.h
index e0152179..b659fe69 100644
--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -21,6 +21,8 @@
#ifndef __DOOMTYPE__
#define __DOOMTYPE__
+#include "config.h"
+
#if defined(_MSC_VER) && !defined(__cplusplus)
#define inline __inline
#endif
@@ -29,11 +31,15 @@
// Outside Windows, we use strings.h for str[n]casecmp.
-#ifdef _WIN32
+#if !HAVE_DECL_STRCASECMP || !HAVE_DECL_STRNCASECMP
#include <string.h>
+#if !HAVE_DECL_STRCASECMP
#define strcasecmp stricmp
+#endif
+#if !HAVE_DECL_STRNCASECMP
#define strncasecmp strnicmp
+#endif
#else