#! /bin/bash
## @file
##
## $Id$
##
## $Date: 2004/08/31 15:57:19 $
## $Author: marc $
##
## @copy © Marc Wäckerlin
## @license LGPL, see file COPYING
##
## $Log: bootstrap.sh,v $
## Revision 1.3 2004/08/31 15:57:19 marc
## added file header
##
MY_NAME=${0##*/}
PROJECT_PATH=${0%*/*}
DEFAULT_PROJECT_NAME=${PROJECT_PATH##*/}
HEADER='## @id $Id$
#
# This file has been added by '${MY_NAME}' on '$(date -R)'
# Feel free to change it or even remove and rebuild it, up to your needs
#
## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
'
function run {
check=1
while test $# -gt 0; do
case "$1" in
(--no-check) check=0;;
(*) break;;
esac
shift;
done
echo -n "-> running: $* ..."
result=$($* 2>&1)
res=$?
if test $res -ne 0; then
if test $check -eq 1; then
echo " error"
echo "*** Failed with return code: $res"
if test -n "$result"; then
echo "$result"
fi
exit 1
else
echo " ignored"
fi
else
echo " success"
fi
}
function to {
cat > "$1"
run svn add "$1"
run svn propset svn:keywords "Id" "$1"
}
# Initialize the environment:
if ! test -f configure.ac; then
echo "->generating configure.ac"
to configure.ac < generating makefile.am"
SUBDIRS=""
for d in src test doc examples; do
test -d $d && SUBDIRS="${SUBDIRS} $d"
done
echo "${HEADER}SUBDIRS =${SUBDIRS}" | to makefile.am
fi
if ( test -d doc || grep -q AX_USE_DOXYGEN configure.ac ) \
&& ! test -f doc/makefile.am; then
echo "-> generating doc/makefile.am"
test -d doc || ( mkdir doc && svn add doc )
echo "${HEADER}" | to doc/makefile.am
fi
if test -f makefile; then
run --no-check make distclean
fi
run aclocal
run libtoolize --force
run automake -a
run autoconf