configure: use -r option for pr when listing enabled config options.
[libav.git] / version.sh
CommitLineData
f1cc88a5
DB
1#!/bin/sh
2
31c194e7 3revision=$(cd "$1" && cat snapshot_version 2> /dev/null)
f318ee3e 4test "$revision" && revision=SVN-r$revision
a66d63a9 5
40eaf780 6# check for git short hash
f318ee3e 7if ! test "$revision"; then
8032d1de 8 revision=$(cd "$1" && git describe --always 2> /dev/null)
f318ee3e 9 test "$revision" && revision=git-$revision
40eaf780
AJ
10fi
11
de2c2b5a 12# no revision number found
f318ee3e 13test "$revision" || revision=UNKNOWN
123103ca 14
de2c2b5a 15# releases extract the version number from the VERSION file
8202d905 16version=$(cd "$1" && cat VERSION 2> /dev/null)
f318ee3e 17test "$version" || version=$revision
ac63af34 18
de2c2b5a
DB
19test -n "$3" && version=$version-$3
20
16064462
MR
21if [ -z "$2" ]; then
22 echo "$version"
23 exit
24fi
25
a03be6e1 26NEW_REVISION="#define LIBAV_VERSION \"$version\""
d33a14e4 27OLD_REVISION=$(cat version.h 2> /dev/null)
f1cc88a5
DB
28
29# Update version.h only on revision changes to avoid spurious rebuilds
30if test "$NEW_REVISION" != "$OLD_REVISION"; then
9e6165b5 31 echo "$NEW_REVISION" > "$2"
f1cc88a5 32fi