#!/bin/sh -e

# bootstrap - script to bootstrap the distribution rolling engine

# This script is free software; you can distribute it and/or modify it
# under the terms of the GNU GPL.  See the file COPYING.

# Usage:
#
#  sh ./bootstrap && ./configure && make distcheck
#
# If you wanna force an update of the VERSION, run a
#
#  touch NEWS
#
# before the sh ./bootstrap .
#
# If you don't want an auto-generated version number, do something like
#
#  echo 'm4_define([ST_VERSION], [20041015-cvs.9])' > VERSION.m4 ; touch NEWS; touch ChangeLog; touch VERSION.m4; touch stamp.*; make distcheck
#
#
# Both methods yield a tarball which one can install doing
#
# $ tar zxf PACKAGENAME-*.tar.gz
# $ cd PACKAGENAME-*
# $ ./configure
# $ make
# # make install

# requirements:
#  GNU autoconf, from e.g. ftp.gnu.org:/pub/gnu/autoconf/
#  GNU automake, from e.g. ftp.cygnus.com:/pub/tromey

set -x

test -f ChangeLog || {
    git2cl >ChangeLog
}

if [ ! -f VERSION.m4 ]; then
	chmod a+x setversion
	./setversion
fi

# it's too much hassle to learn jade and friends how to include something
# in topsrcdir
test -f doc/man.ent || ln -s ../man.ent doc/man.ent
test -f man/man.ent || ln -s ../man.ent man/man.ent

# Debian automake package installs as automake-version.  Use this
# to make sure the right automake is being used.
AUTOMAKE=automake-1.18 ACLOCAL=aclocal-1.18 autoreconf --install --symlink -Wall

set +x
echo "You can now run \"./configure && make -C doc && make distcheck\" (or make publish).  Reset by running \"make distclean\"."

