btrfs-progs: build, make autogen.sh work on older systems
[platform/upstream/btrfs-progs.git] / autogen.sh
1 #!/bin/sh
2
3 #
4 # Helps generate autoconf stuff, when code is checked out from SCM.
5 #
6 # Copyright (C) 2006-2014 - Karel Zak <kzak@redhat.com>
7 #
8
9 srcdir=`dirname $0`
10 test -z "$srcdir" && srcdir=.
11
12 THEDIR=`pwd`
13 cd $srcdir
14 DIE=0
15
16 test -f btrfs.c || {
17         echo
18         echo "You must run this script in the top-level btrfs-progs directory"
19         echo
20         DIE=1
21 }
22
23 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
24         echo
25         echo "You must have autoconf installed to generate btrfs-progs build system."
26         echo
27         DIE=1
28 }
29 (autoheader --version) < /dev/null > /dev/null 2>&1 || {
30         echo
31         echo "You must have autoheader installed to generate btrfs-progs build system."
32         echo "The autoheader command is part of the GNU autoconf package."
33         echo
34         DIE=1
35 }
36
37 (automake --version) < /dev/null > /dev/null 2>&1 || {
38         echo
39         echo "You must have automake installed to generate btrfs-progs build system."
40         echo 
41         DIE=1
42 }
43
44 if test "$DIE" -eq 1; then
45         exit 1
46 fi
47
48 echo
49 echo "Generate build-system by:"
50 echo "   aclocal:    $(aclocal --version | head -1)"
51 echo "   autoconf:   $(autoconf --version | head -1)"
52 echo "   autoheader: $(autoheader --version | head -1)"
53 echo "   automake:   $(automake --version | head -1)"
54
55 chmod +x version.sh
56 rm -rf autom4te.cache
57
58 aclocal $AL_OPTS
59 autoconf $AC_OPTS
60 autoheader $AH_OPTS
61
62 # it's better to use helper files from automake installation than
63 # maintain copies in git tree
64 find_autofile() {
65         if [ -f "$1" ]; then
66                 return
67         fi
68         for HELPER_DIR in $(automake --print-libdir 2>/dev/null) \
69                         /usr/share/libtool \
70                         /usr/share/automake-* ; do
71                 f="$HELPER_DIR/$1"
72                 if [ -f "$f" ]; then
73                         cp "$f" config/
74                         return
75                 fi
76         done
77         echo "Cannot find "$1" in known locations"
78         exit 1
79 }
80
81 mkdir -p config/
82 find_autofile config.guess
83 find_autofile config.sub
84 find_autofile install-sh
85
86 cd $THEDIR
87
88 echo
89 echo "Now type '$srcdir/configure' and 'make' to compile."
90 echo