SDL: cmake: emscripten has libunwind.h, libunwind.a has missing symbols

From 55384db8a628b4c3958004977257c9ee9112a17d Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Tue, 1 Nov 2022 13:09:29 +0100
Subject: [PATCH] cmake: emscripten has libunwind.h, libunwind.a has missing
 symbols

---
 CMakeLists.txt | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 51595bc5131f..4eec086abb1f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1009,7 +1009,6 @@ if(SDL_LIBC)
         float.h
         iconv.h
         inttypes.h
-        libunwind
         limits.h
         malloc.h
         math.h
@@ -1025,6 +1024,9 @@ if(SDL_LIBC)
         sys/types.h
         wchar.h
     )
+    if(NOT EMSCRIPTEN)
+      list(APPEND headers_to_check libunwind.h)
+    endif()
     foreach(_HEADER ${headers_to_check})
       string(TOUPPER "HAVE_${_HEADER}" _UPPER)
       string(REGEX REPLACE "[./]" "_" _HAVE_H ${_UPPER})
@@ -1399,6 +1401,10 @@ elseif(EMSCRIPTEN)
 
   CheckPTHREAD()
 
+  if(HAVE_LIBUNWIND_H)
+    list(APPEND EXTRA_TEST_LIBS unwind)
+  endif()
+
 elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
   if(SDL_AUDIO)
     if(SYSV5 OR SOLARIS OR HPUX)