3 #--------------------------------------------------------------------------
4 # die prints argument string to stdout and exits this shell script.
11 #--------------------------------------------------------------------------
12 # findtool works as 'which' but we use a different name to make it more
13 # obvious we aren't using 'which'! ;-)
18 if { echo "$file" | grep "/" >/dev/null 2>&1; } then
19 # when file is given with a path check it first
20 if test -f "$file"; then
30 # echo "checks for $file in $path" >&2
31 if test -f "$path/$file"; then
39 #--------------------------------------------------------------------------
40 # removethis() removes all files and subdirectories with the given name,
41 # inside and below the current subdirectory at invocation time.
44 if test "$#" = "1"; then
45 find . -depth -name $1 -print > buildconf.tmp.$$
48 if test -f "$fdname"; then
50 elif test -d "$fdname"; then
53 done < buildconf.tmp.$$
54 rm -f buildconf.tmp.$$
58 #--------------------------------------------------------------------------
59 # Ensure that buildconf runs from the subdirectory where configure.ac lives
61 if test ! -f configure.ac ||
62 test ! -f ares_init.c ||
63 test ! -f m4/cares-functions.m4; then
64 echo "Can not run buildconf from outside of c-ares source subdirectory!"
65 echo "Change to the subdirectory where buildconf is found, and try again."
69 #--------------------------------------------------------------------------
70 # GNU libtool preliminary check
77 # This approach that tries 'glibtool' first is intended for systems that
78 # have GNU libtool named as 'glibtool' and libtool not being GNU's.
80 libtool=`findtool glibtool 2>/dev/null`
81 if test ! -x "$libtool"; then
82 libtool=`findtool ${LIBTOOL:-libtool}`
84 if test -z "$libtool"; then
85 echo "buildconf: libtool not found."
86 echo " You need GNU libtool $want_lt_version or newer installed."
90 lt_pver=`$libtool --version 2>/dev/null|head -n 1`
91 lt_qver=`echo $lt_pver|sed -e "s/([^)]*)//g" -e "s/^[^0-9]*//g"`
92 lt_version=`echo $lt_qver|sed -e "s/[- ].*//" -e "s/\([a-z]*\)$//"`
93 if test -z "$lt_version"; then
94 echo "buildconf: libtool not found."
95 echo " You need GNU libtool $want_lt_version or newer installed."
98 old_IFS=$IFS; IFS='.'; set $lt_version; IFS=$old_IFS
103 if test -z "$lt_major"; then
105 elif test "$lt_major" -gt "$want_lt_major"; then
107 elif test "$lt_major" -lt "$want_lt_major"; then
109 elif test -z "$lt_minor"; then
111 elif test "$lt_minor" -gt "$want_lt_minor"; then
113 elif test "$lt_minor" -lt "$want_lt_minor"; then
115 elif test -z "$lt_patch"; then
117 elif test "$lt_patch" -gt "$want_lt_patch"; then
119 elif test "$lt_patch" -lt "$want_lt_patch"; then
124 if test "$lt_status" != "good"; then
125 echo "buildconf: libtool version $lt_version found."
126 echo " You need GNU libtool $want_lt_version or newer installed."
130 #--------------------------------------------------------------------------
131 # GNU libtoolize check
133 if test -z "$LIBTOOLIZE"; then
134 # use (g)libtoolize from same location as (g)libtool
135 libtoolize="${libtool}ize"
137 libtoolize=`findtool $LIBTOOLIZE`
139 if test ! -f "$libtoolize"; then
140 echo "buildconf: libtoolize not found."
141 echo " You need GNU libtoolize $want_lt_version or newer installed."
145 #--------------------------------------------------------------------------
148 PERL=`findtool ${PERL:-perl}`
149 if test -z "$PERL"; then
150 echo "buildconf: perl not found"
154 #--------------------------------------------------------------------------
155 # Remove files generated on previous buildconf/configure run.
194 #--------------------------------------------------------------------------
195 # run the correct scripts now
198 echo "buildconf: running libtoolize"
199 ${libtoolize} --copy --automake --force || die "libtoolize command failed"
201 # When using libtool 1.5.X (X < 26) we copy libtool.m4 to our local m4
202 # subdirectory and this local copy is patched to fix some warnings that
203 # are triggered when running aclocal and using autoconf 2.62 or later.
205 if test "$lt_major" = "1" && test "$lt_minor" = "5"; then
206 if test -z "$lt_patch" || test "$lt_patch" -lt "26"; then
207 echo "buildconf: copying libtool.m4 to local m4 subdir"
208 ac_dir=`${ACLOCAL:-aclocal} --print-ac-dir`
209 if test -f $ac_dir/libtool.m4; then
210 cp -f $ac_dir/libtool.m4 m4/libtool.m4
212 echo "buildconf: $ac_dir/libtool.m4 not found"
214 if test -f m4/libtool.m4; then
215 echo "buildconf: renaming some variables in local m4/libtool.m4"
217 's/lt_prog_compiler_pic_works/lt_cv_prog_compiler_pic_works/g; \
218 s/lt_prog_compiler_static_works/lt_cv_prog_compiler_static_works/g;' \
220 rm -f m4/libtool.m4.tmp
225 if test -f m4/libtool.m4; then
226 echo "buildconf: converting all mv to mv -f in local m4/libtool.m4"
227 $PERL -i.tmp -pe 's/\bmv +([^-\s])/mv -f $1/g' m4/libtool.m4
228 rm -f m4/libtool.m4.tmp
231 echo "buildconf: running aclocal"
232 ${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS || die "aclocal command failed"
234 echo "buildconf: converting all mv to mv -f in local aclocal.m4"
235 $PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4
237 echo "buildconf: running autoheader"
238 ${AUTOHEADER:-autoheader} || die "autoheader command failed"
240 echo "buildconf: running autoconf"
241 ${AUTOCONF:-autoconf} || die "autoconf command failed"
243 echo "buildconf: running automake"
244 ${AUTOMAKE:-automake} --add-missing --copy || die "automake command failed"
246 #--------------------------------------------------------------------------
247 # GNU libtool complementary check
249 # Depending on the libtool and automake versions being used, config.guess
250 # might not be installed in the subdirectory until automake has finished.
251 # So we can not attempt to use it until this very last buildconf stage.
253 if test ! -f ./config.guess; then
254 echo "buildconf: config.guess not found"
256 buildhost=`./config.guess 2>/dev/null|head -n 1`
271 if test ! -z "$need_lt_check"; then
272 if test -z "$lt_major"; then
274 elif test "$lt_major" -gt "$need_lt_major"; then
276 elif test "$lt_major" -lt "$need_lt_major"; then
278 elif test -z "$lt_minor"; then
280 elif test "$lt_minor" -gt "$need_lt_minor"; then
282 elif test "$lt_minor" -lt "$need_lt_minor"; then
284 elif test -z "$lt_patch"; then
286 elif test "$lt_patch" -gt "$need_lt_patch"; then
288 elif test "$lt_patch" -lt "$need_lt_patch"; then
293 if test "$lt_status" != "good"; then
294 need_lt_version="$need_lt_major.$need_lt_minor.$need_lt_patch"
295 echo "buildconf: libtool version $lt_version found."
296 echo " $buildhost requires GNU libtool $need_lt_version or newer installed."
303 #--------------------------------------------------------------------------
304 # Finished successfully.