Whamcloud - gitweb
- landing b_fid.
[fs/lustre-release.git] / lustre / autogen.sh
1 #!/bin/bash
2
3 # taken from gnome-common/macros2/autogen.sh
4 compare_versions() {
5     ch_min_version=$1
6     ch_actual_version=$2
7     ch_status=0
8     IFS="${IFS=         }"; ch_save_IFS="$IFS"; IFS="."
9     set $ch_actual_version
10     for ch_min in $ch_min_version; do
11         ch_cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes
12         if [ -z "$ch_min" ]; then break; fi
13         if [ -z "$ch_cur" ]; then ch_status=1; break; fi
14         if [ $ch_cur -gt $ch_min ]; then break; fi
15         if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi
16     done
17     IFS="$ch_save_IFS"
18     return $ch_status
19 }
20
21 error_msg() {
22         echo "$cmd is $1.  version $required is required to build Lustre."
23
24         if [ -e /usr/lib/autolustre/bin/$cmd ]; then
25                 cat >&2 <<-EOF
26                 You apparently already have Lustre-specific autoconf/make RPMs
27                 installed on your system at /usr/lib/autolustre/share/$cmd.
28                 Please set your PATH to point to those versions:
29
30                 export PATH="/usr/lib/autolustre/bin:\$PATH"
31                 EOF
32         else
33                 cat >&2 <<-EOF
34                 CFS provides RPMs which can be installed alongside your
35                 existing autoconf/make RPMs, if you are nervous about
36                 upgrading.  See
37
38                 ftp://ftp.lustre.org/pub/other/autolustre/README.autolustre
39
40                 You may be able to download newer version from:
41
42                 http://ftp.gnu.org/gnu/$cmd/$cmd-$required.tar.gz
43         EOF
44         fi
45         [ "$cmd" = "autoconf" -a "$required" = "2.57" ] && cat >&2 <<EOF
46
47 or for RH9 systems you can use:
48
49 ftp://fr2.rpmfind.net/linux/redhat/9/en/os/i386/RedHat/RPMS/autoconf-2.57-3.noarch.rpm
50 EOF
51         [ "$cmd" = "automake-1.7" -a "$required" = "1.7.8" ] && cat >&2 <<EOF
52
53 or for RH9 systems you can use:
54
55 ftp://fr2.rpmfind.net/linux/fedora/core/1/i386/os/Fedora/RPMS/automake-1.7.8-1.noarch.rpm
56 EOF
57         exit 1
58 }
59
60 check_version() {
61     local tool
62     local cmd
63     local required
64     local version
65
66     tool=$1
67     cmd=$2
68     required=$3
69     echo -n "checking for $cmd $required... "
70     if ! $cmd --version >/dev/null ; then
71         error_msg "missing"
72     fi
73     version=$($cmd --version | awk "BEGIN { IGNORECASE=1 } /$tool \(GNU $tool\)/ { print \$4 }")
74     echo "found $version"
75     if ! compare_versions "$required" "$version" ; then
76         error_msg "too old"
77     fi
78 }
79
80 check_version automake automake-1.7 "1.7.8"
81 check_version autoconf autoconf "2.57"
82 echo "Running aclocal..."
83 aclocal-1.7
84 echo "Running autoheader..."
85 autoheader
86 echo "Running automake..."
87 automake-1.7 -a -c
88 echo "Running autoconf..."
89 autoconf
90