https://gitlab.gnome.org/GNOME/gimp/-/issues/15750
https://gitlab.gnome.org/GNOME/gimp/-/commit/a22b7c895cba10ffcf00ce66f656d1473de62685

From a22b7c895cba10ffcf00ce66f656d1473de62685 Mon Sep 17 00:00:00 2001
From: Bruno Lopes <brunvonlope@outlook.com>
Date: Sun, 25 Jan 2026 11:11:48 -0300
Subject: [PATCH] meson: Fix libunwind header detection on non-macOS platforms

Closes: #15750
(cherry picked from commit 1aa51ca0637db88a4ea958d03fa6692e6ac0289b)
--- a/meson.build
+++ b/meson.build
@@ -731,11 +731,14 @@ conf.set('HAVE_LIBBACKTRACE', libbacktrace.found())
 ## Check for libunwind
 # In most platforms, unw_*() functions are in the libunwind library.
 # In macOS, it is on libSystem (there we only need the SDK header).
-libunwind = ( get_option('libunwind')
-  ? dependency('libunwind', version: '>=1.1.0', required: false)
-  : no_dep
-)
-have_unwind = libunwind.found() or cc.has_header('libunwind.h', required: false)
+libunwind = no_dep
+if get_option('libunwind')
+  libunwind = dependency('libunwind', version: '>=1.1.0', required: false)
+  libunwind_h = platform_osx ? cc.has_header('libunwind.h', required: false) : false
+  have_unwind = libunwind.found() or libunwind_h
+else
+  have_unwind = false
+endif
 conf.set('HAVE_LIBUNWIND', have_unwind ? 1 : false)
 
 ## Check for backtrace() API
@@ -758,11 +761,11 @@ if platform_windows
 elif platform_linux
   if not have_execinfo_h
     dashboard_backtrace='no (missing: execinfo.h)'
-  elif not libbacktrace.found() and not libunwind.found()
+  elif not libbacktrace.found() and not have_unwind
     dashboard_backtrace='rough (missing: libbacktrace and libunwind)'
   elif not libbacktrace.found()
     dashboard_backtrace='partially detailed (missing: libbacktrace)'
-  elif not libunwind.found()
+  elif not have_unwind
     dashboard_backtrace='partially detailed (missing: libunwind)'
   else
     dashboard_backtrace='detailed'
-- 
GitLab

