2 #***************************************************************************
4 # Project ___| | | | _ \| |
6 # | (__| |_| | _ <| |___
7 # \___|\___/|_| \_\_____|
9 # Copyright (C) 1998 - 2009, 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 # removethis() removes all files and subdirectories with the given name,
52 # inside and below the current subdirectory at invocation time.
55 if test "$#" = "1"; then
56 find . -depth -name $1 -print > buildconf.tmp.$$
59 if test -f "$fdname"; then
61 elif test -d "$fdname"; then
64 done < buildconf.tmp.$$
65 rm -f buildconf.tmp.$$
69 #--------------------------------------------------------------------------
70 # Ensure that buildconf runs from the subdirectory where configure.ac lives
72 if test ! -f configure.ac ||
73 test ! -f src/main.c ||
74 test ! -f lib/urldata.h ||
75 test ! -f include/curl/curl.h; then
76 echo "Can not run buildconf from outside of curl's source subdirectory!"
77 echo "Change to the subdirectory where buildconf is found, and try again."
81 #--------------------------------------------------------------------------
82 # autoconf 2.57 or newer
85 ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
86 if test -z "$ac_version"; then
87 echo "buildconf: autoconf not found."
88 echo " You need autoconf version $need_autoconf or newer installed."
91 IFS=.; set $ac_version; IFS=' '
92 if test "$1" = "2" -a "$2" -lt "57" || test "$1" -lt "2"; then
93 echo "buildconf: autoconf version $ac_version found."
94 echo " You need autoconf version $need_autoconf or newer installed."
95 echo " If you have a sufficient autoconf installed, but it"
96 echo " is not named 'autoconf', then try setting the"
97 echo " AUTOCONF environment variable."
101 echo "buildconf: autoconf version $ac_version (ok)"
103 am4te_version=`${AUTOM4TE:-autom4te} --version 2>/dev/null|head -n 1| sed -e 's/autom4te\(.*\)/\1/' -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
104 if test -z "$am4te_version"; then
105 echo "buildconf: autom4te not found. Weird autoconf installation!"
108 if test "$am4te_version" = "$ac_version"; then
109 echo "buildconf: autom4te version $am4te_version (ok)"
111 echo "buildconf: autom4te version $am4te_version (ERROR: does not match autoconf version)"
115 #--------------------------------------------------------------------------
116 # autoheader 2.50 or newer
118 ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
119 if test -z "$ah_version"; then
120 echo "buildconf: autoheader not found."
121 echo " You need autoheader version 2.50 or newer installed."
124 IFS=.; set $ah_version; IFS=' '
125 if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then
126 echo "buildconf: autoheader version $ah_version found."
127 echo " You need autoheader version 2.50 or newer installed."
128 echo " If you have a sufficient autoheader installed, but it"
129 echo " is not named 'autoheader', then try setting the"
130 echo " AUTOHEADER environment variable."
134 echo "buildconf: autoheader version $ah_version (ok)"
136 #--------------------------------------------------------------------------
137 # automake 1.7 or newer
140 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/'`
141 if test -z "$am_version"; then
142 echo "buildconf: automake not found."
143 echo " You need automake version $need_automake or newer installed."
146 IFS=.; set $am_version; IFS=' '
147 if test "$1" = "1" -a "$2" -lt "7" || test "$1" -lt "1"; then
148 echo "buildconf: automake version $am_version found."
149 echo " You need automake version $need_automake or newer installed."
150 echo " If you have a sufficient automake installed, but it"
151 echo " is not named 'automake', then try setting the"
152 echo " AUTOMAKE environment variable."
156 echo "buildconf: automake version $am_version (ok)"
158 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/'`
159 if test -z "$acloc_version"; then
160 echo "buildconf: aclocal not found. Weird automake installation!"
163 if test "$acloc_version" = "$am_version"; then
164 echo "buildconf: aclocal version $acloc_version (ok)"
166 echo "buildconf: aclocal version $acloc_version (ERROR: does not match automake version)"
170 #--------------------------------------------------------------------------
173 LIBTOOL_WANTED_MAJOR=1
174 LIBTOOL_WANTED_MINOR=4
175 LIBTOOL_WANTED_PATCH=2
176 LIBTOOL_WANTED_VERSION=1.4.2
178 # this approach that tries 'glibtool' first is some kind of work-around for
179 # some BSD-systems I believe that use to provide the GNU libtool named
180 # glibtool, with 'libtool' being something completely different.
181 libtool=`findtool glibtool 2>/dev/null`
182 if test ! -x "$libtool"; then
183 libtool=`findtool ${LIBTOOL:-libtool}`
186 if test -z "$LIBTOOLIZE"; then
187 # set the LIBTOOLIZE here so that glibtoolize is used if glibtool was found
188 # $libtool is already the full path
189 libtoolize="${libtool}ize"
191 libtoolize=`findtool $LIBTOOLIZE`
194 lt_pversion=`$libtool --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//g' -e 's/[- ].*//'`
195 if test -z "$lt_pversion"; then
196 echo "buildconf: libtool not found."
197 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
200 lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$//'`
201 IFS=.; set $lt_version; IFS=' '
208 if test "$major" = "$LIBTOOL_WANTED_MAJOR"; then
209 if test "$minor" -lt "$LIBTOOL_WANTED_MINOR"; then
211 elif test -n "$LIBTOOL_WANTED_PATCH"; then
212 if test "$minor" -gt "$LIBTOOL_WANTED_MINOR"; then
214 elif test -n "$patch"; then
215 if test "$patch" -lt "$LIBTOOL_WANTED_PATCH"; then
223 if test $lt_status != "good"; then
224 echo "buildconf: libtool version $lt_pversion found."
225 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
229 echo "buildconf: libtool version $lt_version (ok)"
231 dbg1=`$libtool --version 2>/dev/null|head -n 1`
232 dbg2=`$libtool --version 2>/dev/null|head -n 1|sed -e "s/(.*)//"`
233 dbg3=`$libtool --version 2>/dev/null|head -n 1|sed -e "s/(.*)//" -e "s/^[^0-9]*//g"`
234 dbg4=`$libtool --version 2>/dev/null|head -n 1|sed -e "s/(.*)//" -e "s/^[^0-9]*//g" -e "s/[- ].*//"`
235 dbg5=`echo $dbg4|sed -e "s/\([a-z]*\)$//"`
236 old_IFS=$IFS; IFS='.'; set $dbg5; IFS=$old_IFS
250 if test -f "$libtoolize"; then
251 echo "buildconf: libtoolize found"
253 echo "buildconf: libtoolize not found. Weird libtool installation!"
257 #--------------------------------------------------------------------------
260 m4=`${M4:-m4} --version 2>/dev/null|head -n 1`;
261 m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
263 if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
264 echo "buildconf: GNU m4 version $m4_version (ok)"
266 echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!"
270 #--------------------------------------------------------------------------
273 PERL=`findtool ${PERL:-perl}`
275 #--------------------------------------------------------------------------
276 # Remove files generated on previous buildconf/configure run.
317 #--------------------------------------------------------------------------
318 # run the correct scripts now
321 echo "buildconf: running libtoolize"
322 $libtoolize --copy --automake --force || die "The libtoolize command failed"
324 if test ! -f m4/curl-functions.m4; then
325 echo "buildconf: cURL m4 macros not found"
329 echo "buildconf: running aclocal"
330 ${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS || die "The aclocal command line failed"
332 if test -n "$PERL"; then
333 echo "buildconf: running aclocal hack to convert all mv to mv -f"
334 $PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4
336 echo "buildconf: perl not found"
340 echo "buildconf: running autoheader"
341 ${AUTOHEADER:-autoheader} || die "The autoheader command failed"
343 echo "buildconf: cp lib/config.h.in src/config.h.in"
344 cp lib/config.h.in src/config.h.in
346 echo "buildconf: running autoconf"
347 ${AUTOCONF:-autoconf} || die "The autoconf command failed"
349 if test -d ares; then
351 echo "buildconf: running in ares"
356 echo "buildconf: running automake"
357 ${AUTOMAKE:-automake} -a -c || die "The automake command failed"
359 #--------------------------------------------------------------------------
360 # Depending on the libtool and automake versions being used, config.guess
361 # might not be installed in the subdirectory until automake has finished.
362 # So we can not attempt to use it until this very last buildconf stage.
365 if test ! -f ./config.guess; then
366 echo "buildconf: config.guess not found"
368 buildhost=`./config.guess 2>/dev/null|head -n 1`
377 if test ! -z "$need_lt_check"; then
381 if test -z "$lt_major"; then
383 elif test "$lt_major" -gt "$need_lt_major"; then
385 elif test "$lt_major" -lt "$need_lt_major"; then
387 elif test -z "$lt_minor"; then
389 elif test "$lt_minor" -gt "$need_lt_minor"; then
391 elif test "$lt_minor" -lt "$need_lt_minor"; then
393 elif test -z "$lt_patch"; then
395 elif test "$lt_patch" -gt "$need_lt_patch"; then
397 elif test "$lt_patch" -lt "$need_lt_patch"; then
402 if test "$lt_status" != "good"; then
403 need_lt_version="$need_lt_major.$need_lt_minor.$need_lt_patch"
404 echo "buildconf: libtool version $lt_pversion found."
405 echo " $buildhost requires libtool $need_lt_version or newer."
412 #--------------------------------------------------------------------------
413 # Finished succesfully.