From 317bfe8154f420ba6e00ab4fc73bcf53ffd17a04 Mon Sep 17 00:00:00 2001
From: John Kristian <jmkristian@gmail.com>
Date: Sat, 13 Mar 2021 17:37:50 -0800
Subject: [PATCH] Don't repeatedly define the global variable
 re_syntax_options.

---
 external/regex/CMakeLists.txt | 2 +-
 external/regex/regex.h        | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/external/regex/CMakeLists.txt b/external/regex/CMakeLists.txt
index 67207639..76bbf9ba 100644
--- a/external/regex/CMakeLists.txt
+++ b/external/regex/CMakeLists.txt
@@ -18,7 +18,7 @@ if(WIN32 OR CYGWIN) # windows
     )
 
   set_target_properties(regex
-    PROPERTIES COMPILE_FLAGS "-Dbool=int -Dtrue=1 -Dfalse=0 -DUSE_REGEX_STATIC"
+    PROPERTIES COMPILE_FLAGS "-Dbool=int -Dtrue=1 -Dfalse=0 -DREGEX_STATIC"
     )
 
 endif()
diff --git a/external/regex/regex.h b/external/regex/regex.h
index c2a9a4c3..52b5fede 100644
--- a/external/regex/regex.h
+++ b/external/regex/regex.h
@@ -35,17 +35,23 @@
 #if (defined __WIN32__) || (defined _WIN32)
 # ifdef BUILD_REGEX_DLL
 #  define REGEX_DLL_IMPEXP	__DLL_EXPORT__
+#  define REGEX_VARIABLE_IMPEXP	__DLL_EXPORT__
 # elif defined(REGEX_STATIC)
 #  define REGEX_DLL_IMPEXP	 
+#  define REGEX_VARIABLE_IMPEXP
 # elif defined (USE_REGEX_DLL)
 #  define REGEX_DLL_IMPEXP	__DLL_IMPORT__
+#  define REGEX_VARIABLE_IMPEXP	__DLL_IMPORT__
 # elif defined (USE_REGEX_STATIC)
 #  define REGEX_DLL_IMPEXP 	 
+#  define REGEX_VARIABLE_IMPEXP	extern
 # else /* assume USE_REGEX_DLL */
 #  define REGEX_DLL_IMPEXP	__DLL_IMPORT__
+#  define REGEX_VARIABLE_IMPEXP	__DLL_IMPORT__
 # endif
 #else /* __WIN32__ */
 # define REGEX_DLL_IMPEXP	 
+# define REGEX_VARIABLE_IMPEXP
 #endif
 
 /* Allow the use in C++ code.  */
@@ -202,7 +208,7 @@ typedef unsigned long int reg_syntax_t;
    some interfaces).  When a regexp is compiled, the syntax used is
    stored in the pattern buffer, so changing this does not affect
    already-compiled regexps.  */
-REGEX_DLL_IMPEXP reg_syntax_t re_syntax_options;
+REGEX_VARIABLE_IMPEXP reg_syntax_t re_syntax_options;
 
 /* Define combinations of the above bits for the standard possibilities.
    (The [[[ comments delimit what gets put into the Texinfo file, so