-#!/bin/sh -e
+#!/bin/sh
# Run this to generate all the initial makefiles, etc.
-######
-###### Some defs
-######
+# Copyright (c) 2004-2007. The SimGrid team. All right reserved.
-PKG_NAME="GRAS"
-# a list of all dirs containing possibly some macros
-acmacrodirs="${HOME}/share/aclocal ${PWD}/acmacro /usr/share/aclocal/gnome2-macros"
+# This file is part of the SimGrid project. This is free software:
+# You can redistribute and/or modify it under the terms of the
+# GNU LGPL (v2.1) licence.
-amver=1.8
+amversions="${amver:-1.10}"
-######
-###### End of conf part
-######
-for dir in $acmacrodirs ; do
- if test -d $dir ; then
- aclocalinclude="$aclocalinclude -I $dir";
- fi
-done
-
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
-
-echo "Autoregenerate package \`$PKG_NAME' in directory \`$srcdir'";
-
-(test -f $srcdir/configure.ac \
- && test -f $srcdir/src/include/gras.h) || {
- echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
- echo " top-level $PKG_NAME directory"
- exit 1
-}
-
-######
-###### Some tests (borrowed from macros/autogen.sh from achtung)
-######
-# Changlog :
-# 27/5/00: Changed "to compile gnome" to "to compile $PKG_NAME"
-# 27/5/00: removed gettext
-
-DIE=0
-
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`autoconf' installed to compile $PKG_NAME."
- echo "Download the appropriate package for your distribution,"
- echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
- DIE=1
+check_version()
+{
+ eval $2 --version 2>/dev/null | grep -i "$1.*$3" >/dev/null
}
-(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
- (libtool --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`libtool' installed to compile $PKG_NAME."
- echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
- }
-}
-
-(automake-$amver --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`automake' $amver installed to compile $PKG_NAME."
- echo "Get ftp://ftp.gnu.org/pub/gnu/automake-amver.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
- NO_AUTOMAKE=yes
+find_version()
+{
+ tool=$1
+ found="NOT_FOUND"
+ shift
+ versions="$*"
+
+ for version in $versions ; do
+ if check_version $tool ${tool}${variant} $version; then
+ found="${version}"
+ echo ${version} >&2
+ break
+ fi
+ done
+ if [ "x$found" = "xNOT_FOUND" ]; then
+ found="-"
+ fi
+ echo $found
}
-# if no automake, don't bother testing for aclocal
-test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: Missing \`aclocal'. The version of \`automake'"
- echo "installed doesn't appear recent enough."
- echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
-}
+amver=`find_version automake ${amversions}`
-if test "$DIE" -eq 1; then
+lt=`which libtoolize`
+if [ "x$lt" = "x" ] ; then
+ echo "Libtool not found. Please install the libtool package to proceed with a CVS checkout"
exit 1
fi
-###### END of test part
-
-
-######
-###### Action part
-######
-
-
-if test -z "$*"; then
- if test -e aci.conf ; then
- source aci.conf
- echo "**Warning**: I am going to run \`configure' with arguments resulting from aci_configurator execution."
- echo "ie, $configure_args."
- echo "If you wish to pass other ones, please specify them on the"
- echo \`$0\'" command line, or rerun aci_configurator and save the new ones."
- echo
- else
- configure_args="--enable-maintainer-mode --enable-gtk-doc"
- echo "**Warning**: I am going to run \`configure' with no arguments."
- echo "If you wish to pass any to it, please specify them on the"
- echo \`$0\'" command line."
- echo
- fi
-else
- configure_args="$@"
+am=`which automake-$amver`
+if [ "x$am" = "x" ] ; then
+ echo "automake versions $amversions not found. Please install the relevant package to proceed with a CVS checkout"
+ exit 1
fi
-case $CC in
-xlc )
- am_opt=--include-deps;;
-esac
-
-for coin in `find $srcdir -name configure.ac -print `\
- `find $srcdir -name configure.in -print`
-do
- dr=`dirname $coin`
- if test -f $dr/NO-AUTO-GEN; then
- echo skipping $dr -- flagged as no auto-gen
- else
- echo "************"
- echo "* Processing directory $dr"
- echo "************"
-
- if [ -e $dr/configure.in ] ; then
- configfile="configure.in"
- else
- configfile="configure.ac"
- fi
- macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
- here=`pwd`
- cd $dr
- if grep "^AM_PROG_LIBTOOL" $configfile >/dev/null; then
- if test -z "$NO_LIBTOOLIZE" ; then
- echo "Running libtoolize --force --copy in "`pwd`"..."
- libtoolize --force --copy || exit 1
- fi
- fi
- echo "Running aclocal-$amver $aclocalinclude..."
- aclocal-$amver $aclocalinclude
- if grep "^AM_CONFIG_HEADER" $configfile >/dev/null; then
- echo "Running autoheader in "`pwd`"..."
- autoheader || exit 1
- fi
- if grep "^AM_INIT_AUTOMAKE" $configfile >/dev/null; then
- echo "Running automake-$amver --gnu --add-missing $am_opt ..."
- automake-$amver --gnu --add-missing $am_opt || exit 1
- fi
- echo "Running autoconf..."
- autoconf || exit 1
- cd $here
- fi
-done
-
-#conf_flags="--enable-compile-warnings"
-# \
-#--enable-compile-warnings=minimum"
-#--enable-iso-c
-
-#echo "rebuilding the api documentation... "
-#cd docs && ./refresh-api " "&& echo "Done with the rebuilding of the api documentation." && cd .. || exit 1
-
-
-if test x$NOCONFIGURE = x; then
- echo "************"
- echo "* Running ./configure $configure_args..."
- echo "************"
-
- ./configure $configure_args || exit 1
-
-else
- echo Skipping configure process.
+ac=`which autoconf`
+if [ "x$ac" = "x" ] ; then
+ echo "autoconf not found. Please install the relevant package to proceed with a CVS checkout"
+ exit 1
fi
-echo Now type \`make\' to compile $PKG_NAME
-
-
+set -e
+# AUTOCONF=
+# AUTOHEADER=
+# AUTOPOINT=
+# LIBTOOLIZE=
+
+ACLOCAL="aclocal-$amver -I acmacro" \
+AUTOMAKE="automake-$amver" \
+ autoreconf -v -i -s || exit 1
+
+echo
+echo "And now, please launch ./configure"
+echo "----------------------------------"
+
+# What to do the day we declare optional modules using ACI:
+# if test -e aci.conf ; then
+# source aci.conf
+# pass the content of $configure_args to configure
+
+echo
+echo "Most common flags:"
+echo " --enable-maintainer-mode mandatory if you use the CVS version"
+echo " --disable-compile-optimizations useful if your gdb gets fooled"
+echo
+
+echo
+echo "If you want to compile for several archs from the same (nfs-mounted?) tree, do:"
+echo " mkdir your_arch; cd your_arch && ../configure --srcdir=.."
+
+echo
+echo "(after configure, you'll naturally have to run \`make')"
+echo
+echo