Brad Spencer provided changes to allow buildconf to work on OS X.
[platform/upstream/c-ares.git] / buildconf
1 #!/bin/sh
2
3 # The logic for finding the right libtoolize is taken from libcurl's buildconf
4
5 #--------------------------------------------------------------------------
6 # findtool works as 'which' but we use a different name to make it more
7 # obvious we aren't using 'which'! ;-)
8 #
9 findtool(){
10   file="$1"
11
12   old_IFS=$IFS; IFS=':'
13   for path in $PATH
14   do
15     IFS=$old_IFS
16     # echo "checks for $file in $path" >&2
17     if test -f "$path/$file"; then
18       echo "$path/$file"
19       return
20     fi
21   done
22   IFS=$old_IFS
23 }
24
25 # this approach that tries 'glibtool' first is some kind of work-around for
26 # some BSD-systems I believe that use to provide the GNU libtool named
27 # glibtool, with 'libtool' being something completely different.
28 libtool=`findtool glibtool 2>/dev/null`
29 if test ! -x "$libtool"; then
30   libtool=`findtool ${LIBTOOL:-libtool}`
31 fi
32
33 if test -z "$LIBTOOLIZE"; then
34   # set the LIBTOOLIZE here so that glibtoolize is used if glibtool was found
35   # $libtool is already the full path
36   libtoolize="${libtool}ize"
37 else
38   libtoolize=`findtool $LIBTOOLIZE`
39 fi
40
41 ${libtoolize} --copy --automake --force
42 ${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS
43 ${AUTOHEADER:-autoheader}
44 ${AUTOCONF:-autoconf}
45 ${AUTOMAKE:-automake} --add-missing