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 # this works as 'which' but we use a different name to make it more obvious we
31 # aren't using 'which'! ;-)
38 # echo "checks for $file in $path" >&2
39 if test -f "$path/$file"; then
46 #--------------------------------------------------------------------------
47 # Ensure that buildconf runs from the subdirectory where configure.ac lives
49 if test ! -f configure.ac ||
50 test ! -f src/main.c ||
51 test ! -f lib/urldata.h ||
52 test ! -f include/curl/curl.h; then
53 echo "Can not run buildconf from outside of curl's source subdirectory!"
54 echo "Change to the subdirectory where buildconf is found, and try again."
58 #--------------------------------------------------------------------------
59 # autoconf 2.57 or newer
62 ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
63 if test -z "$ac_version"; then
64 echo "buildconf: autoconf not found."
65 echo " You need autoconf version $need_autoconf or newer installed."
68 IFS=.; set $ac_version; IFS=' '
69 if test "$1" = "2" -a "$2" -lt "57" || test "$1" -lt "2"; then
70 echo "buildconf: autoconf version $ac_version found."
71 echo " You need autoconf version $need_autoconf or newer installed."
72 echo " If you have a sufficient autoconf installed, but it"
73 echo " is not named 'autoconf', then try setting the"
74 echo " AUTOCONF environment variable."
78 echo "buildconf: autoconf version $ac_version (ok)"
80 #--------------------------------------------------------------------------
81 # autoheader 2.50 or newer
83 ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
84 if test -z "$ah_version"; then
85 echo "buildconf: autoheader not found."
86 echo " You need autoheader version 2.50 or newer installed."
89 IFS=.; set $ah_version; IFS=' '
90 if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then
91 echo "buildconf: autoheader version $ah_version found."
92 echo " You need autoheader version 2.50 or newer installed."
93 echo " If you have a sufficient autoheader installed, but it"
94 echo " is not named 'autoheader', then try setting the"
95 echo " AUTOHEADER environment variable."
99 echo "buildconf: autoheader version $ah_version (ok)"
101 #--------------------------------------------------------------------------
102 # automake 1.7 or newer
105 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/'`
106 if test -z "$am_version"; then
107 echo "buildconf: automake not found."
108 echo " You need automake version $need_automake or newer installed."
111 IFS=.; set $am_version; IFS=' '
112 if test "$1" = "1" -a "$2" -lt "7" || test "$1" -lt "1"; then
113 echo "buildconf: automake version $am_version found."
114 echo " You need automake version $need_automake or newer installed."
115 echo " If you have a sufficient automake installed, but it"
116 echo " is not named 'automake', then try setting the"
117 echo " AUTOMAKE environment variable."
121 echo "buildconf: automake version $am_version (ok)"
123 ac=`findtool ${ACLOCAL:-aclocal}`
124 if test -z "$ac"; then
125 echo "buildconf: aclocal not found. Weird automake installation!"
128 echo "buildconf: aclocal found"
131 #--------------------------------------------------------------------------
134 LIBTOOL_WANTED_MAJOR=1
135 LIBTOOL_WANTED_MINOR=4
136 LIBTOOL_WANTED_PATCH=2
137 LIBTOOL_WANTED_VERSION=1.4.2
139 # this approach that tries 'glibtool' first is some kind of work-around for
140 # some BSD-systems I believe that use to provide the GNU libtool named
141 # glibtool, with 'libtool' being something completely different.
142 libtool=`findtool glibtool 2>/dev/null`
143 if test ! -x "$libtool"; then
144 libtool=`findtool ${LIBTOOL:-libtool}`
147 if test -z "$LIBTOOLIZE"; then
148 # set the LIBTOOLIZE here so that glibtoolize is used if glibtool was found
149 # $libtool is already the full path
150 libtoolize="${libtool}ize"
152 libtoolize=`findtool $LIBTOOLIZE`
155 lt_pversion=`$libtool --version 2>/dev/null|head -n 2|sed -e 's/^[^0-9]*//g' -e 's/[- ].*//'`
156 if test -z "$lt_pversion"; then
157 echo "buildconf: libtool not found."
158 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
161 lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$//'`
162 IFS=.; set $lt_version; IFS=' '
169 if test "$major" = "$LIBTOOL_WANTED_MAJOR"; then
170 if test "$minor" -lt "$LIBTOOL_WANTED_MINOR"; then
172 elif test -n "$LIBTOOL_WANTED_PATCH"; then
173 if test "$minor" -gt "$LIBTOOL_WANTED_MINOR"; then
175 elif test -n "$patch"; then
176 if test "$patch" -lt "$LIBTOOL_WANTED_PATCH"; then
184 if test $lt_status != "good"; then
185 echo "buildconf: libtool version $lt_pversion found."
186 echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
190 echo "buildconf: libtool version $lt_version (ok)"
192 if test -f "$libtoolize"; then
193 echo "buildconf: libtoolize found"
195 echo "buildconf: libtoolize not found. Weird libtool installation!"
199 #--------------------------------------------------------------------------
202 m4=`${M4:-m4} --version 2>/dev/null|head -n 1`;
203 m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
205 if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
206 echo "buildconf: GNU m4 version $m4_version (ok)"
208 echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!"
212 #--------------------------------------------------------------------------
215 PERL=`findtool ${PERL:-perl}`
217 #--------------------------------------------------------------------------
218 # Remove files generated on previous buildconf/configure run.
220 for fname in aclocal.m4 \
232 if test -f "$fname" ; then
236 if test -d autom4te.cache; then
237 rm -f -r autom4te.cache
239 if test -d docs/examples/.deps; then
240 rm -f -r docs/examples/.deps
242 if test -d lib/.deps; then
245 if test -d src/.deps; then
248 if test -d tests/libtest/.deps; then
249 rm -f -r tests/libtest/.deps
251 if test -d tests/server/.deps; then
252 rm -f -r tests/server/.deps
255 #--------------------------------------------------------------------------
256 # Remove files generated in ares subdir on previous buildconf/configure run.
258 if test -d ares; then
260 for fname in aclocal.m4 \
276 if test -f "$fname" ; then
280 if test -d autom4te.cache; then
281 rm -f -r autom4te.cache
283 if test -d .deps; then
289 #--------------------------------------------------------------------------
290 # run the correct scripts now
293 if test -z "$ACLOCAL_FLAGS"; then
294 ACLOCAL_FLAGS="-I m4"
296 ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4"
299 tmp_host_type=`uname -a | sed '/SunOS/s/.*\(SunOS\).*/\1/'`
300 if test "x$tmp_host_type" = "xSunOS"; then
301 ACLOCAL_FLAGS="$ACLOCAL_FLAGS --verbose"
305 echo "buildconf: using ACLOCAL_FLAGS: $ACLOCAL_FLAGS"
307 echo "buildconf: running libtoolize"
308 $libtoolize --copy --automake --force || die "The libtoolize command failed"
309 echo "buildconf: running aclocal"
310 ${ACLOCAL:-aclocal} $ACLOCAL_FLAGS || die "The aclocal command line failed"
311 if test -n "$PERL"; then
312 echo "buildconf: running aclocal hack to convert all mv to mv -f"
313 $PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4
315 echo "buildconf: perl not found"
318 echo "buildconf: running autoheader"
319 ${AUTOHEADER:-autoheader} || die "The autoheader command failed"
320 echo "buildconf: cp lib/config.h.in src/config.h.in"
321 cp lib/config.h.in src/config.h.in
322 echo "buildconf: running autoconf"
323 ${AUTOCONF:-autoconf} || die "The autoconf command failed"
325 if test -d ares; then
327 echo "buildconf: running in ares"
332 echo "buildconf: running automake"
333 ${AUTOMAKE:-automake} -a -c || die "The automake command failed"