2 # GNU C library version detection shell script.
3 # Copyright 1999 Branden Robinson.
4 # Licensed under the GNU General Public License, version 2. See the file
5 # /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
7 # This script probably makes about a billion too many assumptions, but it's
8 # better than hardcoding the glibc version on a per-architecture basis.
13 echo "Usage: getglibcversion [option]"
14 echo " Where [option] may be one of:"
15 echo " --major return major version only"
16 echo " --minor return minor version only"
17 echo " --point return ittybitty version only"
18 echo "With no option, returns major.minor.ittybitty .";
38 LIBCLIST=$(cd /lib && ls libc-*.so)
40 case $(echo $LIBCLIST | wc -l | awk '{print $1}') in
41 0) echo "No GNU C library found! Aborting." >&2
44 *) echo "Multiple versions of GNU C library found! Aborting." >&2
48 LIBCVERSION=$(echo $LIBCLIST | sed 's/libc-//;s/\.so//')
50 if [ -z $RETURN ]; then
53 echo $LIBCVERSION | cut -d. -f$RETURN