pull common static init header

PiperOrigin-RevId: 801754167
diff --git a/c/common/static_init.h b/c/common/static_init.h
new file mode 100644
index 0000000..12744de
--- /dev/null
+++ b/c/common/static_init.h
@@ -0,0 +1,56 @@
+/* Copyright 2025 Google Inc. All Rights Reserved.
+
+   Distributed under MIT license.
+   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/*
+   Central point for static initialization.
+
+   In case of "lazy" mode `BrotliXxxLazyStaticInit` is not provided by the
+   library. Embedder is responsible for providing it. This function should call
+   `BrotliXxxLazyStaticInitInner` on the first invocation. This function should
+   not return until execution of `BrotliXxxLazyStaticInitInner` is finished.
+   In C or before C++11 it is possible to call `BrotliXxxLazyStaticInitInner`
+   on start-up path and then `BrotliEncoderLazyStaticInit` is could be no-op;
+   another option is to use available thread execution controls to meet the
+   requirements. For possible C++11 implementation see static_init_lazy.cc.
+*/
+
+#ifndef THIRD_PARTY_BROTLI_COMMON_STATIC_INIT_H_
+#define THIRD_PARTY_BROTLI_COMMON_STATIC_INIT_H_
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* Static data is "initialized" in compile time. */
+#define BROTLI_STATIC_INIT_NONE 0
+/* Static data is initialized before "main". */
+#define BROTLI_STATIC_INIT_EARLY 1
+/* Static data is initialized when first encoder is created. */
+#define BROTLI_STATIC_INIT_LAZY 2
+
+#define BROTLI_STATIC_INIT_DEFAULT BROTLI_STATIC_INIT_NONE
+
+#if !defined(BROTLI_STATIC_INIT)
+#define BROTLI_STATIC_INIT BROTLI_STATIC_INIT_DEFAULT
+#endif
+
+#if (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_NONE) && \
+    (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_EARLY) && \
+    (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_LAZY)
+#error Invalid value for BROTLI_STATIC_INIT
+#endif
+
+#if (BROTLI_STATIC_INIT == BROTLI_STATIC_INIT_EARLY)
+#if defined(BROTLI_EXTERNAL_DICTIONARY_DATA)
+#error BROTLI_STATIC_INIT_EARLY will fail with BROTLI_EXTERNAL_DICTIONARY_DATA
+#endif
+#endif  /* BROTLI_STATIC_INIT */
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}  /* extern "C" */
+#endif
+
+#endif  // THIRD_PARTY_BROTLI_COMMON_STATIC_INIT_H_
diff --git a/c/enc/static_init.c b/c/enc/static_init.c
index a7e0833..c0dff3a 100644
--- a/c/enc/static_init.c
+++ b/c/enc/static_init.c
@@ -4,14 +4,16 @@
    See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
 */
 
-/* Central point for static initialization. */
-
 #include "static_init.h"
 
-#include "../common/dictionary.h"
 #include "../common/platform.h"
+#include "../common/static_init.h"
+
+#if (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_NONE)
+#include "../common/dictionary.h"
 #include "dictionary_hash.h"
 #include "static_dict_lut.h"
+#endif
 
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
@@ -28,7 +30,7 @@
   if (!ok) return BROTLI_FALSE;
   return BROTLI_TRUE;
 }
-#endif
+#endif  /* BROTLI_STATIC_INIT_NONE */
 
 #if (BROTLI_STATIC_INIT == BROTLI_STATIC_INIT_EARLY)
 static BROTLI_BOOL kEarlyInitOk;
@@ -40,7 +42,7 @@
 void BrotliEncoderLazyStaticInitInner(void) {
   kLazyInitOk = DoBrotliEncoderStaticInit();
 }
-#endif
+#endif  /* BROTLI_STATIC_INIT_EARLY */
 
 BROTLI_BOOL BrotliEncoderEnsureStaticInit(void) {
 #if (BROTLI_STATIC_INIT == BROTLI_STATIC_INIT_NONE)
diff --git a/c/enc/static_init.h b/c/enc/static_init.h
index d0b1580..e5cb239 100644
--- a/c/enc/static_init.h
+++ b/c/enc/static_init.h
@@ -10,45 +10,14 @@
 #define THIRD_PARTY_BROTLI_ENC_STATIC_INIT_H_
 
 #include "../common/platform.h"
+#include "../common/static_init.h"
 
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
 #endif
 
-/* Static data is "initialized" in compile time. */
-#define BROTLI_STATIC_INIT_NONE 0
-/* Static data is initialized before "main". */
-#define BROTLI_STATIC_INIT_EARLY 1
-/* Static data is initialized when first encoder is created. */
-#define BROTLI_STATIC_INIT_LAZY 2
-
-#define BROTLI_STATIC_INIT_DEFAULT BROTLI_STATIC_INIT_NONE
-
-#if !defined(BROTLI_STATIC_INIT)
-#define BROTLI_STATIC_INIT BROTLI_STATIC_INIT_DEFAULT
-#endif
-
-#if (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_NONE) && \
-    (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_EARLY) && \
-    (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_LAZY)
-#error Invalid value for BROTLI_STATIC_INIT
-#endif
-
-#if (BROTLI_STATIC_INIT == BROTLI_STATIC_INIT_EARLY)
-#if defined(BROTLI_EXTERNAL_DICTIONARY_DATA)
-#error BROTLI_STATIC_INIT_EARLY will fail with BROTLI_EXTERNAL_DICTIONARY_DATA
-#endif
-#elif (BROTLI_STATIC_INIT == BROTLI_STATIC_INIT_LAZY)
+#if (BROTLI_STATIC_INIT == BROTLI_STATIC_INIT_LAZY)
 BROTLI_INTERNAL void BrotliEncoderLazyStaticInitInner(void);
-/* This function is not provided by library. Embedder is responsible for
-   providing it. This function should call `BrotliEncoderLazyStaticInitInner` on
-   the first invocation. This function should not return until execution of
-   `BrotliEncoderLazyStaticInitInner` is finished. In C or before C++11 it is
-   possible to call `BrotliEncoderLazyStaticInitInner` on start-up path and then
-   `BrotliEncoderLazyStaticInit` is could be no-op; another option is to use
-   available thread execution controls to meet the requirements.
-   For possible C++11 implementation see static_init_lazy.cc.
- */
 BROTLI_INTERNAL void BrotliEncoderLazyStaticInit(void);
 #endif  /* BROTLI_STATIC_INIT */
 
diff --git a/setup.py b/setup.py
index 6dd7b3b..5355ed8 100644
--- a/setup.py
+++ b/setup.py
@@ -265,6 +265,7 @@
                 'c/common/dictionary.h',
                 'c/common/platform.h',
                 'c/common/shared_dictionary_internal.h',
+                'c/common/static_init.h',
                 'c/common/transform.h',
                 'c/common/version.h',
                 'c/dec/bit_reader.h',