]>
Commit | Line | Data |
---|---|---|
74b984b6 | 1 | #!/bin/sh |
a151895d AJ |
2 | # |
3 | ## Copyright (C) 1996-2014 The Squid Software Foundation and contributors | |
4 | ## | |
5 | ## Squid software is distributed under GPLv2+ license and includes | |
6 | ## contributions from numerous individuals and organizations. | |
7 | ## Please see the COPYING and CONTRIBUTORS files for details. | |
8 | ## | |
9 | # | |
bfd8ad2b | 10 | # Used to setup the configure.ac, autoheader and Makefile.in's if configure |
a2794549 | 11 | # has not been generated. This script is only needed for developers when |
12 | # configure has not been run, or if a Makefile.am in a non-configured directory | |
13 | # has been updated | |
14 | ||
fbf2848f | 15 | # Autotool versions preferred. To override either edit the script |
c3d3f1cf | 16 | # to match the versions you want to use, or set the variables on |
17 | # the command line like "env acver=.. amver=... ./bootstrap.sh" | |
e9c6b272 HN |
18 | acversions="${acver:-.}" # 2.68 2.67 2.66 2.65 2.64 2.63 2.62 2.61}" |
19 | amversions="${amver:-.}" # 1.11 1.10 1.9}" | |
20 | ltversions="${ltver:-.}" # 2.2}" | |
fbf2848f | 21 | |
22 | check_version() | |
23 | { | |
8ce6be3f | 24 | eval $2 --version 2>/dev/null | grep -i "$1.* $3" >/dev/null |
fbf2848f | 25 | } |
26 | ||
7f3ee672 AJ |
27 | show_version() |
28 | { | |
29 | tool=$1 | |
e9c6b272 HN |
30 | variant=$2 |
31 | ${tool}${variant} --version 2>/dev/null | head -1 | sed -e 's/.*) //' | |
7f3ee672 AJ |
32 | } |
33 | ||
34 | find_variant() | |
fbf2848f | 35 | { |
36 | tool=$1 | |
37 | found="NOT_FOUND" | |
38 | shift | |
39 | versions="$*" | |
40 | for version in $versions; do | |
573ce2b2 | 41 | for variant in "" "${version}" "-${version}" "`echo $version | sed -e 's/\.//g'`"; do |
fbf2848f | 42 | if check_version $tool ${tool}${variant} $version; then |
43 | found="${variant}" | |
44 | break | |
45 | fi | |
46 | done | |
47 | if [ "x$found" != "xNOT_FOUND" ]; then | |
48 | break | |
49 | fi | |
50 | done | |
51 | if [ "x$found" = "xNOT_FOUND" ]; then | |
52 | echo "WARNING: Cannot find $tool version $versions" >&2 | |
53 | echo "Trying `$tool --version | head -1`" >&2 | |
54 | found="" | |
55 | fi | |
56 | echo $found | |
57 | } | |
96b8d5c3 | 58 | |
37f1dc15 FC |
59 | find_path() |
60 | { | |
61 | tool=$1 | |
62 | path=`which $tool` | |
63 | if test $? -gt 0 ; then | |
0954cf81 FC |
64 | # path for $tool not found. Not defining, and hoping for the best |
65 | echo | |
37f1dc15 FC |
66 | return |
67 | fi | |
68 | echo $(dirname $path) | |
69 | } | |
70 | ||
96b8d5c3 | 71 | bootstrap() { |
307aa7bb | 72 | if "$@"; then |
73 | true # Everything OK | |
74 | else | |
96b8d5c3 | 75 | echo "$1 failed" |
76 | echo "Autotool bootstrapping failed. You will need to investigate and correct" ; | |
77 | echo "before you can develop on this source tree" | |
78 | exit 1 | |
b4468b69 | 79 | fi |
96b8d5c3 | 80 | } |
81 | ||
3e7b6055 | 82 | bootstrap_libtoolize() { |
5f152e61 | 83 | tool=$1 |
3e7b6055 | 84 | |
b2b60232 | 85 | ltdl="--ltdl" |
3e7b6055 | 86 | |
5f152e61 | 87 | bootstrap $tool $ltdl --force --copy --automake |
3e7b6055 AR |
88 | |
89 | # customize generated libltdl, if any | |
660faa02 | 90 | if test -d libltdl |
3e7b6055 AR |
91 | then |
92 | src=libltdl | |
93 | ||
94 | # do not bundle with the huge standard license text | |
ad439abb | 95 | rm -f $src/COPYING.LIB |
3e7b6055 AR |
96 | makefile=$src/Makefile.in |
97 | sed 's/COPYING.LIB/ /g' $makefile > $makefile.new; | |
98 | chmod u+w $makefile | |
99 | mv $makefile.new $makefile | |
0e65e9c7 | 100 | chmod u-w $makefile |
3e7b6055 AR |
101 | fi |
102 | } | |
103 | ||
5f152e61 | 104 | # On MAC OS X, GNU libtool is named 'glibtool': |
5da4663f | 105 | if [ `uname -s 2>/dev/null` = 'Darwin' ] |
5f152e61 AJ |
106 | then |
107 | LIBTOOL_BIN="glibtool" | |
108 | else | |
109 | LIBTOOL_BIN="libtool" | |
110 | fi | |
111 | ||
74b984b6 | 112 | # Adjust paths of required autool packages |
7f3ee672 AJ |
113 | amver=`find_variant automake ${amversions}` |
114 | acver=`find_variant autoconf ${acversions}` | |
5f152e61 | 115 | ltver=`find_variant ${LIBTOOL_BIN} ${ltversions}` |
7f3ee672 AJ |
116 | |
117 | # Produce debug output about what version actually found. | |
e9c6b272 HN |
118 | amversion=`show_version automake "${amver}"` |
119 | acversion=`show_version autoconf "${acver}"` | |
5f152e61 | 120 | ltversion=`show_version ${LIBTOOL_BIN} "${ltver}"` |
74b984b6 | 121 | |
37f1dc15 | 122 | # Find the libtool path to get the right aclocal includes |
5f152e61 | 123 | ltpath=`find_path ${LIBTOOL_BIN}${ltver}` |
37f1dc15 | 124 | |
a8ed6bf6 | 125 | # Set environment variable to tell automake which autoconf to use. |
126 | AUTOCONF="autoconf${acver}" ; export AUTOCONF | |
127 | ||
7f3ee672 AJ |
128 | echo "automake ($amversion) : automake$amver" |
129 | echo "autoconf ($acversion) : autoconf$acver" | |
5f152e61 | 130 | echo "libtool ($ltversion) : ${LIBTOOL_BIN}${ltver}" |
0954cf81 | 131 | echo "libtool path : $ltpath" |
a8ed6bf6 | 132 | |
dc838e28 | 133 | for dir in \ |
99742866 | 134 | "" |
dc838e28 | 135 | do |
bd6d8fb7 | 136 | if [ -z "$dir" ] || [ -d $dir ]; then |
98c7875e | 137 | if ( |
dc838e28 | 138 | echo "Bootstrapping $dir" |
139 | cd ./$dir | |
897c0dcf | 140 | if [ -n "$dir" ] && [ -f bootstrap.sh ]; then |
67c29939 | 141 | ./bootstrap.sh |
4d00560c | 142 | elif [ ! -f $dir/configure ]; then |
83c44f93 | 143 | # Make sure cfgaux exists |
144 | mkdir -p cfgaux | |
5f152e61 | 145 | |
37f1dc15 FC |
146 | if test -n "$ltpath"; then |
147 | acincludeflag="-I $ltpath/../share/aclocal" | |
148 | else | |
149 | acincludeflag="" | |
150 | fi | |
83c44f93 | 151 | |
67c29939 | 152 | # Bootstrap the autotool subsystems |
37f1dc15 | 153 | bootstrap aclocal$amver $acincludeflag |
67c29939 | 154 | bootstrap autoheader$acver |
5f152e61 | 155 | bootstrap_libtoolize ${LIBTOOL_BIN}ize${ltver} |
3e0237d6 | 156 | bootstrap automake$amver --foreign --add-missing --copy -f |
63ab7f2d | 157 | bootstrap autoconf$acver --force |
67c29939 | 158 | fi ); then |
dc838e28 | 159 | : # OK |
160 | else | |
161 | exit 1 | |
162 | fi | |
98c7875e | 163 | fi |
dc838e28 | 164 | done |
b4468b69 | 165 | |
957eb8d1 | 166 | # Make a copy of SPONSORS we can package |
bdb40e33 | 167 | sed -e 's/@Squid-[0-9\.]*://' <SPONSORS.list > SPONSORS || (rm -f SPONSORS && exit 1) |
957eb8d1 | 168 | |
9b472584 | 169 | # Fixup autoconf recursion using --silent/--quiet option |
170 | # autoconf should inherit this option whe recursing into subdirectories | |
171 | # but it currently doesn't for some reason. | |
63ab7f2d | 172 | if ! grep "configure_args --quiet" configure >/dev/null; then |
173 | echo "Fixing configure recursion" | |
9b472584 | 174 | ed -s configure <<'EOS' >/dev/null || true |
175 | /ac_sub_configure_args=/ | |
176 | +1 | |
177 | i | |
178 | # Add --quiet option if used | |
179 | test "$silent" = yes && | |
180 | ac_sub_configure_args="$ac_sub_configure_args --quiet" | |
181 | . | |
182 | w | |
183 | EOS | |
63ab7f2d | 184 | fi |
9b472584 | 185 | |
96b8d5c3 | 186 | echo "Autotool bootstrapping complete." |