1#!/bin/sh
2# Copyright (C) 2006-2014 David Sugar, Tycho Softworks.
3# Copyright (C) 2015 Cherokees of Idaho.
4#
5# This file is free software; as a special exception the author gives
6# unlimited permission to copy and/or distribute it, with or without
7# modifications, as long as this notice is preserved.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13WANT_AUTOCONF_2_5=1
14export WANT_AUTOCONF_2_5
15
16rm -rf autoconf auto*.cache libtool
17if test ! -d autoconf ; then mkdir autoconf ; fi
18
19libtoolize="libtoolize"
20for lt in glibtoolize libtoolize15 libtoolize14 libtoolize13 ; do
21    if test -x /usr/bin/$lt ; then
22        libtoolize=$lt ; break
23    fi
24    if test -x /usr/local/bin/$lt ; then
25        libtoolize=$lt ; break
26    fi
27    if test -x /opt/local/bin/$lt ; then
28        libtoolize=$lt ; break
29    fi
30done
31$libtoolize --copy --force
32
33AUTOMAKE_FLAGS=""
34case $libtoolize in
35*glibtoolize)
36    AUTOMAKE_FLAGS="-i"
37    ;;
38esac
39
40ACLOCALDIRS=""
41if test -d m4 ; then
42    ACLOCALDIRS="-I m4" ; fi
43
44if test ! -z "$ACLOCAL" ; then
45    ACLOCALDIRS="$ACLOCALDIRS "${ACLOCAL}
46elif test ! -z "$ACLOCAL_FLAGS" ; then
47    ACLOCALDIRS="$ACLOCALDIRS $ACLOCAL_FLAGS" ; fi
48
49reconf=""
50if test -f ~/.configure ; then
51    reconf=`grep ^reconfig: ~/.configure | sed -e s/^reconfig://`
52elif test -f /etc/configure.conf ; then
53    reconf=`grep ^reconfig: /etc/configure.conf | sed -e s/^reconfig://` ; fi
54if test ! -z "$reconf" ; then ACLOCALDIRS="$ACLOCALDIRS $reconf" ; fi
55
56if [ -d ~/share/aclocal ] ; then
57    ACLOCALDIRS="$ACLOCALDIRS -I ~/share/aclocal"
58elif [ -d /usr/local/share/aclocal ] ; then
59    ACLOCALDIRS="$ACLOCALDIRS -I /usr/local/share/aclocal"
60fi
61
62if test ! -z "$1" -o ! -z "${AUTOCONF_SUFFIX}" ; then
63    ver="$1"
64else
65    for v in 2.53 2.57 ; do
66        if test -f /usr/bin/autoconf-$v ; then
67                ver=$v
68        fi
69    done
70fi
71
72if test "$ver" = "2.53" -a -z "$AUTOMAKE_SUFFIX" ; then
73    if test -f /usr/bin/automake-1.5 ; then
74        AUTOMAKE_SUFFIX="-1.5"
75    fi
76fi
77
78aclocal${AUTOMAKE_SUFFIX} $ACLOCALDIRS
79
80if test -f /usr/bin/autoheader-$ver ; then
81    /usr/bin/autoheader-$ver
82else
83    autoheader${AUTOCONF_SUFFIX}
84fi
85
86automake${AUTOMAKE_SUFFIX} --add-missing --copy ${AUTOMAKE_FLAGS}
87
88if test -f /usr/bin/autoconf-$ver ; then
89    /usr/bin/autoconf-$ver
90else
91    autoconf${AUTOCONF_SUFFIX}
92fi
93rm -f config.cache
94
95# fix for some broken...
96
97if test -f /usr/bin/automake-1.4 ; then
98    if test -f ltmain.sh ; then
99        cp ltmain.sh autoconf/ltmain.sh
100    fi
101fi
102
103