#! /bin/bash
## @file
##
## $Id$
##
## $Date: 2004/08/31 15:57:19 $
## $Author: marc $
##
## @copy © Marc Wäckerlin
## @license LGPL, see file <a href="license.html">COPYING</a>
##
## $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 <<EOF
${ HEADER } m4_define( x_package_name, ${ DEFAULT_PROJECT_NAME } ) # project's name
m4_define( x_major, 0) # project's major version
m4_define( x_minor, 0) # project's minor version
m4_include( ax_init_standard_project.m4)
AC_INIT( x_package_name, x_major.x_minor.x_least, x_bugreport, x_package_name)
AM_INIT_AUTOMAKE( [ 1.9 tar-pax] )
AX_INIT_STANDARD_PROJECT
# requirements, uncomment, what you need:
#AX_USE_CXX
#AX_USE_LIBTOOL
#AX_USE_DOXYGEN
#AX_USE_DEBIAN_PACKAGING
#AX_USE_RPM_PACKAGING
#AX_USE_CPPUNIT
#AX_BUILD_EXAMPLES
# create output
AC_OUTPUT
EOF
echo " please edit configure.ac, then rerun $0 "
fi
if ! test -f makefile.am; then
echo "-> 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