]> git.ipfire.org Git - thirdparty/squid.git/blob - bootstrap.sh
Bug 3370: external ACL sometimes skipping
[thirdparty/squid.git] / bootstrap.sh
1 #!/bin/sh
2 # Used to setup the configure.ac, 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
7 # Autotool versions preferred. To override either edit the script
8 # to match the versions you want to use, or set the variables on
9 # the command line like "env acver=.. amver=... ./bootstrap.sh"
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}"
13
14 check_version()
15 {
16 eval $2 --version 2>/dev/null | grep -i "$1.* $3" >/dev/null
17 }
18
19 show_version()
20 {
21 tool=$1
22 variant=$2
23 ${tool}${variant} --version 2>/dev/null | head -1 | sed -e 's/.*) //'
24 }
25
26 find_variant()
27 {
28 tool=$1
29 found="NOT_FOUND"
30 shift
31 versions="$*"
32 for version in $versions; do
33 for variant in "" "-${version}" "`echo $version | sed -e 's/\.//g'`"; do
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 }
50
51 find_path()
52 {
53 tool=$1
54 path=`which $tool`
55 if test $? -gt 0 ; then
56 # path for $tool not found. Not defining, and hoping for the best
57 echo
58 return
59 fi
60 echo $(dirname $path)
61 }
62
63 bootstrap() {
64 if "$@"; then
65 true # Everything OK
66 else
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
71 fi
72 }
73
74 bootstrap_libtoolize() {
75 ltver=$1
76
77 # TODO: when we have libtool2, tell libtoolize where to put its files
78 # instead of manualy moving files from ltdl to lib/libLtdl
79 if egrep -q '^[[:space:]]*AC_LIBLTDL_' configure.ac
80 then
81 ltdl="--ltdl"
82 else
83 ltdl=""
84 fi
85
86 bootstrap libtoolize$ltver $ltdl --force --copy --automake
87
88 # customize generated libltdl, if any
89 if test -d libltdl
90 then
91 src=libltdl
92
93 # do not bundle with the huge standard license text
94 rm -f $src/COPYING.LIB
95 makefile=$src/Makefile.in
96 sed 's/COPYING.LIB/ /g' $makefile > $makefile.new;
97 chmod u+w $makefile
98 mv $makefile.new $makefile
99 chmod u-w $makefile
100 fi
101 }
102
103 # Adjust paths of required autool packages
104 amver=`find_variant automake ${amversions}`
105 acver=`find_variant autoconf ${acversions}`
106 ltver=`find_variant libtool ${ltversions}`
107
108 # Produce debug output about what version actually found.
109 amversion=`show_version automake "${amver}"`
110 acversion=`show_version autoconf "${acver}"`
111 ltversion=`show_version libtool "${ltver}"`
112
113 # Find the libtool path to get the right aclocal includes
114 ltpath=`find_path libtool$ltver`
115
116 # Set environment variable to tell automake which autoconf to use.
117 AUTOCONF="autoconf${acver}" ; export AUTOCONF
118
119 echo "automake ($amversion) : automake$amver"
120 echo "autoconf ($acversion) : autoconf$acver"
121 echo "libtool ($ltversion) : libtool$ltver"
122 echo "libtool path : $ltpath"
123
124 for dir in \
125 "" \
126 lib/libTrie \
127 helpers/negotiate_auth/squid_kerb_auth
128 do
129 if [ -z "$dir" ] || [ -d $dir ]; then
130 if (
131 echo "Bootstrapping $dir"
132 cd ./$dir
133 if [ -n "$dir" ] && [ -f bootstrap.sh ]; then
134 ./bootstrap.sh
135 elif [ ! -f $dir/configure ]; then
136 # Make sure cfgaux exists
137 mkdir -p cfgaux
138
139 if test -n "$ltpath"; then
140 acincludeflag="-I $ltpath/../share/aclocal"
141 else
142 acincludeflag=""
143 fi
144
145 # Bootstrap the autotool subsystems
146 bootstrap aclocal$amver $acincludeflag
147 bootstrap autoheader$acver
148 bootstrap_libtoolize $ltver
149 bootstrap automake$amver --foreign --add-missing --copy -f
150 bootstrap autoconf$acver --force
151 fi ); then
152 : # OK
153 else
154 exit 1
155 fi
156 fi
157 done
158
159 # Fixup autoconf recursion using --silent/--quiet option
160 # autoconf should inherit this option whe recursing into subdirectories
161 # but it currently doesn't for some reason.
162 if ! grep "configure_args --quiet" configure >/dev/null; then
163 echo "Fixing configure recursion"
164 ed -s configure <<'EOS' >/dev/null || true
165 /ac_sub_configure_args=/
166 +1
167 i
168 # Add --quiet option if used
169 test "$silent" = yes &&
170 ac_sub_configure_args="$ac_sub_configure_args --quiet"
171 .
172 w
173 EOS
174 fi
175
176 echo "Autotool bootstrapping complete."