Whamcloud - gitweb
get rid of --smfs-enable options after merge in HEAD
[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" -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 cmd
62     local required
63     local version
64
65     cmd=$1
66     required=$2
67     echo -n "checking for $cmd $required... "
68     if ! $cmd --version >/dev/null ; then
69         error_msg "missing"
70     fi
71     version=$($cmd --version | awk "BEGIN { IGNORECASE=1 } /$cmd \(GNU $cmd\)/ { print \$4 }")
72     echo "found $version"
73     if ! compare_versions "$required" "$version" ; then
74         error_msg "too old"
75     fi
76 }
77
78 check_version automake "1.7.8"
79 check_version autoconf "2.57"
80 echo "Running aclocal..."
81 aclocal
82 echo "Running autoheader..."
83 autoheader
84 echo "Running automake..."
85 automake -a -c
86 echo "Running autoconf..."
87 autoconf
88