Only use generic stacktrace when ABSL_HAVE_THREAD_LOCAL.

The file uses __thread, so it should not be included when thread-local storage is not available.

PiperOrigin-RevId: 783193545
Change-Id: I64ca0fde08d2aa0e478d75f3d5fbb3a5bfcea452
diff --git a/absl/debugging/internal/stacktrace_config.h b/absl/debugging/internal/stacktrace_config.h
index 88949fe..c82d4a3 100644
--- a/absl/debugging/internal/stacktrace_config.h
+++ b/absl/debugging/internal/stacktrace_config.h
@@ -43,11 +43,12 @@
   "absl/debugging/internal/stacktrace_emscripten-inl.inc"
 
 #elif defined(__ANDROID__) && __ANDROID_API__ >= 33
-
+#ifdef ABSL_HAVE_THREAD_LOCAL
 // Use the generic implementation for Android 33+ (Android T+). This is the
 // first version of Android for which <execinfo.h> implements backtrace().
 #define ABSL_STACKTRACE_INL_HEADER \
   "absl/debugging/internal/stacktrace_generic-inl.inc"
+#endif  // defined(ABSL_HAVE_THREAD_LOCAL)
 
 #elif defined(__linux__) && !defined(__ANDROID__)
 
@@ -59,11 +60,11 @@
   "absl/debugging/internal/stacktrace_libunwind-inl.inc"
 #define STACKTRACE_USES_LIBUNWIND 1
 #elif defined(NO_FRAME_POINTER) && defined(__has_include)
-#if __has_include(<execinfo.h>)
+#if __has_include(<execinfo.h>) && defined(ABSL_HAVE_THREAD_LOCAL)
 // Note: When using glibc this may require -funwind-tables to function properly.
 #define ABSL_STACKTRACE_INL_HEADER \
   "absl/debugging/internal/stacktrace_generic-inl.inc"
-#endif  // __has_include(<execinfo.h>)
+#endif  // __has_include(<execinfo.h>) && defined(ABSL_HAVE_THREAD_LOCAL)
 #elif defined(__i386__) || defined(__x86_64__)
 #define ABSL_STACKTRACE_INL_HEADER \
   "absl/debugging/internal/stacktrace_x86-inl.inc"
@@ -77,11 +78,11 @@
 #define ABSL_STACKTRACE_INL_HEADER \
   "absl/debugging/internal/stacktrace_riscv-inl.inc"
 #elif defined(__has_include)
-#if __has_include(<execinfo.h>)
+#if __has_include(<execinfo.h>) && defined(ABSL_HAVE_THREAD_LOCAL)
 // Note: When using glibc this may require -funwind-tables to function properly.
 #define ABSL_STACKTRACE_INL_HEADER \
   "absl/debugging/internal/stacktrace_generic-inl.inc"
-#endif  // __has_include(<execinfo.h>)
+#endif  // __has_include(<execinfo.h>) && defined(ABSL_HAVE_THREAD_LOCAL)
 #endif  // defined(__has_include)
 
 #endif  // defined(__linux__) && !defined(__ANDROID__)