#!/bin/sh

ver=$(cat VERSION)

if test -d .git ; then
if type git >/dev/null 2>&1 ; then
tmp=$(git describe --tags --match v"$ver" 2>/dev/null)
if test "${tmp%%-*}" = "v$ver" ; then
tmp=${tmp#*-}
else
tmp=unknown
fi
else
tmp=unknown
fi
ver=$ver-git-$tmp
fi

printf 'const char *__libc_version()\n{\n\treturn "%s";\n}\n' "$ver"
