#!/bin/sh
#Generates ./configure, Makefile.in's and tools

set -x
if [ "x$1" = xclean ]; then
    test ! -f Makefile || make maintainer-clean

    # Generated by aclocal.
    rm -f aclocal.m4
    # Generated by autoconf.
    rm -f configure
    rm -rf autom4te.cache/
    # Generated or brought in by automake.
    find -name "Makefile.in" | xargs -r rm
    rm -f autotools/install-sh
    rm -f autotools/missing
    exit;
fi

cd lib
perl -f Makefile.PL
cd ..

# Enable no-portability to disable GNU make extensions warnings, such as $(shell)
#if autoreconf --install --symlink --warnings=all --warnings=no-portability $*
if autoreconf --install --symlink --warnings=all $*
then echo "You now can run ./configure.sh"
else echo "*** Error: please check the messages above. ***"
fi
