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/tool_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. Unpatched version 2.67 does not generate proper
93 # configure script. Unpatched version 2.68 is simply unusable, we should
94 # disallow 2.68 usage.
97 ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
98 if test -z "$ac_version"; then
99 echo "buildconf: autoconf not found."
100 echo " You need autoconf version $need_autoconf or newer installed."
103 old_IFS=$IFS; IFS='.'; set $ac_version; IFS=$old_IFS
104 if test "$1" = "2" -a "$2" -lt "57" || test "$1" -lt "2"; then
105 echo "buildconf: autoconf version $ac_version found."
106 echo " You need autoconf version $need_autoconf or newer installed."
107 echo " If you have a sufficient autoconf installed, but it"
108 echo " is not named 'autoconf', then try setting the"
109 echo " AUTOCONF environment variable."
113 if test "$1" = "2" -a "$2" -eq "67"; then
114 echo "buildconf: autoconf version $ac_version (BAD)"
115 echo " Unpatched version generates broken configure script."
116 elif test "$1" = "2" -a "$2" -eq "68"; then
117 echo "buildconf: autoconf version $ac_version (BAD)"
118 echo " Unpatched version generates unusable configure script."
120 echo "buildconf: autoconf version $ac_version (ok)"
123 am4te_version=`${AUTOM4TE:-autom4te} --version 2>/dev/null|head -n 1| sed -e 's/autom4te\(.*\)/\1/' -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
124 if test -z "$am4te_version"; then
125 echo "buildconf: autom4te not found. Weird autoconf installation!"
128 if test "$am4te_version" = "$ac_version"; then
129 echo "buildconf: autom4te version $am4te_version (ok)"
131 echo "buildconf: autom4te version $am4te_version (ERROR: does not match autoconf version)"
135 #--------------------------------------------------------------------------
136 # autoheader 2.50 or newer
138 ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
139 if test -z "$ah_version"; then
140 echo "buildconf: autoheader not found."
141 echo " You need autoheader version 2.50 or newer installed."
144 old_IFS=$IFS; IFS='.'; set $ah_version; IFS=$old_IFS
145 if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then
146 echo "buildconf: autoheader version $ah_version found."
147 echo " You need autoheader version 2.50 or newer installed."
148 echo " If you have a sufficient autoheader installed, but it"
149 echo " is not named 'autoheader', then try setting the"
150 echo " AUTOHEADER environment variable."
154 echo "buildconf: autoheader version $ah_version (ok)"
156 #--------------------------------------------------------------------------
157 # automake 1.7 or newer
160 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/'`
161 if test -z "$am_version"; then
162 echo "buildconf: automake not found."
163 echo " You need automake version $need_automake or newer installed."
166 old_IFS=$IFS; IFS='.'; set $am_version; IFS=$old_IFS
167 if test "$1" = "1" -a "$2" -lt "7" || test "$1" -lt "1"; then
168 echo "buildconf: automake version $am_version found."
169 echo " You need automake version $need_automake or newer installed."
170 echo " If you have a sufficient automake installed, but it"
171 echo " is not named 'automake', then try setting the"
172 echo " AUTOMAKE environment variable."
176 echo "buildconf: automake version $am_version (ok)"
178 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/'`
179 if test -z "$acloc_version"; then
180 echo "buildconf: aclocal not found. Weird automake installation!"
183 if test "$acloc_version" = "$am_version"; then
184 echo "buildconf: aclocal version $acloc_version (ok)"
186 echo "buildconf: aclocal version $acloc_version (ERROR: does not match automake version)"
190 #--------------------------------------------------------------------------
193 LIBTOOL_WANTED_MAJOR=1
194 LIBTOOL_WANTED_MINOR=4
195 LIBTOOL_WANTED_PATCH=2
196 LIBTOOL_WANTED_VERSION=1.4.2
198 # this approach that tries 'glibtool' first is some kind of work-around for
199 # some BSD-systems I believe that use to provide the GNU libtool named
200 # glibtool, with 'libtool' being something completely different.
201 libtool=`findtool glibtool 2>/dev/null`
202 if test ! -x "$libtool"; then
203 libtool=`findtool ${LIBTOOL:-libtool}`
206 if test -z "$LIBTOOLIZE"; then
207 # set the LIBTOOLIZE here so that glibtoolize is used if glibtool was found
208 # $libtool is already the full path
209 libtoolize="${libtool}ize"
211 libtoolize=`findtool $LIBTOOLIZE`
214 lt_pver=`$libtool --version 2>/dev/null|head -n 1`
215 lt_qver=`echo $lt_pver|sed -e "s/([^)]*)//g" -e "s/^[^0-9]*//g"`
216 lt_version=`echo $lt_qver|sed -e "s/[- ].*//" -e "s/\([a-z]*\)$//"`
217 if test -z "$lt_version"; then
218 echo "buildconf: libtool not found."
219 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
222 old_IFS=$IFS; IFS='.'; set $lt_version; IFS=$old_IFS
228 if test "$lt_major" = "$LIBTOOL_WANTED_MAJOR"; then
229 if test "$lt_minor" -lt "$LIBTOOL_WANTED_MINOR"; then
231 elif test -n "$LIBTOOL_WANTED_PATCH"; then
232 if test "$lt_minor" -gt "$LIBTOOL_WANTED_MINOR"; then
234 elif test -n "$lt_patch"; then
235 if test "$lt_patch" -lt "$LIBTOOL_WANTED_PATCH"; then
243 if test $lt_status != "good"; then
244 echo "buildconf: libtool version $lt_version found."
245 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
249 echo "buildconf: libtool version $lt_version (ok)"
251 if test -f "$libtoolize"; then
252 echo "buildconf: libtoolize found"
254 echo "buildconf: libtoolize not found. Weird libtool installation!"
258 #--------------------------------------------------------------------------
261 m4=`(${M4:-m4} --version || ${M4:-gm4} --version) 2>/dev/null | head -n 1`;
262 m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
264 if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
265 echo "buildconf: GNU m4 version $m4_version (ok)"
267 if test -z "$m4"; then
268 echo "buildconf: m4 version not recognized. You need a GNU m4 installed!"
270 echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!"
275 #--------------------------------------------------------------------------
278 PERL=`findtool ${PERL:-perl}`
279 if test -z "$PERL"; then
280 echo "buildconf: perl not found"
284 #--------------------------------------------------------------------------
285 # Remove files generated on previous buildconf/configure run.
330 #--------------------------------------------------------------------------
331 # run the correct scripts now
334 if test ! -f m4/curl-functions.m4; then
335 echo "buildconf: cURL m4 macros not found"
339 echo "buildconf: running libtoolize"
340 $libtoolize --copy --automake --force || die "The libtoolize command failed"
342 if test "$lt_major" = "1" && test "$lt_minor" = "5"; then
343 if test -z "$lt_patch" || test "$lt_patch" -lt "26"; then
344 if test -f m4/libtool.m4; then
345 our_libtool_m4='m4/libtool.m4'
346 elif test -f libtool.m4; then
347 our_libtool_m4='libtool.m4'
349 if test -n "$our_libtool_m4"; then
350 echo "buildconf: running libtoolize hack to rename some variables"
352 's/lt_prog_compiler_pic_works/lt_cv_prog_compiler_pic_works/g; \
353 s/lt_prog_compiler_static_works/lt_cv_prog_compiler_static_works/g;' \
359 echo "buildconf: running aclocal"
360 ${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS || die "The aclocal command line failed"
362 if test -n "$PERL"; then
363 echo "buildconf: running aclocal hack to convert all mv to mv -f"
364 $PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4
366 echo "buildconf: perl not found"
370 echo "buildconf: running autoheader"
371 ${AUTOHEADER:-autoheader} || die "The autoheader command failed"
373 echo "buildconf: cp lib/curl_config.h.in src/curl_config.h.in"
374 cp lib/curl_config.h.in src/curl_config.h.in
376 echo "buildconf: running autoconf"
377 ${AUTOCONF:-autoconf} || die "The autoconf command failed"
379 if test -d ares; then
381 echo "buildconf: running in ares"
386 echo "buildconf: running automake"
387 ${AUTOMAKE:-automake} -a -c || die "The automake command failed"
389 #--------------------------------------------------------------------------
390 # Depending on the libtool and automake versions being used, config.guess
391 # might not be installed in the subdirectory until automake has finished.
392 # So we can not attempt to use it until this very last buildconf stage.
395 if test ! -f ./config.guess; then
396 echo "buildconf: config.guess not found"
398 buildhost=`./config.guess 2>/dev/null|head -n 1`
413 if test ! -z "$need_lt_check"; then
414 if test -z "$lt_major"; then
416 elif test "$lt_major" -gt "$need_lt_major"; then
418 elif test "$lt_major" -lt "$need_lt_major"; then
420 elif test -z "$lt_minor"; then
422 elif test "$lt_minor" -gt "$need_lt_minor"; then
424 elif test "$lt_minor" -lt "$need_lt_minor"; then
426 elif test -z "$lt_patch"; then
428 elif test "$lt_patch" -gt "$need_lt_patch"; then
430 elif test "$lt_patch" -lt "$need_lt_patch"; then
435 if test "$lt_status" != "good"; then
436 need_lt_version="$need_lt_major.$need_lt_minor.$need_lt_patch"
437 echo "buildconf: libtool version $lt_version found."
438 echo " $buildhost requires libtool $need_lt_version or newer installed."
445 #--------------------------------------------------------------------------
446 # Finished successfully.