#!/bin/sh
#
# configure: maakt de Makefile aan op basis van Makefile.in
#     de bedoeling is dat men "./configure; make ; make install" kan doen
#     Het is allemaal ge"inspireerd op de GNU autotools
#     Voor meer informatie verwijs ik dan ook naar
#      http://sources.redhat.com/autobook
#     (this book is tutorial for Autoconf, Automake and Libtool,
#      collectively reffered to as the GNU autotools)
#
# Copyright 2003-2010 Geert Stappers
# bestuderen, wijzigingen en kopieren mag, het is GPL
#

checkavailable() {
  echo -n "Checking '${1}' available ... "
  type ${1} > /dev/null 2>&1
  if [ $? -eq 0 ] ; then
    echo yes
  else
    echo no
    exit 2
  fi
}

checkavailable make
checkavailable asciidoc
checkavailable dot # graphviz plug in

if asciidoc --theme list | grep /losc$ ; then
  echo losc theme is installed
else
  echo Installing losc theme
  asciidoc --theme install website/images/losc.zip
fi

if [ website/images/losc.zip -nt ~/.asciidoc/themes/losc/losc.css ] ; then
  echo Updating losc theme
  asciidoc --theme remove losc # Dan komt er _geen_ melding bij install
  asciidoc --theme install website/images/losc.zip
  # aanname: de losc.css is iets jonger dan de losc.zip waar ie in zit
fi

echo creeren top level Makefile
./my.autoconf

echo creeren Makefile in de "web site" directory
( cd website ; ./my.autoconf )

echo 'creeren Makefile in de "slides" directory'
( cd website/slides ; ./my.autoconf )

# klaar
