diff -Nru orig/runjags/src/Makevars.ucrt patched/runjags/src/Makevars.ucrt
--- orig/runjags/src/Makevars.ucrt	1969-12-31 16:00:00.000000000 -0800
+++ patched/runjags/src/Makevars.ucrt	2021-02-22 00:11:07.268722800 -0800
@@ -0,0 +1,93 @@
+######################################################################################################
+###
+###  This file is based on that in the rjags package (version 3-10)
+###  Original file is Copyright (C) Martyn Plummer, licensed under GPL-2
+###
+###  Note:  This windows makefile requires the JAGS_ROOT variable to be set
+###
+###  This file allows compilation between JAGS 3 and 4 (or later) without modifying runjags.
+###  To force the package to compile assuming a given JAGS version is installed, use the 
+###  JAGS_MAJOR_FORCED environmental variable.  This might be necessary on windows if you have
+###  JAGS installed in a non-standard location.
+###  
+###  Once JAGS version 3 is obsolete, the module will be simplified to be dependent on JAGS >= 4
+###  
+###  Matthew Denwood, 29th March 2016
+###
+######################################################################################################
+
+JAGS_MAJOR_VERSION := 4
+
+## Conditionally set the JAGS_ROOT variable (if it is not already set) to a location specified by the CRAN team:
+JAGS_ROOT ?= /c/progra~1/JAGS/JAGS-4.3.0
+
+###############
+###  Flags
+###  The installed major version of JAGS is needed at this stage - we try to guess this from JAGS_ROOT
+###  If you have a non-standard JAGS install (and therefore JAGS_ROOT variable), then see the README file
+###############
+
+# We need to introduce spaces so that we can fool word into splitting the $(JAGS_ROOT) path:
+space :=
+space +=
+
+# First check to see if JAGS_MAJOR_VERSION is defined in the environment and pass that as JAGS_MAJOR_FORCED to -D
+ifneq ($(strip $(JAGS_MAJOR_VERSION)),)
+JAGS_MAJOR = $(strip $(JAGS_MAJOR_VERSION))
+JAGS_MAJOR_ASSUMED = $(strip 0)
+else
+
+# Check if the JAGS_ROOT is standard i.e. we can extract a major version:
+JAGS_VERSION_PRESENT = $(findstring JAGS-,$(JAGS_ROOT))
+
+# If we can detect and extract a JAGS major version:
+ifneq ($(strip $(JAGS_VERSION_PRESENT)),)
+# First substitute / for space:
+JAGS_ROOT_SUB = $(subst /,$(space),$(JAGS_ROOT))
+# Then isolate the JAGS-x.x.x part:
+JAGS_FULL_VERS = $(word $(words $(JAGS_ROOT_SUB)),$(JAGS_ROOT_SUB))
+# Then substitute / for space and extract the major version
+JAGS_MAJOR_ASSUMED = $(strip $(word 2,$(subst .,$(space),$(subst -,$(space),$(JAGS_FULL_VERS)))))
+else
+# Otherwise make an assumption about JAGS_MAJOR and give a warning:
+JAGS_MAJOR_ASSUMED = $(strip 4)
+$(warning The major version of JAGS could not be determined from $(JAGS_ROOT) - assuming version $(JAGS_MAJOR_ASSUMED) (otherwise the Makevars.win file may need to be modified))
+endif
+
+JAGS_MAJOR = $(strip $(JAGS_MAJOR_ASSUMED))
+
+endif
+
+# Set the CPPFLAGS accordingly
+# Prepending 0 to JAGS_MAJOR_VERSION prevents it being set as blank (the C++ code requires a number)
+PKG_CPPFLAGS=-I"$(JAGS_ROOT)/include" -D JAGS_MAJOR_ASSUMED=$(JAGS_MAJOR_ASSUMED) -D JAGS_MAJOR_FORCED=0$(JAGS_MAJOR_VERSION)
+
+PKG_LIBS=-L"$(JAGS_ROOT)/${R_ARCH}/bin" -ljags-$(JAGS_MAJOR)
+
+
+###############
+### Objects to be compiled
+### NB: the objects in distributions/jags are only necessary for JAGS <=3, and are excluded by the sources when compiling against JAGS >= 4
+###############
+
+OBJECTS = distributions/jags/DFunction.o distributions/jags/DPQFunction.o distributions/jags/PFunction.o distributions/jags/QFunction.o distributions/jags/RScalarDist.o distributions/DPar1.o distributions/DPar2.o distributions/DPar3.o distributions/DPar4.o distributions/DLomax.o distributions/DMouchel.o distributions/DGenPar.o distributions/DHalfCauchy.o init.o runjags.o testrunjags.o
+
+###############
+
+
+
+###############
+#### If you still have compilation problems (after reading README) then you can use the following code instead.  Deleting everything above this line and uncomment the two relevant lines below.
+###############
+
+### For JAGS major version <= 3:
+# PKG_CPPFLAGS=-I"$(JAGS_ROOT)/include" -D INCLUDERSCALARDIST
+# PKG_LIBS=-L"$(JAGS_ROOT)/${R_ARCH}/bin" -ljags-3
+# OBJECTS = distributions/jags/DFunction.o distributions/jags/DPQFunction.o distributions/jags/PFunction.o distributions/jags/QFunction.o distributions/jags/RScalarDist.o distributions/DPar1.o distributions/DPar2.o distributions/DPar3.o distributions/DPar4.o distributions/DLomax.o distributions/DMouchel.o distributions/DGenPar.o distributions/DHalfCauchy.o init.o runjags.o testrunjags.o
+
+### For JAGS major version >=4:
+# PKG_CPPFLAGS=-I"$(JAGS_ROOT)/include"
+# PKG_LIBS=-L"$(JAGS_ROOT)/${R_ARCH}/bin" -ljags-4
+# OBJECTS = distributions/DPar1.o distributions/DPar2.o distributions/DPar3.o distributions/DPar4.o distributions/DLomax.o distributions/DMouchel.o distributions/DGenPar.o distributions/DHalfCauchy.o init.o runjags.o testrunjags.o
+
+###############
