(Minor) cleanup of some of the autoconf code with respect to the handling
[mmh] / config / version.sh
1 #!/bin/sh
2 #
3 # version.sh -- script to create version string(s) for nmh.
4 #
5 # You need to pass the script the version number to use.
6 #
7 # $Id$
8 #
9
10 if [ -z "$1" ]; then
11     echo "usage: version.sh VERSION" 1>&2
12     exit 1
13 fi
14
15 VERSION=$1
16 OFS="$IFS"
17 IFS=:
18 HOSTNAME=unknown
19
20 # Find out the name of the host we are compiling on
21 for prog in uname hostname
22 do
23     for dir in $PATH
24     do
25         if [ ! -f $dir/$prog ]; then
26             continue
27         fi
28         case $prog in
29             uname)      HOSTNAME=`$prog -n`
30                         ;;
31             hostname)   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 = \"nmh-$VERSION [compiled on $HOSTNAME at `date`]\";"
44 echo "char *version_num = \"nmh-$VERSION\";"