From db7691aee13a86434081cf3b09cf2dd5f1066359 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <sezeroz@gmail.com>
Date: Thu, 29 May 2025 04:00:30 +0300
Subject: [PATCH] builds/unix/configure.raw: look for dlopen first in libc, then in libdl.

---
 builds/unix/configure.raw |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index 0232ead..fa1e25f 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -469,11 +469,14 @@ have_harfbuzz_dynamic=no
 if test x"$have_harfbuzz" = xno; then
   if test x"$with_harfbuzz" = xdynamic -o x"$with_harfbuzz" = xauto; then
     # Check for libdl
-    AC_CHECK_LIB([dl], [dlopen], [have_harfbuzz_dynamic=yes])
+    AC_CHECK_LIB([c], [dlopen], [have_harfbuzz_dynamic=yes],
+       AC_CHECK_LIB([dl], [dlopen], [have_harfbuzz_dynamic=yes; need_libdl=yes]))
     if test x"$have_harfbuzz_dynamic" = xyes; then
       have_harfbuzz="yes (dynamic)"
       HARFBUZZ_CFLAGS=
-      HARFBUZZ_LIBS="-ldl"
+      if test x"$need_libdl" = xyes; then
+         HARFBUZZ_LIBS="-ldl"
+      fi
     fi
   fi
 fi
