#!/bin/sh -e

# $Id: bootstrap,v 1.9 2004/10/15 18:51:02 joostvb Exp $

# 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 .
#
# 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 || {
    touch ChangeLog && cvs2cl --prune --accum -U AUTHORS
}

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

# hack as used in pcproxy
test -f acinclude.m4 || {
    if test -f /usr/share/autoconf-archive/ac_define_dir.m4
    then
        ln -s /usr/share/autoconf-archive/ac_define_dir.m4 acinclude.m4
    else
        cat <<EOT
You need the autoconf-archive Debian package, version >= 20031029-1.
Alternatively, you could please install the GNU Autoconf Macro Archive's
http://www.gnu.org/software/ac-archive/htmldoc/ac_define_dir.html as
acinclude.m4.
EOT
   fi
}

# Debian automake package installs as automake-version.  Use this
# to make sure the right automake is being used.
aclocal-1.9 \
    && automake-1.9 --add-missing --verbose --gnu \
    && autoconf

# alternatively, run
#  autoreconf --install --symlink

set +x
echo "You can now run \"./configure && make publish\" (or make distcheck)."

