Remove historical bootstrap script
[awesomized/libmemcached] / config / autorun.sh
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 # --force means overwrite ltmain.sh script if it already exists
8 LIBTOOLIZE_FLAGS=" --automake --copy --force"
9 # --add-missing instructs automake to install missing auxiliary files
10 # and --force to overwrite them if they already exist
11 AUTOMAKE_FLAGS="--add-missing --copy --force"
12 ACLOCAL_FLAGS="-I m4"
13
14 ARGV0=$0
15 ARGS="$@"
16
17 run() {
18 echo "$ARGV0: running \`$@' $ARGS"
19 $@ $ARGS
20 }
21
22 # Try to locate a program by using which, and verify that the file is an
23 # executable
24 locate_binary() {
25 for f in $@
26 do
27 file=`which $f 2>/dev/null | grep -v '^no '`
28 if test -n "$file" -a -x "$file"; then
29 echo $file
30 return 0
31 fi
32 done
33
34 echo ""
35 return 1
36 }
37
38
39 if test -f config/pre_hook.sh
40 then
41 . config/pre_hook.sh
42 fi
43
44 # We need to some file here for the m4_sinclude, even if it's just empty
45 if test ! -f config/plugin.ac
46 then
47 touch config/plugin.ac
48 fi
49
50 # Try to detect the supported binaries if the user didn't
51 # override that by pushing the environment variable
52 if test x$LIBTOOLIZE = x; then
53 LIBTOOLIZE=`locate_binary glibtoolize libtoolize-1.5 libtoolize`
54 if test x$LIBTOOLIZE = x; then
55 die "Did not find a supported libtoolize"
56 fi
57 fi
58
59 if test x$ACLOCAL = x; then
60 ACLOCAL=`locate_binary aclocal-1.11 aclocal-1.10 aclocal-1.9 aclocal19 aclocal`
61 if test x$ACLOCAL = x; then
62 die "Did not find a supported aclocal"
63 fi
64 fi
65
66 if test x$AUTOMAKE = x; then
67 AUTOMAKE=`locate_binary automake-1.11 automake-1.10 automake-1.9 automake19 automake`
68 if test x$AUTOMAKE = x; then
69 die "Did not find a supported automake"
70 fi
71 fi
72
73 if test x$AUTOCONF = x; then
74 AUTOCONF=`locate_binary autoconf-2.59 autoconf259 autoconf`
75 if test x$AUTOCONF = x; then
76 die "Did not find a supported autoconf"
77 fi
78 fi
79
80 if test x$AUTOHEADER = x; then
81 AUTOHEADER=`locate_binary autoheader-2.59 autoheader259 autoheader`
82 if test x$AUTOHEADER = x; then
83 die "Did not find a supported autoheader"
84 fi
85 fi
86
87 run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Can't execute libtoolize"
88 run $ACLOCAL $ACLOCAL_FLAGS || die "Can't execute aclocal"
89 run $AUTOHEADER || die "Can't execute autoheader"
90 run $AUTOMAKE $AUTOMAKE_FLAGS || die "Can't execute automake"
91 run $AUTOCONF || die "Can't execute autoconf"
92
93 if test -f config/post_hook.sh
94 then
95 . config/post_hook.sh
96 fi
97
98 echo "---"
99 echo "Configured with the following tools:"
100 echo " * `$LIBTOOLIZE --version | head -1`"
101 echo " * `$ACLOCAL --version | head -1`"
102 echo " * `$AUTOHEADER --version | head -1`"
103 echo " * `$AUTOMAKE --version | head -1`"
104 echo " * `$AUTOCONF --version | head -1`"
105 echo "---"