mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-04 14:24:57 +08:00
Sort libraries by version and pick the shortest symlink (thanks @jpalus!)
Fixes https://github.com/libsdl-org/SDL_image/issues/289
This commit is contained in:
+6
-9
@@ -58,6 +58,7 @@ dnl Detect the canonical build and host environments
|
||||
dnl AC_CANONICAL_HOST
|
||||
|
||||
dnl Check for tools
|
||||
AC_PROG_AWK
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_PROG_EGREP
|
||||
@@ -65,6 +66,10 @@ AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
if [ test -z "$AWK" ]; then
|
||||
AC_MSG_ERROR([*** awk not found, aborting])
|
||||
fi
|
||||
|
||||
dnl 64-bit file offsets if possible unless --disable-largefile is specified
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
@@ -181,15 +186,7 @@ find_lib()
|
||||
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`]
|
||||
if test x$lib != x; then
|
||||
echo $lib
|
||||
return
|
||||
fi
|
||||
done
|
||||
# Try again, this time allowing more than one version digit after the .so
|
||||
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 's,.*/,,' | sort | tail -1`]
|
||||
lib=[`ls -- $path/$1 2>/dev/null | sed 's,.*/,,' | sort -V -r | $AWK 'BEGIN{FS="."}{ print NF, $0 }' | sort -n -s | sed 's,[0-9]* ,,' | head -1`]
|
||||
if test x$lib != x; then
|
||||
echo $lib
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user