2 #***************************************************************************
4 # Project ___| | | | _ \| |
6 # | (__| |_| | _ <| |___
7 # \___|\___/|_| \_\_____|
9 # Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
11 # This software is licensed as described in the file COPYING, which
12 # you should have received as part of this distribution. The terms
13 # are also available at http://curl.haxx.se/docs/copyright.html.
15 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 # copies of the Software, and permit persons to whom the Software is
17 # furnished to do so, under the terms of the COPYING file.
19 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 # KIND, either express or implied.
23 ###########################################################################
30 #--------------------------------------------------------------------------
31 # findtool works as 'which' but we use a different name to make it more
32 # obvious we aren't using 'which'! ;-)
41 # echo "checks for $file in $path" >&2
42 if test -f "$path/$file"; then
50 #--------------------------------------------------------------------------
51 # Ensure that buildconf runs from the subdirectory where configure.ac lives
53 if test ! -f configure.ac ||
54 test ! -f src/main.c ||
55 test ! -f lib/urldata.h ||
56 test ! -f include/curl/curl.h; then
57 echo "Can not run buildconf from outside of curl's source subdirectory!"
58 echo "Change to the subdirectory where buildconf is found, and try again."
62 #--------------------------------------------------------------------------
63 # autoconf 2.57 or newer
66 ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
67 if test -z "$ac_version"; then
68 echo "buildconf: autoconf not found."
69 echo " You need autoconf version $need_autoconf or newer installed."
72 IFS=.; set $ac_version; IFS=' '
73 if test "$1" = "2" -a "$2" -lt "57" || test "$1" -lt "2"; then
74 echo "buildconf: autoconf version $ac_version found."
75 echo " You need autoconf version $need_autoconf or newer installed."
76 echo " If you have a sufficient autoconf installed, but it"
77 echo " is not named 'autoconf', then try setting the"
78 echo " AUTOCONF environment variable."
82 echo "buildconf: autoconf version $ac_version (ok)"
84 am4te_version=`${AUTOM4TE:-autom4te} --version 2>/dev/null|head -n 1| sed -e 's/autom4te\(.*\)/\1/' -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
85 if test -z "$am4te_version"; then
86 echo "buildconf: autom4te not found. Weird autoconf installation!"
89 echo "buildconf: autom4te version $am4te_version"
92 #--------------------------------------------------------------------------
93 # autoheader 2.50 or newer
95 ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
96 if test -z "$ah_version"; then
97 echo "buildconf: autoheader not found."
98 echo " You need autoheader version 2.50 or newer installed."
101 IFS=.; set $ah_version; IFS=' '
102 if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then
103 echo "buildconf: autoheader version $ah_version found."
104 echo " You need autoheader version 2.50 or newer installed."
105 echo " If you have a sufficient autoheader installed, but it"
106 echo " is not named 'autoheader', then try setting the"
107 echo " AUTOHEADER environment variable."
111 echo "buildconf: autoheader version $ah_version (ok)"
113 #--------------------------------------------------------------------------
114 # automake 1.7 or newer
117 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/'`
118 if test -z "$am_version"; then
119 echo "buildconf: automake not found."
120 echo " You need automake version $need_automake or newer installed."
123 IFS=.; set $am_version; IFS=' '
124 if test "$1" = "1" -a "$2" -lt "7" || test "$1" -lt "1"; then
125 echo "buildconf: automake version $am_version found."
126 echo " You need automake version $need_automake or newer installed."
127 echo " If you have a sufficient automake installed, but it"
128 echo " is not named 'automake', then try setting the"
129 echo " AUTOMAKE environment variable."
133 echo "buildconf: automake version $am_version (ok)"
135 acloc_version=`${ACLOCAL:-aclocal} --version 2>/dev/null|head -n 1| sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//' -e 's/\(.*\)\(-p.*\)/\1/'`
136 if test -z "$acloc_version"; then
137 echo "buildconf: aclocal not found. Weird automake installation!"
140 echo "buildconf: aclocal version $acloc_version"
143 #--------------------------------------------------------------------------
146 LIBTOOL_WANTED_MAJOR=1
147 LIBTOOL_WANTED_MINOR=4
148 LIBTOOL_WANTED_PATCH=2
149 LIBTOOL_WANTED_VERSION=1.4.2
151 # this approach that tries 'glibtool' first is some kind of work-around for
152 # some BSD-systems I believe that use to provide the GNU libtool named
153 # glibtool, with 'libtool' being something completely different.
154 libtool=`findtool glibtool 2>/dev/null`
155 if test ! -x "$libtool"; then
156 libtool=`findtool ${LIBTOOL:-libtool}`
159 if test -z "$LIBTOOLIZE"; then
160 # set the LIBTOOLIZE here so that glibtoolize is used if glibtool was found
161 # $libtool is already the full path
162 libtoolize="${libtool}ize"
164 libtoolize=`findtool $LIBTOOLIZE`
167 lt_pversion=`$libtool --version 2>/dev/null|head -n 2|sed -e 's/^[^0-9]*//g' -e 's/[- ].*//'`
168 if test -z "$lt_pversion"; then
169 echo "buildconf: libtool not found."
170 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
173 lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$//'`
174 IFS=.; set $lt_version; IFS=' '
181 if test "$major" = "$LIBTOOL_WANTED_MAJOR"; then
182 if test "$minor" -lt "$LIBTOOL_WANTED_MINOR"; then
184 elif test -n "$LIBTOOL_WANTED_PATCH"; then
185 if test "$minor" -gt "$LIBTOOL_WANTED_MINOR"; then
187 elif test -n "$patch"; then
188 if test "$patch" -lt "$LIBTOOL_WANTED_PATCH"; then
196 if test $lt_status != "good"; then
197 echo "buildconf: libtool version $lt_pversion found."
198 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
202 echo "buildconf: libtool version $lt_version (ok)"
204 if test -f "$libtoolize"; then
205 echo "buildconf: libtoolize found"
207 echo "buildconf: libtoolize not found. Weird libtool installation!"
211 #--------------------------------------------------------------------------
214 m4=`${M4:-m4} --version 2>/dev/null|head -n 1`;
215 m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
217 if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
218 echo "buildconf: GNU m4 version $m4_version (ok)"
220 echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!"
224 #--------------------------------------------------------------------------
227 PERL=`findtool ${PERL:-perl}`
229 #--------------------------------------------------------------------------
230 # Remove files generated on previous buildconf/configure run.
232 for fname in aclocal.m4 \
244 if test -f "$fname" ; then
248 if test -d autom4te.cache; then
249 rm -f -r autom4te.cache
251 if test -d docs/examples/.deps; then
252 rm -f -r docs/examples/.deps
254 if test -d lib/.deps; then
257 if test -d src/.deps; then
260 if test -d tests/libtest/.deps; then
261 rm -f -r tests/libtest/.deps
263 if test -d tests/server/.deps; then
264 rm -f -r tests/server/.deps
267 #--------------------------------------------------------------------------
268 # Remove files generated in c-ares subdir on previous buildconf/configure run.
270 if test -d ares; then
272 for fname in aclocal.m4 \
288 if test -f "$fname" ; then
292 if test -d autom4te.cache; then
293 rm -f -r autom4te.cache
295 if test -d .deps; then
301 #--------------------------------------------------------------------------
302 # run the correct scripts now
305 tmp_host_type=`uname -a | sed '/SunOS/s/.*\(SunOS\).*/\1/'`
306 if test "x$tmp_host_type" = "xSunOS"; then
307 ACLOCAL_FLAGS="$ACLOCAL_FLAGS --verbose"
309 ACLOCAL_FLAGS="$ACLOCAL_FLAGS --verbose"
311 echo "buildconf: running libtoolize"
312 $libtoolize --copy --automake --force || die "The libtoolize command failed"
313 echo "buildconf: running aclocal"
314 ${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS || die "The aclocal command line failed"
315 if test -n "$PERL"; then
316 echo "buildconf: running aclocal hack to convert all mv to mv -f"
317 $PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4
319 echo "buildconf: perl not found"
322 echo "buildconf: running autoheader"
323 ${AUTOHEADER:-autoheader} || die "The autoheader command failed"
324 echo "buildconf: cp lib/config.h.in src/config.h.in"
325 cp lib/config.h.in src/config.h.in
326 echo "buildconf: running autoconf"
327 ${AUTOCONF:-autoconf} || die "The autoconf command failed"
329 if test -d ares; then
331 echo "buildconf: running in ares"
336 echo "buildconf: running automake"
337 ${AUTOMAKE:-automake} -a -c || die "The automake command failed"