Index: SDL2_mixer-2.0.2/configure.in
===================================================================
--- SDL2_mixer-2.0.2.orig/configure.in
+++ SDL2_mixer-2.0.2/configure.in
@@ -116,7 +116,7 @@
         #VERSION_SOURCES="$srcdir/version.rc"
         EXE=".exe"
     ;;
-    *-*-cygwin* | *-*-mingw32*)
+    *-*-cygwin* | *-*-mingw*)
         VERSION_SOURCES="$srcdir/version.rc"
         EXE=".exe"
         if test "$build" != "$host"; then # cross-compiling
@@ -173,13 +173,14 @@ find_lib()
     gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
     gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
     env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
+    env_path=[`echo $PATH | sed 's/:/ /g'`]
     if test "$cross_compiling" = yes; then
         host_lib_path=""
     else
         host_lib_path="/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`]
+    for path in $env_lib_path $gcc_bin_path $gcc_lib_path $env_path $host_lib_path; do
+        lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
         if test x$lib != x; then
             echo $lib
             return
@@ -257,7 +258,7 @@ if test x$enable_music_mod = xyes -a x$e
             *-*-darwin*)
                 modplug_lib=[`find_lib libmodplug.dylib`]
                 ;;
-            *-*-cygwin* | *-*-mingw32*)
+            *-*-cygwin* | *-*-mingw*)
                 modplug_lib=[`find_lib "libmodplug*.dll"`]
                 ;;
             *)
@@ -324,7 +325,7 @@ return 1;
             *-*-darwin*)
                 mikmod_lib=[`find_lib libmikmod.dylib`]
                 ;;
-            *-*-cygwin* | *-*-mingw32*)
+            *-*-cygwin* | *-*-mingw*)
                 mikmod_lib=[`find_lib "libmikmod*.dll"`]
                 ;;
             *)
@@ -371,7 +372,7 @@ AC_HELP_STRING([--enable-music-midi-nati
             *mingw32ce*)
                 use_music_midi_native=no
                 ;;
-            *-*-cygwin* | *-*-mingw32*)
+            *-*-cygwin* | *-*-mingw*)
                 use_music_midi_native=yes
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lwinmm"
                 ;;
@@ -408,8 +409,11 @@ AC_HELP_STRING([--enable-music-midi-flui
                 *-*-darwin*)
                     fluidsynth_lib=[`find_lib libfluidsynth.dylib`]
                     ;;
-                *-*-cygwin* | *-*-mingw32*)
+                *-*-cygwin* | *-*-mingw*)
                     fluidsynth_lib=[`find_lib "fluidsynth*.dll"`]
+                    if test x$fluidsynth_lib = x; then
+                        fluidsynth_lib=[`find_lib "libfluidsynth*.dll"`]
+                    fi
                     ;;
                 *)
                     fluidsynth_lib=[`find_lib "libfluidsynth[0-9]*.so.*"`]
@@ -456,8 +460,11 @@ if test x$enable_music_ogg = xyes; then
                 *-*-darwin*)
                     ogg_lib=[`find_lib libvorbisidec.dylib`]
                     ;;
-                *-*-cygwin* | *-*-mingw32*)
+                *-*-cygwin* | *-*-mingw*)
                     ogg_lib=[`find_lib "vorbisidec*.dll"`]
+                    if test x$ogg_lib = x; then
+                        ogg_lib=[`find_lib "libvorbisidec*.dll"`]
+                    fi
                     ;;
                 *)
                     ogg_lib=[`find_lib "libvorbisidec[0-9]*.so.*"`]
@@ -485,7 +492,7 @@ if test x$enable_music_ogg = xyes; then
                 *-*-darwin*)
                     ogg_lib=[`find_lib libvorbisfile.dylib`]
                     ;;
-                *-*-cygwin* | *-*-mingw32*)
+                *-*-cygwin* | *-*-mingw*)
                     ogg_lib=[`find_lib "libvorbisfile*.dll"`]
                     ;;
                 *)
@@ -544,7 +551,7 @@ if test x$enable_music_flac = xyes; then
                 *-*-darwin*)
                     flac_lib=[`find_lib libFLAC.dylib`]
                     ;;
-                *-*-cygwin* | *-*-mingw32*)
+                *-*-cygwin* | *-*-mingw*)
                     flac_lib=[`find_lib "libFLAC-*.dll"`]
                     ;;
                 *)
@@ -648,7 +655,7 @@ if test x$enable_music_mp3_mpg123 = xyes
             *-*-darwin*)
                 mpg123_lib=[`find_lib libmpg123.dylib`]
                 ;;
-            *-*-cygwin* | *-*-mingw32*)
+            *-*-cygwin* | *-*-mingw*)
                 mpg123_lib=[`find_lib "libmpg123*.dll"`]
                 ;;
             *)
@@ -674,7 +674,7 @@
             *-*-darwin*)
                 opusfile_lib=[`find_lib libopusfile.dylib`]
                 ;;
-            *-*-cygwin* | *-*-mingw32*)
+            *-*-cygwin* | *-*-mingw*)
                 opusfile_lib=[`find_lib "libopusfile*.dll"`]
                 ;;
             *)
