2 #***************************************************************************
4 # Project ___| | | | _ \| |
6 # | (__| |_| | _ <| |___
7 # \___|\___/|_| \_\_____|
9 # Copyright (C) 1998 - 2010, 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.
22 ###########################################################################
29 #--------------------------------------------------------------------------
30 # findtool works as 'which' but we use a different name to make it more
31 # obvious we aren't using 'which'! ;-)
36 if { echo $file | grep "/" >/dev/null 2>&1; } then
37 # we only check for the explicit file name if the file is given
38 # including a slash. Use ./ for current dir. Previously this would
39 # otherwise always cause findtool to search the local dir first, which
41 if test -f "$file"; then
51 # echo "checks for $file in $path" >&2
52 if test -f "$path/$file"; then
60 #--------------------------------------------------------------------------
61 # removethis() removes all files and subdirectories with the given name,
62 # inside and below the current subdirectory at invocation time.
65 if test "$#" = "1"; then
66 find . -depth -name $1 -print > buildconf.tmp.$$
69 if test -f "$fdname"; then
71 elif test -d "$fdname"; then
74 done < buildconf.tmp.$$
75 rm -f buildconf.tmp.$$
79 #--------------------------------------------------------------------------
80 # Ensure that buildconf runs from the subdirectory where configure.ac lives
82 if test ! -f configure.ac ||
83 test ! -f src/main.c ||
84 test ! -f lib/urldata.h ||
85 test ! -f include/curl/curl.h; then
86 echo "Can not run buildconf from outside of curl's source subdirectory!"
87 echo "Change to the subdirectory where buildconf is found, and try again."
91 #--------------------------------------------------------------------------
92 # autoconf 2.57 or newer
95 ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
96 if test -z "$ac_version"; then
97 echo "buildconf: autoconf not found."
98 echo " You need autoconf version $need_autoconf or newer installed."
101 old_IFS=$IFS; IFS='.'; set $ac_version; IFS=$old_IFS
102 if test "$1" = "2" -a "$2" -lt "57" || test "$1" -lt "2"; then
103 echo "buildconf: autoconf version $ac_version found."
104 echo " You need autoconf version $need_autoconf or newer installed."
105 echo " If you have a sufficient autoconf installed, but it"
106 echo " is not named 'autoconf', then try setting the"
107 echo " AUTOCONF environment variable."
111 echo "buildconf: autoconf version $ac_version (ok)"
113 am4te_version=`${AUTOM4TE:-autom4te} --version 2>/dev/null|head -n 1| sed -e 's/autom4te\(.*\)/\1/' -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
114 if test -z "$am4te_version"; then
115 echo "buildconf: autom4te not found. Weird autoconf installation!"
118 if test "$am4te_version" = "$ac_version"; then
119 echo "buildconf: autom4te version $am4te_version (ok)"
121 echo "buildconf: autom4te version $am4te_version (ERROR: does not match autoconf version)"
125 #--------------------------------------------------------------------------
126 # autoheader 2.50 or newer
128 ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
129 if test -z "$ah_version"; then
130 echo "buildconf: autoheader not found."
131 echo " You need autoheader version 2.50 or newer installed."
134 old_IFS=$IFS; IFS='.'; set $ah_version; IFS=$old_IFS
135 if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then
136 echo "buildconf: autoheader version $ah_version found."
137 echo " You need autoheader version 2.50 or newer installed."
138 echo " If you have a sufficient autoheader installed, but it"
139 echo " is not named 'autoheader', then try setting the"
140 echo " AUTOHEADER environment variable."
144 echo "buildconf: autoheader version $ah_version (ok)"
146 #--------------------------------------------------------------------------
147 # automake 1.7 or newer
150 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/'`
151 if test -z "$am_version"; then
152 echo "buildconf: automake not found."
153 echo " You need automake version $need_automake or newer installed."
156 old_IFS=$IFS; IFS='.'; set $am_version; IFS=$old_IFS
157 if test "$1" = "1" -a "$2" -lt "7" || test "$1" -lt "1"; then
158 echo "buildconf: automake version $am_version found."
159 echo " You need automake version $need_automake or newer installed."
160 echo " If you have a sufficient automake installed, but it"
161 echo " is not named 'automake', then try setting the"
162 echo " AUTOMAKE environment variable."
166 echo "buildconf: automake version $am_version (ok)"
168 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/'`
169 if test -z "$acloc_version"; then
170 echo "buildconf: aclocal not found. Weird automake installation!"
173 if test "$acloc_version" = "$am_version"; then
174 echo "buildconf: aclocal version $acloc_version (ok)"
176 echo "buildconf: aclocal version $acloc_version (ERROR: does not match automake version)"
180 #--------------------------------------------------------------------------
183 LIBTOOL_WANTED_MAJOR=1
184 LIBTOOL_WANTED_MINOR=4
185 LIBTOOL_WANTED_PATCH=2
186 LIBTOOL_WANTED_VERSION=1.4.2
188 # this approach that tries 'glibtool' first is some kind of work-around for
189 # some BSD-systems I believe that use to provide the GNU libtool named
190 # glibtool, with 'libtool' being something completely different.
191 libtool=`findtool glibtool 2>/dev/null`
192 if test ! -x "$libtool"; then
193 libtool=`findtool ${LIBTOOL:-libtool}`
196 if test -z "$LIBTOOLIZE"; then
197 # set the LIBTOOLIZE here so that glibtoolize is used if glibtool was found
198 # $libtool is already the full path
199 libtoolize="${libtool}ize"
201 libtoolize=`findtool $LIBTOOLIZE`
204 lt_pver=`$libtool --version 2>/dev/null|head -n 1`
205 lt_qver=`echo $lt_pver|sed -e "s/([^)]*)//g" -e "s/^[^0-9]*//g"`
206 lt_version=`echo $lt_qver|sed -e "s/[- ].*//" -e "s/\([a-z]*\)$//"`
207 if test -z "$lt_version"; then
208 echo "buildconf: libtool not found."
209 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
212 old_IFS=$IFS; IFS='.'; set $lt_version; IFS=$old_IFS
218 if test "$lt_major" = "$LIBTOOL_WANTED_MAJOR"; then
219 if test "$lt_minor" -lt "$LIBTOOL_WANTED_MINOR"; then
221 elif test -n "$LIBTOOL_WANTED_PATCH"; then
222 if test "$lt_minor" -gt "$LIBTOOL_WANTED_MINOR"; then
224 elif test -n "$lt_patch"; then
225 if test "$lt_patch" -lt "$LIBTOOL_WANTED_PATCH"; then
233 if test $lt_status != "good"; then
234 echo "buildconf: libtool version $lt_version found."
235 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
239 echo "buildconf: libtool version $lt_version (ok)"
241 if test -f "$libtoolize"; then
242 echo "buildconf: libtoolize found"
244 echo "buildconf: libtoolize not found. Weird libtool installation!"
248 #--------------------------------------------------------------------------
251 m4=`(${M4:-m4} --version || ${M4:-gm4} --version) 2>/dev/null | head -n 1`;
252 m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
254 if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
255 echo "buildconf: GNU m4 version $m4_version (ok)"
257 if test -z "$m4"; then
258 echo "buildconf: m4 version not recognized. You need a GNU m4 installed!"
260 echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!"
265 #--------------------------------------------------------------------------
268 PERL=`findtool ${PERL:-perl}`
270 #--------------------------------------------------------------------------
271 # Remove files generated on previous buildconf/configure run.
315 #--------------------------------------------------------------------------
316 # run the correct scripts now
319 echo "buildconf: running libtoolize"
320 $libtoolize --copy --automake --force || die "The libtoolize command failed"
322 if test ! -f m4/curl-functions.m4; then
323 echo "buildconf: cURL m4 macros not found"
327 echo "buildconf: running aclocal"
328 ${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS || die "The aclocal command line failed"
330 if test -n "$PERL"; then
331 echo "buildconf: running aclocal hack to convert all mv to mv -f"
332 $PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4
334 echo "buildconf: perl not found"
338 echo "buildconf: running autoheader"
339 ${AUTOHEADER:-autoheader} || die "The autoheader command failed"
341 echo "buildconf: cp lib/curl_config.h.in src/curl_config.h.in"
342 cp lib/curl_config.h.in src/curl_config.h.in
344 echo "buildconf: running autoconf"
345 ${AUTOCONF:-autoconf} || die "The autoconf command failed"
347 if test -d ares; then
349 echo "buildconf: running in ares"
354 echo "buildconf: running automake"
355 ${AUTOMAKE:-automake} -a -c || die "The automake command failed"
357 #--------------------------------------------------------------------------
358 # Depending on the libtool and automake versions being used, config.guess
359 # might not be installed in the subdirectory until automake has finished.
360 # So we can not attempt to use it until this very last buildconf stage.
363 if test ! -f ./config.guess; then
364 echo "buildconf: config.guess not found"
366 buildhost=`./config.guess 2>/dev/null|head -n 1`
381 if test ! -z "$need_lt_check"; then
382 if test -z "$lt_major"; then
384 elif test "$lt_major" -gt "$need_lt_major"; then
386 elif test "$lt_major" -lt "$need_lt_major"; then
388 elif test -z "$lt_minor"; then
390 elif test "$lt_minor" -gt "$need_lt_minor"; then
392 elif test "$lt_minor" -lt "$need_lt_minor"; then
394 elif test -z "$lt_patch"; then
396 elif test "$lt_patch" -gt "$need_lt_patch"; then
398 elif test "$lt_patch" -lt "$need_lt_patch"; then
403 if test "$lt_status" != "good"; then
404 need_lt_version="$need_lt_major.$need_lt_minor.$need_lt_patch"
405 echo "buildconf: libtool version $lt_version found."
406 echo " $buildhost requires libtool $need_lt_version or newer installed."
413 #--------------------------------------------------------------------------
414 # Finished successfully.