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 #--------------------------------------------------------------------------
85 # autoheader 2.50 or newer
87 ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
88 if test -z "$ah_version"; then
89 echo "buildconf: autoheader not found."
90 echo " You need autoheader version 2.50 or newer installed."
93 IFS=.; set $ah_version; IFS=' '
94 if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then
95 echo "buildconf: autoheader version $ah_version found."
96 echo " You need autoheader version 2.50 or newer installed."
97 echo " If you have a sufficient autoheader installed, but it"
98 echo " is not named 'autoheader', then try setting the"
99 echo " AUTOHEADER environment variable."
103 echo "buildconf: autoheader version $ah_version (ok)"
105 #--------------------------------------------------------------------------
106 # automake 1.7 or newer
109 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/'`
110 if test -z "$am_version"; then
111 echo "buildconf: automake not found."
112 echo " You need automake version $need_automake or newer installed."
115 IFS=.; set $am_version; IFS=' '
116 if test "$1" = "1" -a "$2" -lt "7" || test "$1" -lt "1"; then
117 echo "buildconf: automake version $am_version found."
118 echo " You need automake version $need_automake or newer installed."
119 echo " If you have a sufficient automake installed, but it"
120 echo " is not named 'automake', then try setting the"
121 echo " AUTOMAKE environment variable."
125 echo "buildconf: automake version $am_version (ok)"
127 ac=`findtool ${ACLOCAL:-aclocal}`
128 if test -z "$ac"; then
129 echo "buildconf: aclocal not found. Weird automake installation!"
132 echo "buildconf: aclocal found"
135 #--------------------------------------------------------------------------
138 LIBTOOL_WANTED_MAJOR=1
139 LIBTOOL_WANTED_MINOR=4
140 LIBTOOL_WANTED_PATCH=2
141 LIBTOOL_WANTED_VERSION=1.4.2
143 # this approach that tries 'glibtool' first is some kind of work-around for
144 # some BSD-systems I believe that use to provide the GNU libtool named
145 # glibtool, with 'libtool' being something completely different.
146 libtool=`findtool glibtool 2>/dev/null`
147 if test ! -x "$libtool"; then
148 libtool=`findtool ${LIBTOOL:-libtool}`
151 if test -z "$LIBTOOLIZE"; then
152 # set the LIBTOOLIZE here so that glibtoolize is used if glibtool was found
153 # $libtool is already the full path
154 libtoolize="${libtool}ize"
156 libtoolize=`findtool $LIBTOOLIZE`
159 lt_pversion=`$libtool --version 2>/dev/null|head -n 2|sed -e 's/^[^0-9]*//g' -e 's/[- ].*//'`
160 if test -z "$lt_pversion"; then
161 echo "buildconf: libtool not found."
162 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
165 lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$//'`
166 IFS=.; set $lt_version; IFS=' '
173 if test "$major" = "$LIBTOOL_WANTED_MAJOR"; then
174 if test "$minor" -lt "$LIBTOOL_WANTED_MINOR"; then
176 elif test -n "$LIBTOOL_WANTED_PATCH"; then
177 if test "$minor" -gt "$LIBTOOL_WANTED_MINOR"; then
179 elif test -n "$patch"; then
180 if test "$patch" -lt "$LIBTOOL_WANTED_PATCH"; then
188 if test $lt_status != "good"; then
189 echo "buildconf: libtool version $lt_pversion found."
190 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
194 echo "buildconf: libtool version $lt_version (ok)"
196 if test -f "$libtoolize"; then
197 echo "buildconf: libtoolize found"
199 echo "buildconf: libtoolize not found. Weird libtool installation!"
203 #--------------------------------------------------------------------------
206 m4=`${M4:-m4} --version 2>/dev/null|head -n 1`;
207 m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
209 if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
210 echo "buildconf: GNU m4 version $m4_version (ok)"
212 echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!"
216 #--------------------------------------------------------------------------
219 PERL=`findtool ${PERL:-perl}`
221 #--------------------------------------------------------------------------
222 # Remove files generated on previous buildconf/configure run.
224 for fname in aclocal.m4 \
236 if test -f "$fname" ; then
240 if test -d autom4te.cache; then
241 rm -f -r autom4te.cache
243 if test -d docs/examples/.deps; then
244 rm -f -r docs/examples/.deps
246 if test -d lib/.deps; then
249 if test -d src/.deps; then
252 if test -d tests/libtest/.deps; then
253 rm -f -r tests/libtest/.deps
255 if test -d tests/server/.deps; then
256 rm -f -r tests/server/.deps
259 #--------------------------------------------------------------------------
260 # Remove files generated in c-ares subdir on previous buildconf/configure run.
262 if test -d ares; then
264 for fname in aclocal.m4 \
280 if test -f "$fname" ; then
284 if test -d autom4te.cache; then
285 rm -f -r autom4te.cache
287 if test -d .deps; then
293 #--------------------------------------------------------------------------
294 # run the correct scripts now
297 tmp_host_type=`uname -a | sed '/SunOS/s/.*\(SunOS\).*/\1/'`
298 if test "x$tmp_host_type" = "xSunOS"; then
299 ACLOCAL_FLAGS="$ACLOCAL_FLAGS --verbose"
301 echo "buildconf: PATH: $PATH"
303 # show all available sed's in PATH order
304 old_IFS=$IFS; IFS=':'
308 if test -f "$path/sed"; then
309 echo "buildconf: sed: $path/sed"
313 echo "buildconf: SED: $SED"
317 echo "buildconf: running libtoolize"
318 $libtoolize --copy --automake --force || die "The libtoolize command failed"
319 echo "buildconf: running aclocal"
320 ${ACLOCAL:-aclocal} $ACLOCAL_FLAGS || die "The aclocal command line failed"
321 if test -n "$PERL"; then
322 echo "buildconf: running aclocal hack to convert all mv to mv -f"
323 $PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4
325 echo "buildconf: perl not found"
328 echo "buildconf: running autoheader"
329 ${AUTOHEADER:-autoheader} || die "The autoheader command failed"
330 echo "buildconf: cp lib/config.h.in src/config.h.in"
331 cp lib/config.h.in src/config.h.in
332 echo "buildconf: running autoconf"
333 ${AUTOCONF:-autoconf} || die "The autoconf command failed"
335 if test -d ares; then
337 echo "buildconf: running in ares"
342 echo "buildconf: running automake"
343 ${AUTOMAKE:-automake} -a -c || die "The automake command failed"