Cleanup addon to `mhbuild: Removed support for message/external-body'.
[mmh] / config / version.sh
1 #!/bin/sh
2 #
3 # version.sh -- script to create version string(s) for mmh.
4 #
5 # You need to pass the script the version number to use.
6 #
7
8 if [ -z "$1" ]; then
9         echo "usage: version.sh VERSION" 1>&2
10         exit 1
11 fi
12
13 VERSION=$1
14 OFS="$IFS"
15 IFS=:
16 HOSTNAME=unknown
17
18 # Find out the name of the host we are compiling on
19 for prog in uname hostname
20 do
21         for dir in $PATH
22         do
23                 if [ ! -f $dir/$prog ]; then
24                         continue
25                 fi
26                 case $prog in
27                         uname)
28                                 HOSTNAME=`$prog -n`
29                                 ;;
30                         hostname)
31                                 HOSTNAME=`$prog`
32                                 ;;
33                 esac
34                 break
35         done
36         if [ X"$HOSTNAME" != X  -a  X"$HOSTNAME" != Xunknown ]; then
37                 break
38         fi
39 done
40
41 IFS=" "
42
43 echo "char *version_str = \"mmh-$VERSION [compiled on $HOSTNAME at `date`]\";"
44 echo "char *version_num = \"mmh-$VERSION\";"