Whamcloud - gitweb
LU-2677 utils: fix swabbing of f_oid
[fs/lustre-release.git] / autogen.sh
1 #!/bin/sh
2
3 # NOTE: Please avoid bashisms (bash specific syntax) in this script
4
5 # install Lustre Git commit hooks by default - LU-2083
6 for HOOK in commit-msg prepare-commit-msg; do
7         if [ -d .git/hooks -a ! -e .git/hooks/$HOOK ]; then
8                 ln -sf ../../build/$HOOK .git/hooks/
9         fi
10 done
11
12 echo "Checking for a complete tree..."
13 REQUIRED_DIRS="libcfs lnet lustre"
14 OPTIONAL_DIRS="snmp portals"
15 CONFIGURE_DIRS="libsysio lustre-iokit ldiskfs"
16
17 for dir in $REQUIRED_DIRS ; do
18         if [ ! -d "$dir" ] ; then
19                 cat >&2 <<EOF
20 Your tree seems to be missing $dir.
21 Please read README.lustrecvs for details.
22 EOF
23                 exit 1
24         fi
25         ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $PWD/$dir/autoconf"
26 done
27 # optional directories for Lustre
28 for dir in $OPTIONAL_DIRS; do
29         if [ -d "$dir" ] ; then
30                 ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $PWD/$dir/autoconf"
31         fi
32 done
33
34 run_cmd()
35 {
36         cmd="$@"
37         echo -n "Running $cmd"
38         eval $cmd
39         res=$?
40         if [ $res -ne 0 ]; then
41                 echo " failed: $res"
42                 echo "Aborting"
43                 exit 1
44         fi
45         echo
46 }
47
48 run_cmd "aclocal -I $PWD/config $ACLOCAL_FLAGS"
49 run_cmd "autoheader"
50 run_cmd "automake -a -c"
51 run_cmd autoconf
52
53 # Run autogen.sh in these directories
54 PWD_SAVE=$PWD
55 for dir in $CONFIGURE_DIRS; do
56         if [ -d $dir ] ; then
57                 cd $dir
58                 echo "Running autogen for $dir..."
59                 run_cmd "sh autogen.sh"
60         fi
61         cd $PWD_SAVE
62 done