]>
Commit | Line | Data |
---|---|---|
74b984b6 | 1 | #!/bin/sh |
bfd8ad2b | 2 | # Used to setup the configure.ac, autoheader and Makefile.in's if configure |
a2794549 | 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" | |
e9c6b272 HN |
10 | acversions="${acver:-.}" # 2.68 2.67 2.66 2.65 2.64 2.63 2.62 2.61}" |
11 | amversions="${amver:-.}" # 1.11 1.10 1.9}" | |
12 | ltversions="${ltver:-.}" # 2.2}" | |
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 | |
e9c6b272 HN |
22 | variant=$2 |
23 | ${tool}${variant} --version 2>/dev/null | head -1 | sed -e 's/.*) //' | |
7f3ee672 AJ |
24 | } |
25 | ||
26 | find_variant() | |
fbf2848f | 27 | { |
28 | tool=$1 | |
29 | found="NOT_FOUND" | |
30 | shift | |
31 | versions="$*" | |
32 | for version in $versions; do | |
573ce2b2 | 33 | for variant in "" "${version}" "-${version}" "`echo $version | sed -e 's/\.//g'`"; do |
fbf2848f | 34 | if check_version $tool ${tool}${variant} $version; then |
35 | found="${variant}" | |
36 | break | |
37 | fi | |
38 | done | |
39 | if [ "x$found" != "xNOT_FOUND" ]; then | |
40 | break | |
41 | fi | |
42 | done | |
43 | if [ "x$found" = "xNOT_FOUND" ]; then | |
44 | echo "WARNING: Cannot find $tool version $versions" >&2 | |
45 | echo "Trying `$tool --version | head -1`" >&2 | |
46 | found="" | |
47 | fi | |
48 | echo $found | |
49 | } | |
96b8d5c3 | 50 | |
37f1dc15 FC |
51 | find_path() |
52 | { | |
53 | tool=$1 | |
54 | path=`which $tool` | |
55 | if test $? -gt 0 ; then | |
0954cf81 FC |
56 | # path for $tool not found. Not defining, and hoping for the best |
57 | echo | |
37f1dc15 FC |
58 | return |
59 | fi | |
60 | echo $(dirname $path) | |
61 | } | |
62 | ||
96b8d5c3 | 63 | bootstrap() { |
307aa7bb | 64 | if "$@"; then |
65 | true # Everything OK | |
66 | else | |
96b8d5c3 | 67 | echo "$1 failed" |
68 | echo "Autotool bootstrapping failed. You will need to investigate and correct" ; | |
69 | echo "before you can develop on this source tree" | |
70 | exit 1 | |
b4468b69 | 71 | fi |
96b8d5c3 | 72 | } |
73 | ||
3e7b6055 | 74 | bootstrap_libtoolize() { |
5f152e61 | 75 | tool=$1 |
3e7b6055 | 76 | |
b2b60232 | 77 | ltdl="--ltdl" |
3e7b6055 | 78 | |
5f152e61 | 79 | bootstrap $tool $ltdl --force --copy --automake |
3e7b6055 AR |
80 | |
81 | # customize generated libltdl, if any | |
660faa02 | 82 | if test -d libltdl |
3e7b6055 AR |
83 | then |
84 | src=libltdl | |
85 | ||
86 | # do not bundle with the huge standard license text | |
ad439abb | 87 | rm -f $src/COPYING.LIB |
3e7b6055 AR |
88 | makefile=$src/Makefile.in |
89 | sed 's/COPYING.LIB/ /g' $makefile > $makefile.new; | |
90 | chmod u+w $makefile | |
91 | mv $makefile.new $makefile | |
0e65e9c7 | 92 | chmod u-w $makefile |
3e7b6055 AR |
93 | fi |
94 | } | |
95 | ||
5f152e61 | 96 | # On MAC OS X, GNU libtool is named 'glibtool': |
5da4663f | 97 | if [ `uname -s 2>/dev/null` = 'Darwin' ] |
5f152e61 AJ |
98 | then |
99 | LIBTOOL_BIN="glibtool" | |
100 | else | |
101 | LIBTOOL_BIN="libtool" | |
102 | fi | |
103 | ||
74b984b6 | 104 | # Adjust paths of required autool packages |
7f3ee672 AJ |
105 | amver=`find_variant automake ${amversions}` |
106 | acver=`find_variant autoconf ${acversions}` | |
5f152e61 | 107 | ltver=`find_variant ${LIBTOOL_BIN} ${ltversions}` |
7f3ee672 AJ |
108 | |
109 | # Produce debug output about what version actually found. | |
e9c6b272 HN |
110 | amversion=`show_version automake "${amver}"` |
111 | acversion=`show_version autoconf "${acver}"` | |
5f152e61 | 112 | ltversion=`show_version ${LIBTOOL_BIN} "${ltver}"` |
74b984b6 | 113 | |
37f1dc15 | 114 | # Find the libtool path to get the right aclocal includes |
5f152e61 | 115 | ltpath=`find_path ${LIBTOOL_BIN}${ltver}` |
37f1dc15 | 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" | |
5f152e61 | 122 | echo "libtool ($ltversion) : ${LIBTOOL_BIN}${ltver}" |
0954cf81 | 123 | echo "libtool path : $ltpath" |
a8ed6bf6 | 124 | |
dc838e28 | 125 | for dir in \ |
99742866 | 126 | "" |
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 | |
5f152e61 | 137 | |
37f1dc15 FC |
138 | if test -n "$ltpath"; then |
139 | acincludeflag="-I $ltpath/../share/aclocal" | |
140 | else | |
141 | acincludeflag="" | |
142 | fi | |
83c44f93 | 143 | |
67c29939 | 144 | # Bootstrap the autotool subsystems |
37f1dc15 | 145 | bootstrap aclocal$amver $acincludeflag |
67c29939 | 146 | bootstrap autoheader$acver |
5f152e61 | 147 | bootstrap_libtoolize ${LIBTOOL_BIN}ize${ltver} |
3e0237d6 | 148 | bootstrap automake$amver --foreign --add-missing --copy -f |
63ab7f2d | 149 | bootstrap autoconf$acver --force |
67c29939 | 150 | fi ); then |
dc838e28 | 151 | : # OK |
152 | else | |
153 | exit 1 | |
154 | fi | |
98c7875e | 155 | fi |
dc838e28 | 156 | done |
b4468b69 | 157 | |
957eb8d1 | 158 | # Make a copy of SPONSORS we can package |
bdb40e33 | 159 | sed -e 's/@Squid-[0-9\.]*://' <SPONSORS.list > SPONSORS || (rm -f SPONSORS && exit 1) |
957eb8d1 | 160 | |
9b472584 | 161 | # Fixup autoconf recursion using --silent/--quiet option |
162 | # autoconf should inherit this option whe recursing into subdirectories | |
163 | # but it currently doesn't for some reason. | |
63ab7f2d | 164 | if ! grep "configure_args --quiet" configure >/dev/null; then |
165 | echo "Fixing configure recursion" | |
9b472584 | 166 | ed -s configure <<'EOS' >/dev/null || true |
167 | /ac_sub_configure_args=/ | |
168 | +1 | |
169 | i | |
170 | # Add --quiet option if used | |
171 | test "$silent" = yes && | |
172 | ac_sub_configure_args="$ac_sub_configure_args --quiet" | |
173 | . | |
174 | w | |
175 | EOS | |
63ab7f2d | 176 | fi |
9b472584 | 177 | |
96b8d5c3 | 178 | echo "Autotool bootstrapping complete." |