#!/bin/bash
set -x
set -e
if [[ `uname` = Darwin ]] 
then
    # This uses locally-installed libtoolize and automake since the apple-supplied one is buggy
    # as of OS X 10.4.7
    ../bin/libtoolize --copy --force
    ../bin/aclocal -I m4
    # Patch that fixes 'local relocation entries in non-writable section' linker error.
    patch < aclocal.m4.patch
    ../bin/automake --foreign --add-missing --copy 
    autoconf
else
    libtoolize --copy --force
    aclocal -I m4
    automake --foreign --add-missing --copy 
    autoconf
fi
