Adding in more tests for command line tools.
[awesomized/libmemcached] / config / bootstrap
1 #!/bin/sh
2 # Taken from lighthttpd server (BSD). Thanks Jan!
3 # Run this to generate all the initial makefiles, etc.
4
5 die() { echo "$@"; exit 1; }
6
7 # LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
8 LIBTOOLIZE_FLAGS=" --automake --copy --force"
9 # ACLOCAL=${ACLOCAL:-aclocal}
10 # AUTOHEADER=${AUTOHEADER:-autoheader}
11 # AUTOMAKE=${AUTOMAKE:-automake}
12 AUTOMAKE_FLAGS="--add-missing --copy --force"
13 # AUTOCONF=${AUTOCONF:-autoconf}
14
15 ARGV0=$0
16 ARGS="$@"
17
18
19 run() {
20 echo "$ARGV0: running \`$@' $ARGS"
21 $@ $ARGS
22 }
23
24 ## jump out if one of the programs returns 'false'
25 set -e
26
27 ## We do not currently support glibtoolize
28 if test x$LIBTOOLIZE = x; then
29 # if test \! "x`which glibtoolize 2> /dev/null | grep -v '^no'`" = x; then
30 # LIBTOOLIZE=glibtoolize
31 if test \! "x`which libtoolize-1.5 2> /dev/null | grep -v '^no'`" = x; then
32 LIBTOOLIZE=libtoolize-1.5
33 elif test \! "x`which libtoolize 2> /dev/null | grep -v '^no'`" = x; then
34 LIBTOOLIZE=libtoolize
35 else
36 echo "libtoolize 1.5.x wasn't found, exiting"; exit 0
37 fi
38 fi
39
40 ## suse has aclocal and aclocal-1.9
41 if test x$ACLOCAL = x; then
42 if test \! "x`which aclocal-1.9 2> /dev/null | grep -v '^no'`" = x; then
43 ACLOCAL=aclocal-1.9
44 elif test \! "x`which aclocal19 2> /dev/null | grep -v '^no'`" = x; then
45 ACLOCAL=aclocal19
46 elif test \! "x`which aclocal 2> /dev/null | grep -v '^no'`" = x; then
47 ACLOCAL=aclocal
48 else
49 echo "automake 1.9.x (aclocal) wasn't found, exiting"; exit 0
50 fi
51 fi
52
53 if test x$AUTOMAKE = x; then
54 if test \! "x`which automake-1.9 2> /dev/null | grep -v '^no'`" = x; then
55 AUTOMAKE=automake-1.9
56 elif test \! "x`which automake19 2> /dev/null | grep -v '^no'`" = x; then
57 AUTOMAKE=automake19
58 elif test \! "x`which automake 2> /dev/null | grep -v '^no'`" = x; then
59 AUTOMAKE=automake
60 else
61 echo "automake 1.9.x wasn't found, exiting"; exit 0
62 fi
63 fi
64
65
66 ## macosx has autoconf-2.59 and autoconf-2.60
67 if test x$AUTOCONF = x; then
68 if test \! "x`which autoconf-2.59 2> /dev/null | grep -v '^no'`" = x; then
69 AUTOCONF=autoconf-2.59
70 elif test \! "x`which autoconf259 2> /dev/null | grep -v '^no'`" = x; then
71 AUTOCONF=autoconf259
72 elif test \! "x`which autoconf 2> /dev/null | grep -v '^no'`" = x; then
73 AUTOCONF=autoconf
74 else
75 echo "autoconf 2.59+ wasn't found, exiting"; exit 0
76 fi
77 fi
78
79 if test x$AUTOHEADER = x; then
80 if test \! "x`which autoheader-2.59 2> /dev/null | grep -v '^no'`" = x; then
81 AUTOHEADER=autoheader-2.59
82 elif test \! "x`which autoheader259 2> /dev/null | grep -v '^no'`" = x; then
83 AUTOHEADER=autoheader259
84 elif test \! "x`which autoheader 2> /dev/null | grep -v '^no'`" = x; then
85 AUTOHEADER=autoheader
86 else
87 echo "autoconf 2.59+ (autoheader) wasn't found, exiting"; exit 0
88 fi
89 fi
90
91
92 run $ACLOCAL $ACLOCAL_FLAGS || die "Can't execute aclocal"
93 run $AUTOHEADER || die "Can't execute autoheader"
94
95 # --force means overwrite ltmain.sh script if it already exists
96 run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Can't execute libtoolize"
97
98 # --add-missing instructs automake to install missing auxiliary files
99 # and --force to overwrite them if they already exist
100 run $AUTOMAKE $AUTOMAKE_FLAGS || die "Can't execute automake"
101 run $AUTOCONF || die "Can't execute autoconf"