ref: 62c8b62c5efa78dadf25a3ffdcdfe84601ef33d0
parent: 6e8dc57e94f9d00a82fe8272e210d238b7a4f17f
author: Fabian Greffrath <[email protected]>
date: Mon Oct 9 06:36:44 EDT 2017
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.
--- a/configure.ac
+++ b/configure.ac
@@ -77,6 +77,7 @@
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!)
--- 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