From 85b75ee92583fcbd173e32fa58c3d2ac7abd6e0f Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 7 May 2022 17:50:56 +0300
Subject: [PATCH] Fix detection of dynamic libraries with MinGW
Cherry-picked from SDL_image (https://github.com/libsdl-org/SDL_image/pull/192)
Original patch authored by Cameron Cawley (@ccawley2011)
---
configure | 5 ++++-
configure.ac | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 5309df2b..0da1ac03 100755
--- a/configure
+++ b/configure
@@ -14931,6 +14931,8 @@ case "$host" in
# Look for the location of the tools and install there
if test "$BUILD_PREFIX" != ""; then
ac_default_prefix=$BUILD_PREFIX
+ elif test "$MINGW_PREFIX" != ""; then
+ ac_default_prefix=$MINGW_PREFIX
fi
fi
;;
@@ -14950,6 +14952,7 @@ $srcdir/load_voc.c \
$srcdir/mixer.c \
$srcdir/music.c"
+base_bindir=`echo \${bindir} | sed 's/.*\/\(.*\)/\1/; q'`
base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
CheckWarnAll()
@@ -15050,7 +15053,7 @@ find_lib()
if test "$cross_compiling" = yes; then
host_lib_path=""
else
- host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
+ host_lib_path="$ac_default_prefix/$base_libdir $ac_default_prefix/$base_bindir /usr/$base_libdir /usr/local/$base_libdir"
fi
for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
lib=`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`
diff --git a/configure.ac b/configure.ac
index c22f0c6e..191967ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,8 @@ case "$host" in
# Look for the location of the tools and install there
if test "$BUILD_PREFIX" != ""; then
ac_default_prefix=$BUILD_PREFIX
+ elif test "$MINGW_PREFIX" != ""; then
+ ac_default_prefix=$MINGW_PREFIX
fi
fi
;;
@@ -139,6 +141,7 @@ $srcdir/mixer.c \
$srcdir/music.c"
dnl set this to use on systems that use lib64 instead of lib
+base_bindir=`echo \${bindir} | sed 's/.*\/\(.*\)/\1/; q'`
base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
dnl See if GCC's -Wall is supported.
@@ -208,7 +211,7 @@ find_lib()
if test "$cross_compiling" = yes; then
host_lib_path=""
else
- host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
+ host_lib_path="$ac_default_prefix/$base_libdir $ac_default_prefix/$base_bindir /usr/$base_libdir /usr/local/$base_libdir"
fi
for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`]