8 # this works as 'which' but we use a different name to make it more obvious we
9 # aren't using 'which'! ;-)
16 # echo "checks for $file in $path" >&2
17 if test -f "$path/$file"; then
24 #--------------------------------------------------------------------------
25 # autoconf 2.57 or newer
28 ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
29 if test -z "$ac_version"; then
30 echo "buildconf: autoconf not found."
31 echo " You need autoconf version $need_autoconf or newer installed."
34 IFS=.; set $ac_version; IFS=' '
35 if test "$1" = "2" -a "$2" -lt "57" || test "$1" -lt "2"; then
36 echo "buildconf: autoconf version $ac_version found."
37 echo " You need autoconf version $need_autoconf or newer installed."
38 echo " If you have a sufficient autoconf installed, but it"
39 echo " is not named 'autoconf', then try setting the"
40 echo " AUTOCONF environment variable."
44 echo "buildconf: autoconf version $ac_version (ok)"
46 #--------------------------------------------------------------------------
47 # autoheader 2.50 or newer
49 ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
50 if test -z "$ah_version"; then
51 echo "buildconf: autoheader not found."
52 echo " You need autoheader version 2.50 or newer installed."
55 IFS=.; set $ah_version; IFS=' '
56 if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then
57 echo "buildconf: autoheader version $ah_version found."
58 echo " You need autoheader version 2.50 or newer installed."
59 echo " If you have a sufficient autoheader installed, but it"
60 echo " is not named 'autoheader', then try setting the"
61 echo " AUTOHEADER environment variable."
65 echo "buildconf: autoheader version $ah_version (ok)"
67 #--------------------------------------------------------------------------
68 # automake 1.7 or newer
71 am_version=`${AUTOMAKE:-automake} --version 2>/dev/null|head -n 1| sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//' -e 's/\(.*\)\(-p.*\)/\1/'`
72 if test -z "$am_version"; then
73 echo "buildconf: automake not found."
74 echo " You need automake version $need_automake or newer installed."
77 IFS=.; set $am_version; IFS=' '
78 if test "$1" = "1" -a "$2" -lt "7" || test "$1" -lt "1"; then
79 echo "buildconf: automake version $am_version found."
80 echo " You need automake version $need_automake or newer installed."
81 echo " If you have a sufficient automake installed, but it"
82 echo " is not named 'automake', then try setting the"
83 echo " AUTOMAKE environment variable."
87 echo "buildconf: automake version $am_version (ok)"
89 ac=`findtool ${ACLOCAL:-aclocal}`
90 if test -z "$ac"; then
91 echo "buildconf: aclocal not found. Weird automake installation!"
94 echo "buildconf: aclocal found"
97 #--------------------------------------------------------------------------
100 LIBTOOL_WANTED_MAJOR=1
101 LIBTOOL_WANTED_MINOR=4
102 LIBTOOL_WANTED_PATCH=2
103 LIBTOOL_WANTED_VERSION=1.4.2
105 # this approach that tries 'glibtool' first is some kind of work-around for
106 # some BSD-systems I believe that use to provide the GNU libtool named
107 # glibtool, with 'libtool' being something completely different.
108 libtool=`findtool glibtool 2>/dev/null`
109 if test ! -x "$libtool"; then
110 libtool=`findtool ${LIBTOOL:-libtool}`
113 if test -z "$LIBTOOLIZE"; then
114 # set the LIBTOOLIZE here so that glibtoolize is used if glibtool was found
115 # $libtool is already the full path
116 libtoolize="${libtool}ize"
118 libtoolize=`findtool $LIBTOOLIZE`
121 lt_pversion=`$libtool --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//g' -e 's/[- ].*//'`
122 if test -z "$lt_pversion"; then
123 echo "buildconf: libtool not found."
124 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
127 lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$//'`
128 IFS=.; set $lt_version; IFS=' '
135 if test "$major" = "$LIBTOOL_WANTED_MAJOR"; then
136 if test "$minor" -lt "$LIBTOOL_WANTED_MINOR"; then
138 elif test -n "$LIBTOOL_WANTED_PATCH"; then
139 if test "$minor" -gt "$LIBTOOL_WANTED_MINOR"; then
141 elif test -n "$patch"; then
142 if test "$patch" -lt "$LIBTOOL_WANTED_PATCH"; then
150 if test $lt_status != "good"; then
151 echo "buildconf: libtool version $lt_pversion found."
152 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
156 echo "buildconf: libtool version $lt_version (ok)"
158 if test -f "$libtoolize"; then
159 echo "buildconf: libtoolize found"
161 echo "buildconf: libtoolize not found. Weird libtool installation!"
165 #--------------------------------------------------------------------------
168 m4=`${M4:-m4} --version 2>/dev/null|head -n 1`;
169 m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
171 if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
172 echo "buildconf: GNU m4 version $m4_version (ok)"
174 echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!"
178 #--------------------------------------------------------------------------
181 PERL=`findtool ${PERL:-perl}`
183 # ------------------------------------------------------------
185 # run the correct scripts now
187 echo "buildconf: running libtoolize"
188 $libtoolize --copy --automake --force || die "The libtoolize command failed"
189 echo "buildconf: running aclocal"
190 ${ACLOCAL:-aclocal} $ACLOCAL_FLAGS || die "The aclocal command line failed"
191 if test -n "$PERL"; then
192 echo "buildconf: running aclocal hack to convert all mv to mv -f"
193 $PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4
195 echo "buildconf: perl not found"
198 echo "buildconf: running autoheader"
199 ${AUTOHEADER:-autoheader} || die "The autoheader command failed"
200 echo "buildconf: cp lib/config.h.in src/config.h.in"
201 cp lib/config.h.in src/config.h.in
202 echo "buildconf: running autoconf"
203 ${AUTOCONF:-autoconf} || die "The autoconf command failed"
205 if test -d ares; then
207 echo "buildconf: running ares/libtoolize"
208 $libtoolize --copy --automake --force || die "The libtoolize command failed"
209 echo "buildconf: running ares/aclocal"
210 ${ACLOCAL:-aclocal} $ACLOCAL_FLAGS || die "The ares aclocal command failed"
211 echo "buildconf: running ares/autoconf"
212 ${AUTOCONF:-autoconf} || die "The ares autoconf command failed"
216 echo "buildconf: running automake"
217 ${AUTOMAKE:-automake} -a -c || die "The automake command failed"