Skip to content
Snippets Groups Projects
Commit 6704244b authored by Christian Engwer's avatar Christian Engwer
Browse files

first version of a generic automake for all dune projects

[[Imported from SVN: r5107]]
parent 04f636af
Branches
Tags
No related merge requests found
#!/bin/sh
# $Id: autogen.sh 5054 2008-01-08 15:06:55Z christi $
# barf on errors
set -e
usage () {
echo "Usage: dune-autogen [options]"
echo " --ac=, --acversion=VERSION use a specific VERSION of autoconf"
echo " --am=, --amversion=VERSION use a specific VERSION of automake"
echo " -h, --help you already found this :-)"
}
## get my name...
name=`grep '^Module:' dune.module | cut -d ':' -f 2 | sed -e 's/ //g'`
## dune-all.m4
rm -f dune-all.m4
# add current dir to PATH
PATH=$PATH:`dirname $0`/bin
for OPT in "$@"; do
set +e
# stolen from configure...
# when no option is set, this returns an error code
arg=`expr "x$OPT" : 'x[^=]*=\(.*\)'`
set -e
case "$OPT" in
--ac=*|--acversion=*)
if test "x$arg" = "x"; then
usage;
exit 1;
fi
ACVERSION=$arg
;;
--am=*|--amversion=*)
if test "x$arg" = "x"; then
usage;
exit 1;
fi
AMVERSION=$arg
;;
-h|--help) usage ; exit 0 ;;
*)
if test -d "$OPT/m4"; then
if [ -d m4 ]; then
cat "$OPT/m4/"*.m4 >> dune-all.m4
fi
fi
if test -d "$OPT/am"; then
am_dir="$OPT/am"
fi
if test -d "$OPT/share/aclocal"; then
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $OPT/share/aclocal"
fi
if test -d "$OPT/share/dune-common/am"; then
am_dir="$OPT/share/dune-common/am"
fi
PATH=$PATH:$OPT/bin
;;
esac
done
## report parameters
if test "x$ACVERSION" != "x"; then
echo "Forcing autoconf version $ACVERSION"
if ! which autoconf$ACVERSION > /dev/null; then
echo
echo "Error: Could not find autoconf$ACVERSION"
echo " Did you specify a wrong version?"
exit 1
fi
fi
if test "x$AMVERSION" != "x"; then
echo "Forcing automake version $AMVERSION"
if ! which automake$AMVERSION > /dev/null; then
echo
echo "Error: Could not find automake$AMVERSION"
echo " Did you specify a wrong version?"
exit 1
fi
fi
## run autotools
echo "--> libtoolize..."
# this script won't rewrite the files if they already exist. This is a
# PITA when you want to upgrade libtool, thus I'm setting --force
libtoolize --force
# merge m4 files
if [ -d m4 ]; then
echo "--> collect m4 files"
cat m4/*.m4 > $name.m4
fi
# prepare everything
echo "--> aclocal... $ACLOCAL_FLAGS"
rm -f aclocal.m4
rm -rf autom4te.cache
aclocal$AMVERSION -I .
# applications should provide a config.h for now
echo "--> autoheader..."
autoheader$ACVERSION
echo "--> automake..."
automake$AMVERSION --add-missing
echo "--> autoconf..."
autoconf$ACVERSION
## tell the user what to do next
echo "Now run ./configure to setup $name"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment