]>
Commit | Line | Data |
---|---|---|
74b984b6 | 1 | #!/bin/sh |
a2794549 | 2 | # Used to setup the configure.in, autoheader and Makefile.in's if configure |
3 | # has not been generated. This script is only needed for developers when | |
4 | # configure has not been run, or if a Makefile.am in a non-configured directory | |
5 | # has been updated | |
6 | ||
fbf2848f | 7 | # Autotool versions preferred. To override either edit the script |
c3d3f1cf | 8 | # to match the versions you want to use, or set the variables on |
9 | # the command line like "env acver=.. amver=... ./bootstrap.sh" | |
65f9f80c | 10 | acversions="${acver:-2.63 2.62 2.61}" |
416157b5 | 11 | amversions="${amver:-1.11 1.10 1.9}" |
b44ef959 | 12 | ltversions="${ltver:-2.2 1.5 1.4}" |
fbf2848f | 13 | |
14 | check_version() | |
15 | { | |
8ce6be3f | 16 | eval $2 --version 2>/dev/null | grep -i "$1.* $3" >/dev/null |
fbf2848f | 17 | } |
18 | ||
7f3ee672 AJ |
19 | show_version() |
20 | { | |
21 | tool=$1 | |
22 | found="NOT_FOUND" | |
23 | shift | |
24 | versions="$*" | |
25 | for version in $versions; do | |
471931e2 AJ |
26 | for variant in "" "-${version}" "`echo $version | sed -e 's/\.//g'`"; do |
27 | if check_version $tool ${tool}${variant} $version; then | |
28 | found="${version}" | |
7f3ee672 AJ |
29 | break |
30 | fi | |
471931e2 AJ |
31 | done |
32 | if [ "x$found" != "xNOT_FOUND" ]; then | |
33 | break | |
34 | fi | |
7f3ee672 AJ |
35 | done |
36 | if [ "x$found" = "xNOT_FOUND" ]; then | |
37 | found="??" | |
38 | fi | |
39 | echo $found | |
40 | } | |
41 | ||
42 | find_variant() | |
fbf2848f | 43 | { |
44 | tool=$1 | |
45 | found="NOT_FOUND" | |
46 | shift | |
47 | versions="$*" | |
48 | for version in $versions; do | |
80feea5a | 49 | for variant in "" "-${version}" "`echo $version | sed -e 's/\.//g'`"; do |
fbf2848f | 50 | if check_version $tool ${tool}${variant} $version; then |
51 | found="${variant}" | |
52 | break | |
53 | fi | |
54 | done | |
55 | if [ "x$found" != "xNOT_FOUND" ]; then | |
56 | break | |
57 | fi | |
58 | done | |
59 | if [ "x$found" = "xNOT_FOUND" ]; then | |
60 | echo "WARNING: Cannot find $tool version $versions" >&2 | |
61 | echo "Trying `$tool --version | head -1`" >&2 | |
62 | found="" | |
63 | fi | |
64 | echo $found | |
65 | } | |
96b8d5c3 | 66 | |
67 | bootstrap() { | |
307aa7bb | 68 | if "$@"; then |
69 | true # Everything OK | |
70 | else | |
96b8d5c3 | 71 | echo "$1 failed" |
72 | echo "Autotool bootstrapping failed. You will need to investigate and correct" ; | |
73 | echo "before you can develop on this source tree" | |
74 | exit 1 | |
b4468b69 | 75 | fi |
96b8d5c3 | 76 | } |
77 | ||
3e7b6055 AR |
78 | bootstrap_libtoolize() { |
79 | ltver=$1 | |
80 | ||
44937bde AR |
81 | # TODO: when we have libtool2, tell libtoolize where to put its files |
82 | # instead of manualy moving files from ltdl to lib/libLtdl | |
3e7b6055 AR |
83 | if egrep -q '^[[:space:]]*AC_LIBLTDL_' configure.in |
84 | then | |
660faa02 | 85 | ltdl="--ltdl" |
3e7b6055 | 86 | else |
d3a6661c | 87 | ltdl="" |
3e7b6055 AR |
88 | fi |
89 | ||
d3a6661c | 90 | bootstrap libtoolize$ltver $ltdl --force --copy --automake |
3e7b6055 AR |
91 | |
92 | # customize generated libltdl, if any | |
660faa02 | 93 | if test -d libltdl |
3e7b6055 AR |
94 | then |
95 | src=libltdl | |
96 | ||
97 | # do not bundle with the huge standard license text | |
ad439abb | 98 | rm -f $src/COPYING.LIB |
3e7b6055 AR |
99 | makefile=$src/Makefile.in |
100 | sed 's/COPYING.LIB/ /g' $makefile > $makefile.new; | |
101 | chmod u+w $makefile | |
102 | mv $makefile.new $makefile | |
0e65e9c7 | 103 | chmod u-w $makefile |
3e7b6055 AR |
104 | fi |
105 | } | |
106 | ||
74b984b6 | 107 | # Adjust paths of required autool packages |
7f3ee672 AJ |
108 | amver=`find_variant automake ${amversions}` |
109 | acver=`find_variant autoconf ${acversions}` | |
110 | ltver=`find_variant libtool ${ltversions}` | |
111 | ||
112 | # Produce debug output about what version actually found. | |
471931e2 AJ |
113 | amversion=`show_version automake ${amversions}` |
114 | acversion=`show_version autoconf ${acversions}` | |
115 | ltversion=`show_version libtool ${ltversions}` | |
74b984b6 | 116 | |
a8ed6bf6 | 117 | # Set environment variable to tell automake which autoconf to use. |
118 | AUTOCONF="autoconf${acver}" ; export AUTOCONF | |
119 | ||
7f3ee672 AJ |
120 | echo "automake ($amversion) : automake$amver" |
121 | echo "autoconf ($acversion) : autoconf$acver" | |
122 | echo "libtool ($ltversion) : libtool$ltver" | |
a8ed6bf6 | 123 | |
dc838e28 | 124 | for dir in \ |
125 | "" \ | |
3ad12bda | 126 | lib/libTrie |
dc838e28 | 127 | do |
bd6d8fb7 | 128 | if [ -z "$dir" ] || [ -d $dir ]; then |
98c7875e | 129 | if ( |
dc838e28 | 130 | echo "Bootstrapping $dir" |
131 | cd ./$dir | |
897c0dcf | 132 | if [ -n "$dir" ] && [ -f bootstrap.sh ]; then |
67c29939 | 133 | ./bootstrap.sh |
4d00560c | 134 | elif [ ! -f $dir/configure ]; then |
83c44f93 | 135 | # Make sure cfgaux exists |
136 | mkdir -p cfgaux | |
137 | ||
67c29939 | 138 | # Bootstrap the autotool subsystems |
139 | bootstrap aclocal$amver | |
67c29939 | 140 | bootstrap autoheader$acver |
3e7b6055 | 141 | bootstrap_libtoolize $ltver |
3e0237d6 | 142 | bootstrap automake$amver --foreign --add-missing --copy -f |
63ab7f2d | 143 | bootstrap autoconf$acver --force |
67c29939 | 144 | fi ); then |
dc838e28 | 145 | : # OK |
146 | else | |
147 | exit 1 | |
148 | fi | |
98c7875e | 149 | fi |
dc838e28 | 150 | done |
b4468b69 | 151 | |
9b472584 | 152 | # Fixup autoconf recursion using --silent/--quiet option |
153 | # autoconf should inherit this option whe recursing into subdirectories | |
154 | # but it currently doesn't for some reason. | |
63ab7f2d | 155 | if ! grep "configure_args --quiet" configure >/dev/null; then |
156 | echo "Fixing configure recursion" | |
9b472584 | 157 | ed -s configure <<'EOS' >/dev/null || true |
158 | /ac_sub_configure_args=/ | |
159 | +1 | |
160 | i | |
161 | # Add --quiet option if used | |
162 | test "$silent" = yes && | |
163 | ac_sub_configure_args="$ac_sub_configure_args --quiet" | |
164 | . | |
165 | w | |
166 | EOS | |
63ab7f2d | 167 | fi |
9b472584 | 168 | |
96b8d5c3 | 169 | echo "Autotool bootstrapping complete." |