Skip to content
Snippets Groups Projects
Commit 88a8eee2 authored by Sreejith Pulloor Kuttanikkad's avatar Sreejith Pulloor Kuttanikkad
Browse files

script modified and just seems to work again with new dune modules.

[[Imported from SVN: r4545]]
parent 23886e72
No related branches found
No related tags found
No related merge requests found
......@@ -9,19 +9,21 @@
set -e
echo Dune project generator
echo ----------------------
echo Dune project/module generator
echo -----------------------------
################## READ OPTIONS ##################
while [ "$DATACORRECT" != "y" -a "$DATACORRECT" != "Y" ]; do
PROJECT=""
while [ -z $PROJECT ]; do
read -p "Project name? " PROJECT
read -p "New Project/Module name? " PROJECT
done
VERSION=""
while [ -z $VERSION ]; do
read -p "Project version? " VERSION
read -p "Project/Module version? " VERSION
done
MAINTAINER=""
while [ -z $MAINTAINER ]; do
......@@ -34,22 +36,55 @@ while [ "$DATACORRECT" != "y" -a "$DATACORRECT" != "Y" ]; do
read -p "Are these informations correct? [y/N] " DATACORRECT
echo
echo "Look at README and dune.module files in the project"
echo "Sometimes you may have to tweak the configure.ac a bit"
echo "Now you can run dunecontrol script which would setup new module"
done
################## CONFIGURE.AC ##################
mkdir "$PROJECT"
################## dune.module ##################
cat > "$PROJECT/dune.module" <<C_DELIM
#dune module information file#
##############################
#Name of the module
Module:dune_$PROJECT
#depending on
Depends:dune_common dune_grid dune_disc dune_istl
C_DELIM
################## CONFIGURE.AC ##################
cat > "$PROJECT/configure.ac" <<C_DELIM
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT($PROJECT, $VERSION, $MAINTAINER)
AM_INIT_AUTOMAKE($PROJECT, $VERSION, $MAINTAINER)
AC_CONFIG_SRCDIR([$PROJECT.cc])
AM_CONFIG_HEADER([config.h])
# we need no more than the standard DUNE-stuff
DUNE_CHECK_ALL
DUNE_CHECK_ALL([dunecommon],[dunegrid],[duneistl],[dunedisc])
if test x\$HAVE_DUNECOMMON != x1 ; then
AC_MSG_ERROR([Can't work without the dune-common module. Maybe you have to supply your dune-common directory as --with-dunecommon=dir])
fi
if test x\$HAVE_DUNEGRID != x1 ; then
AC_MSG_ERROR([Can't work without the dune-grid module. Maybe you have to supply your dune-grid directory as --with-dunegrid=dir])
fi
if test x\$HAVE_DUNEDISC != x1 ; then
AC_MSG_ERROR([Can't work without the dune-disc module. Maybe you have to supply your dune-disc directory as --with-dunedisc=dir])
fi
if test x\$HAVE_DUNEISTL != x1 ; then
AC_MSG_ERROR([Can't work without the dune-istl module. Maybe you have to supply your dune-istl directory as --with-duneistl=dir])
fi
# implicitly set the Dune-flags everywhere
AC_SUBST(AM_CPPFLAGS, \$DUNE_CPPFLAGS)
......@@ -58,7 +93,6 @@ LIBS="\$DUNE_LIBS"
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
# finally print the summary information
DUNE_SUMMARY_ALL
C_DELIM
......@@ -66,45 +100,19 @@ C_DELIM
################## AUTOGEN.SH ##################
cat > "$PROJECT/autogen.sh" <<A_DELIM
#!/bin/sh
# \$Id$
# $Id$
#### barf on errors
# barf on errors
set -e
# may be used to force a certain automake-version e.g. 1.7
AMVERS=
# everybody who checks out the CVS wants the maintainer-mode to be enabled
# (should be off for source distributions, this should happen automatically)
#
DEFAULTCONFOPT="--enable-maintainer-mode"
# default values
DEBUG=1
OPTIM=0
usage () {
echo "Usage: ./autogen.sh [options]"
echo " -i, --intel use intel compiler"
echo " -g, --gnu use gnu compiler (default)"
echo " --opts=FILE use compiler-options from FILE"
echo " -d, --debug switch debug-opts on"
echo " -n, --nodebug switch debug-opts off"
echo " -o, --optim switch optimization on"
echo " --with-dune=PATH directory with dune/ inside"
echo " -h, --help you already found this :)"
echo
echo "Parameters not in the list above are directly passed to configure. See"
echo
echo " ./configure --help"
echo
echo "for a list of additional 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 :-)"
}
# no compiler set yet
COMPSET=0
for OPT in \$* ; do
for OPT in "\$@"; do
set +e
# stolen from configure...
# when no option is set, this returns an error code
......@@ -112,106 +120,82 @@ for OPT in \$* ; do
set -e
case "\$OPT" in
-i|--intel) . ./icc.opts ; COMPSET=1 ;;
-g|--gnu) . ./gcc.opts ; COMPSET=1 ;;
--opts=*)
if [ -r \$arg ] ; then
echo "reading options from \$arg..."
. ./\$arg ;
COMPSET=1;
else
echo "Cannot open compiler options file \$arg!" ;
exit 1;
fi ;;
-d|--debug) DEBUG=1 ;;
-n|--nodebug) DEBUG=0 ;;
-o|--optim) OPTIM=1 ;;
--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 ;;
# special hack: use the with-dune-dir for aclocal-includes
--with-dune=*)
eval DUNEDIR=\$arg
# add the option anyway
CONFOPT="\$CONFOPT \$OPT" ;;
# pass unknown opts to ./configure
*) CONFOPT="\$CONFOPT \$OPT" ;;
*)
if test -d "\$OPT/m4"; then
ACLOCAL_FLAGS="\$ACLOCAL_FLAGS -I \$OPT/m4"
fi
if test -d "\$OPT/am"; then
am_dir="\$OPT/am"
fi
;;
esac
done
# set special m4-path if --with-dune is set
if [ x\$DUNEDIR != x ] ; then
# aclocal from automake 1.8 seems to need an absolute path for inclusion
FULLDIR=\`cd \$DUNEDIR && pwd\`
# automagically use directory above if complete Dune-dir was supplied
if test \`basename \$FULLDIR\` = "dune" ; then
FULLDIR=\`cd \$FULLDIR/.. && pwd\`
fi
ACLOCALOPT="-I \$FULLDIR/dune/m4/"
fi
# use the free compiler as default :-)
if [ "\$COMPSET" != "1" ] ; then
echo "No compiler set, using GNU compiler as default"
. ./gcc.opts
fi
# create flags
COMPFLAGS="\$FLAGS"
# maybe add debug flag
if [ "\$DEBUG" = "1" ] ; then
COMPFLAGS="\$COMPFLAGS \$DEBUGFLAGS"
## 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
# maybe add optimization flag
if [ "\$OPTIM" = "1" ] ; then
COMPFLAGS="\$COMPFLAGS \$OPTIMFLAGS"
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
# check if automake-version was set
if test "x\$AMVERS" != x ; then
echo Warning: explicitly using automake version \$AMVERS
# binaries are called automake-\$AMVERS
AMVERS="-\$AMVERS"
fi
#### create all autotools-files
## run autotools
echo "--> libtoolize..."
# force to write new versions of files, otherwise upgrading libtools
# doesn't do anything...
# 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
# prepare everything
echo "--> aclocal..."
aclocal\$AMVERS \$ACLOCALOPT
# sanity check to catch missing --with-dune
if ! grep DUNE aclocal.m4 > /dev/null ; then
echo "aclocal.m4 doesn't contain any DUNE-macros, this would crash autoconf"
echo "or automake later. Maybe you should provide a --with-dune=PATH parameter"
exit 1
fi
aclocal\$AMVERSION \$ACLOCAL_FLAGS
# applications should provide a config.h for now
echo "--> autoheader..."
autoheader
autoheader\$ACVERSION
# create a link to the dune-common am directory
echo "--> linking dune-common/am..."
rm -f am
ln -s \$am_dir am
# call automake/conf
echo "--> automake..."
automake\$AMVERS --add-missing
automake\$AMVERSION --add-missing
echo "--> autoconf..."
autoconf
autoconf\$ACVERSION
#### start configure with special environment
export CC="\$COMP"
export CXX="\$CXXCOMP"
export CPP="\$COMP -E"
export CFLAGS="\$COMPFLAGS"
export CXXFLAGS="\$COMPFLAGS"
./configure \$DEFAULTCONFOPT \$CONFOPT
## tell the user what to do next
echo "Now run ./configure "
A_DELIM
......@@ -313,19 +297,38 @@ noinst_PROGRAMS = ${PROJECT}
${PROJECT}_SOURCES = ${PROJECT}.cc
${PROJECT}_CXXFLAGS = \$(MPI_CPPFLAGS) \$(UG_CPPFLAGS) \$(AMIRAMESH_CPPFLAGS) \$(ALBERTA_CPPFLAGS) -DWITH_INDEX_SETS
${PROJECT}_LDADD = \$(MPI_LDFLAGS) \$(ALBERTA_LDFLAGS) \$(ALBERTA_LIBS) \$(AMIRAMESH_LDFLAGS) \$(AMIRAMESH_LIBS) \$(UG_LDFLAGS) \$(UG_LIBS) \$(MPI_LDFLAGS) \$(DUNE_LDFLAGS) \$(DUNE_LIBS)
# don't follow the full GNU-standard
# we need automake 1.5
AUTOMAKE_OPTIONS = foreign 1.5
# pass most important options when "make distcheck" is used
DISTCHECK_CONFIGURE_FLAGS = --with-dune=\$(DUNEROOT) CXX="\$(CXX)" CC="\$(CC)"
M_DELIM
################## PROJECT.CC ##################
cat> "$PROJECT/$PROJECT.cc" << CC_DELIM
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <iostream>
#include <dune/common/exceptions.hh>
int main()
{
try
{
std::cout << "Hello World! This is ${PROJECT}." << std::endl;
return 0;
}
catch (Dune::Exception &e)
{
std::cerr << "Dune reported error: " << e << std::endl;
}
catch (...)
{
std::cerr << "Unknown exception thrown!" << std::endl;
};
}
CC_DELIM
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment