configure: Make sure that HAVE_MKSTEMP is always #defined to a value
[mplayer.git] / version.sh
blob6bece77305e101d89ee087016cd153aa4648f1ad
1 #!/bin/sh
3 test "$1" && extra="-$1"
5 # Extract revision number from file used by daily tarball snapshots
6 # or from the places different Subversion versions have it.
7 git_revision=$(cat snapshot_version 2> /dev/null)
8 test $git_revision || test -d .git && git_revision=`git describe --always`
9 test $git_revision && git_revision=git-$git_revision
10 test $git_revision || git_revision=UNKNOWN
12 # releases extract the version number from the VERSION file
13 version=$(cat VERSION 2> /dev/null)
14 test $version || version=$git_revision
16 NEW_REVISION="#define VERSION \"${version}${extra}\""
17 OLD_REVISION=$(head -n 1 version.h 2> /dev/null)
18 TITLE='#define MP_TITLE "%s "VERSION" (C) 2000-2010 MPlayer Team\n"'
20 # Update version.h only on revision changes to avoid spurious rebuilds
21 if test "$NEW_REVISION" != "$OLD_REVISION"; then
22 cat <<EOF > version.h
23 $NEW_REVISION
24 $TITLE
25 EOF