From cbfd3c7a890e42d556b505d1774967f1b42a0baf Mon Sep 17 00:00:00 2001 From: Max Khon Date: Sun, 30 Jan 2022 15:50:31 +0700 Subject: [PATCH] MS VC build fixes --- contrib/exodusii/5.22b/exodus/cbind/src/ex_utils.c | 5 ++--- contrib/metis/GKlib/gk_arch.h | 4 ++++ contrib/metis/GKlib/gkregex.c | 2 ++ contrib/netcdf/netcdf-c-4.6.2/config.h.in | 2 ++ contrib/netcdf/netcdf-c-4.6.2/configure | 2 +- contrib/netcdf/netcdf-c-4.6.2/libdispatch/dv2i.c | 1 + contrib/netcdf/netcdf-c-4.6.2/liblib/Makefile.in | 2 +- contrib/netcdf/netcdf-c-4.6.2/ncgen/ncgen.h | 1 + contrib/netcdf/netcdf-c-4.6.2/ncgen3/genlib.h | 4 ++++ 9 files changed, 18 insertions(+), 5 deletions(-) diff --git a/contrib/exodusii/5.22b/exodus/cbind/src/ex_utils.c b/contrib/exodusii/5.22b/exodus/cbind/src/ex_utils.c index d245d105178..baacf13a4fc 100644 --- a/contrib/exodusii/5.22b/exodus/cbind/src/ex_utils.c +++ b/contrib/exodusii/5.22b/exodus/cbind/src/ex_utils.c @@ -46,7 +46,6 @@ #include #include #include -#include #include "exodusII.h" #include "exodusII_int.h" @@ -1255,8 +1254,8 @@ static void ex_swap64 (int64_t v[], int64_t i, int64_t j) static int ex_int_median3(int v[], int iv[], int left, int right) { - ssize_t center; - center = ((ssize_t)left + (ssize_t)right) / 2; + long long center; + center = ((long long)left + (long long)right) / 2; if (v[iv[left]] > v[iv[center]]) ex_swap(iv, left, center); diff --git a/contrib/metis/GKlib/gk_arch.h b/contrib/metis/GKlib/gk_arch.h index 2cb80ccf240..c3ce2137770 100644 --- a/contrib/metis/GKlib/gk_arch.h +++ b/contrib/metis/GKlib/gk_arch.h @@ -59,6 +59,7 @@ typedef ptrdiff_t ssize_t; #endif #ifdef __MSC__ +#if _MSC_VER < 1900 /* MSC does not have rint() function */ #define rint(x) ((int)((x)+0.5)) @@ -68,4 +69,7 @@ typedef ptrdiff_t ssize_t; #endif #endif +#define USE_GKREGEX +#endif + #endif diff --git a/contrib/metis/GKlib/gkregex.c b/contrib/metis/GKlib/gkregex.c index 8a09caab785..04f14855524 100644 --- a/contrib/metis/GKlib/gkregex.c +++ b/contrib/metis/GKlib/gkregex.c @@ -21,6 +21,8 @@ /* this is for removing a compiler warning */ void gkfooo() { return; } +#include "gk_arch.h" + #ifdef USE_GKREGEX #ifdef HAVE_CONFIG_H diff --git a/contrib/netcdf/netcdf-c-4.6.2/config.h.in b/contrib/netcdf/netcdf-c-4.6.2/config.h.in index 3084e7b2532..f350e9bc228 100644 --- a/contrib/netcdf/netcdf-c-4.6.2/config.h.in +++ b/contrib/netcdf/netcdf-c-4.6.2/config.h.in @@ -535,7 +535,9 @@ /* Define strcasecmp, snprintf on Win32 systems. */ #ifdef _WIN32 #define strcasecmp _stricmp +#if defined(__MSC__) && (_MSC_VER < 1900) #define snprintf _snprintf #endif +#endif #include "ncconfigure.h" diff --git a/contrib/netcdf/netcdf-c-4.6.2/configure b/contrib/netcdf/netcdf-c-4.6.2/configure index 92c99c217a6..f5c4f8ce39e 100755 --- a/contrib/netcdf/netcdf-c-4.6.2/configure +++ b/contrib/netcdf/netcdf-c-4.6.2/configure @@ -18818,7 +18818,7 @@ $as_echo "$BINFILE_NAME $FC $CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool needs -no-undefined flag to build shared libraries" >&5 $as_echo_n "checking if libtool needs -no-undefined flag to build shared libraries... " >&6; } case "`uname`" in - CYGWIN*|MINGW*|AIX*) + CYGWIN*|MINGW*|MSYS*|AIX*) ## Add in the -no-undefined flag to LDFLAGS for libtool. { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } diff --git a/contrib/netcdf/netcdf-c-4.6.2/libdispatch/dv2i.c b/contrib/netcdf/netcdf-c-4.6.2/libdispatch/dv2i.c index c7c05a96d2a..b21c1e752c2 100644 --- a/contrib/netcdf/netcdf-c-4.6.2/libdispatch/dv2i.c +++ b/contrib/netcdf/netcdf-c-4.6.2/libdispatch/dv2i.c @@ -13,6 +13,7 @@ See \ref copyright file for copying and redistribution conditions. #include #include "netcdf.h" #include +#include /** \defgroup v2_api The Version 2 API diff --git a/contrib/netcdf/netcdf-c-4.6.2/liblib/Makefile.in b/contrib/netcdf/netcdf-c-4.6.2/liblib/Makefile.in index ad1b5452066..66581c0739b 100644 --- a/contrib/netcdf/netcdf-c-4.6.2/liblib/Makefile.in +++ b/contrib/netcdf/netcdf-c-4.6.2/liblib/Makefile.in @@ -325,7 +325,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ ISCMAKE = @ISCMAKE@ LD = @LD@ -LDFLAGS = @LDFLAGS@ +LDFLAGS = @LDFLAGS@ $(NOUNDEFINED) LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ diff --git a/contrib/netcdf/netcdf-c-4.6.2/ncgen/ncgen.h b/contrib/netcdf/netcdf-c-4.6.2/ncgen/ncgen.h index 739cd60db51..01f563ad5bf 100644 --- a/contrib/netcdf/netcdf-c-4.6.2/ncgen/ncgen.h +++ b/contrib/netcdf/netcdf-c-4.6.2/ncgen/ncgen.h @@ -10,6 +10,7 @@ #include #include "../ncdump/isnan.h" #define strcasecmp _stricmp +#define YY_NO_UNISTD_H #endif #ifdef USE_NETCDF4 diff --git a/contrib/netcdf/netcdf-c-4.6.2/ncgen3/genlib.h b/contrib/netcdf/netcdf-c-4.6.2/ncgen3/genlib.h index 45f139a68e3..488b0db78ab 100644 --- a/contrib/netcdf/netcdf-c-4.6.2/ncgen3/genlib.h +++ b/contrib/netcdf/netcdf-c-4.6.2/ncgen3/genlib.h @@ -9,6 +9,10 @@ #include #include +#ifndef HAVE_UNISTD_H +#define YY_NO_UNISTD_H +#endif + extern const char *progname; /* for error messages */ extern const char *cdlname; /* for error messages */