Blame autogen.sh

Packit 0848f5
#! /bin/sh
Packit 0848f5
# 
Packit 0848f5
# (C) 2006 by Argonne National Laboratory.
Packit 0848f5
#     See COPYRIGHT in top-level directory.
Packit 0848f5
#
Packit 0848f5
# Update all of the derived files
Packit 0848f5
# For best performance, execute this in the top-level directory.
Packit 0848f5
# There are some experimental features to allow it to be executed in
Packit 0848f5
# subdirectories
Packit 0848f5
#
Packit 0848f5
# Eventually, we want to allow this script to be executed anywhere in the
Packit 0848f5
# mpich tree.  This is not yet implemented.
Packit 0848f5
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Utility functions
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
recreate_tmp() {
Packit 0848f5
    rm -rf .tmp
Packit 0848f5
    mkdir .tmp 2>&1 >/dev/null
Packit 0848f5
}
Packit 0848f5
Packit 0848f5
warn() {
Packit 0848f5
    echo "===> WARNING: $@"
Packit 0848f5
}
Packit 0848f5
Packit 0848f5
error() {
Packit 0848f5
    echo "===> ERROR:   $@"
Packit 0848f5
}
Packit 0848f5
Packit 0848f5
echo_n() {
Packit 0848f5
    # "echo -n" isn't portable, must portably implement with printf
Packit 0848f5
    printf "%s" "$*"
Packit 0848f5
}
Packit 0848f5
Packit 0848f5
# Assume Program's install-dir is <install-dir>/bin/<prog>.
Packit 0848f5
# Given program name as the 1st argument,
Packit 0848f5
# the install-dir is returned is returned in 2nd argument.
Packit 0848f5
# e.g., ProgHomeDir libtoolize libtooldir.
Packit 0848f5
ProgHomeDir() {
Packit 0848f5
    prog=$1
Packit 0848f5
    progpath="`which $prog`"
Packit 0848f5
    progbindir="`dirname $progpath`"
Packit 0848f5
    proghome=`(cd $progbindir/.. && pwd)`
Packit 0848f5
    eval $2=$proghome
Packit 0848f5
}
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Run any local pre-update hooks
Packit 0848f5
########################################################################
Packit 0848f5
if test -d maint/hooks/pre ; then
Packit 0848f5
    for hook in `ls maint/hooks/pre/* 2>/dev/null` ; do
Packit 0848f5
        if test -x "$hook" ; then
Packit 0848f5
            echo_n "executing pre-update hook '$hook'... "
Packit 0848f5
            ./$hook
Packit 0848f5
            echo done
Packit 0848f5
        else
Packit 0848f5
            warn "unable to execute pre-update hook: '$hook'"
Packit 0848f5
        fi
Packit 0848f5
    done
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
# This used to be an optionally installed hook to help with git-svn
Packit 0848f5
# versions of the old SVN repo.  Now that we are using git, this is our
Packit 0848f5
# mechanism that replaces relative svn:externals paths, such as for
Packit 0848f5
# "confdb" and "mpl". The basic plan is to delete the destdir and then
Packit 0848f5
# copy all of the files, warts and all, from the source directory to the
Packit 0848f5
# destination directory.
Packit 0848f5
echo
Packit 0848f5
echo "####################################"
Packit 0848f5
echo "## Replicating confdb (and similar)"
Packit 0848f5
echo "####################################"
Packit 0848f5
echo
Packit 0848f5
Packit 0848f5
sync_external () {
Packit 0848f5
    srcdir=$1
Packit 0848f5
    destdir=$2
Packit 0848f5
Packit 0848f5
    echo "syncing '$srcdir' --> '$destdir'"
Packit 0848f5
Packit 0848f5
    # deletion prevents creating 'confdb/confdb' situation, also cleans
Packit 0848f5
    # stray files that may have crept in somehow
Packit 0848f5
    rm -rf "$destdir"
Packit 0848f5
    cp -pPR "$srcdir" "$destdir"
Packit 0848f5
}
Packit 0848f5
Packit 0848f5
confdb_dirs=
Packit 0848f5
confdb_dirs="${confdb_dirs} src/mpi/romio/confdb"
Packit 0848f5
confdb_dirs="${confdb_dirs} src/mpl/confdb"
Packit 0848f5
confdb_dirs="${confdb_dirs} src/pm/hydra/confdb"
Packit 0848f5
confdb_dirs="${confdb_dirs} src/pm/hydra/mpl/confdb"
Packit 0848f5
confdb_dirs="${confdb_dirs} test/mpi/confdb"
Packit 0848f5
Packit 0848f5
# hydra's copy of mpl
Packit 0848f5
sync_external src/mpl src/pm/hydra/mpl
Packit 0848f5
Packit 0848f5
# all the confdb directories, by various names
Packit 0848f5
for destdir in $confdb_dirs ; do
Packit 0848f5
    sync_external confdb "$destdir"
Packit 0848f5
done
Packit 0848f5
Packit 0848f5
# a couple of other random files
Packit 0848f5
if [ -f maint/version.m4 ] ; then
Packit 0848f5
    cp -pPR maint/version.m4 src/pm/hydra/version.m4
Packit 0848f5
    cp -pPR maint/version.m4 src/mpi/romio/version.m4
Packit 0848f5
    cp -pPR maint/version.m4 test/mpi/version.m4
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
# Now sanity check that some of the above sync was successful
Packit 0848f5
f="aclocal_cc.m4"
Packit 0848f5
for d in $confdb_dirs ; do
Packit 0848f5
    if [ -f "$d/$f" ] ; then :
Packit 0848f5
    else
Packit 0848f5
        error "expected to find '$f' in '$d'"
Packit 0848f5
        exit 1
Packit 0848f5
    fi
Packit 0848f5
done
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
echo
Packit 0848f5
echo "####################################"
Packit 0848f5
echo "## Checking user environment"
Packit 0848f5
echo "####################################"
Packit 0848f5
echo
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Checks to make sure we are running from the correct location
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
echo_n "Verifying the location of autogen.sh... "
Packit 0848f5
if [ ! -d maint -o ! -s maint/version.m4 ] ; then
Packit 0848f5
    echo "must execute at top level directory for now"
Packit 0848f5
    exit 1
Packit 0848f5
fi
Packit 0848f5
echo "done"
Packit 0848f5
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Initialize variables to default values (possibly from the environment)
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
# Default choices
Packit 0848f5
do_bindings=yes
Packit 0848f5
do_geterrmsgs=yes
Packit 0848f5
do_getcvars=yes
Packit 0848f5
do_f77=yes
Packit 0848f5
do_f77tof90=yes
Packit 0848f5
do_build_configure=yes
Packit 0848f5
do_genstates=yes
Packit 0848f5
do_atdir_check=no
Packit 0848f5
do_atver_check=yes
Packit 0848f5
do_subcfg_m4=yes
Packit 0848f5
Packit 0848f5
export do_build_configure
Packit 0848f5
Packit 0848f5
# Allow MAKE to be set from the environment
Packit 0848f5
MAKE=${MAKE-make}
Packit 0848f5
Packit 0848f5
# external packages that require autogen.sh to be run for each of them
Packit 0848f5
externals="src/pm/hydra src/mpi/romio src/openpa"
Packit 0848f5
# amdirs are the directories that make use of autoreconf
Packit 0848f5
amdirs=". src/mpl src/util/logging/rlog"
Packit 0848f5
Packit 0848f5
autoreconf_args="-if"
Packit 0848f5
export autoreconf_args
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Read the command-line arguments
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
# List of steps that we will consider (We do not include depend
Packit 0848f5
# because the values for depend are not just yes/no)
Packit 0848f5
AllSteps="geterrmsgs bindings f77 f77tof90 build_configure genstates getparms"
Packit 0848f5
stepsCleared=no
Packit 0848f5
Packit 0848f5
for arg in "$@" ; do
Packit 0848f5
    case $arg in 
Packit 0848f5
	-echo)
Packit 0848f5
	    set -x
Packit 0848f5
	    ;;
Packit 0848f5
	
Packit 0848f5
	-atdircheck=*)
Packit 0848f5
	    val=`echo X$arg | sed -e 's/^X-atdircheck=//'`
Packit 0848f5
            case $val in
Packit 0848f5
		yes|YES|true|TRUE|1) do_atdir_check=yes ;;
Packit 0848f5
		no|NO|false|FALSE|0) do_atdir_check=no ;;
Packit 0848f5
		*) warn "unknown option: $arg."
Packit 0848f5
            esac
Packit 0848f5
            ;;
Packit 0848f5
Packit 0848f5
	-atvercheck=*)
Packit 0848f5
            val=`echo X$arg | sed -e 's/^X-atvercheck=//'`
Packit 0848f5
            case $val in
Packit 0848f5
		yes|YES|true|TRUE|1) do_atver_check=yes ;;
Packit 0848f5
		no|NO|false|FALSE|0) do_atver_check=no ;;
Packit 0848f5
		*) warn "unknown option: $arg."
Packit 0848f5
            esac
Packit 0848f5
            ;;
Packit 0848f5
Packit 0848f5
	-do=*|--do=*)
Packit 0848f5
	    opt=`echo A$arg | sed -e 's/^A--*do=//'`
Packit 0848f5
	    case $opt in 
Packit 0848f5
		build-configure|configure) opt=build_configure ;;
Packit 0848f5
	    esac
Packit 0848f5
	    var=do_$opt
Packit 0848f5
Packit 0848f5
	    # Check that this opt is known
Packit 0848f5
	    eval oldval=\$"$var"
Packit 0848f5
	    if [ -z "$oldval" ] ; then
Packit 0848f5
		echo "-do=$opt is unrecognized"
Packit 0848f5
		exit 1
Packit 0848f5
	    else
Packit 0848f5
		if [ $stepsCleared = no ] ; then
Packit 0848f5
		    for step in $AllSteps ; do
Packit 0848f5
			var=do_$step
Packit 0848f5
			eval $var=no
Packit 0848f5
		    done
Packit 0848f5
		    stepsCleared=yes
Packit 0848f5
		fi
Packit 0848f5
		var=do_$opt
Packit 0848f5
		eval $var=yes
Packit 0848f5
	    fi
Packit 0848f5
	    ;;
Packit 0848f5
Packit 0848f5
        -verbose-autoreconf|--verbose-autoreconf)
Packit 0848f5
            autoreconf_args="-vif"
Packit 0848f5
            export autoreconf_args
Packit 0848f5
            ;;
Packit 0848f5
Packit 0848f5
	-with-genstates|--with-genstates)
Packit 0848f5
	    do_genstates=yes
Packit 0848f5
	    ;;
Packit 0848f5
Packit 0848f5
	-without-genstates|--without-genstates)
Packit 0848f5
	    do_genstates=no
Packit 0848f5
	    ;;
Packit 0848f5
 
Packit 0848f5
	-with-errmsgs|--with-errmsgs)
Packit 0848f5
	    do_geterrmsgs=yes
Packit 0848f5
	    ;;
Packit 0848f5
Packit 0848f5
	-without-errmsgs|--without-errmsgs)
Packit 0848f5
	    do_geterrmsgs=no
Packit 0848f5
	    ;;
Packit 0848f5
Packit 0848f5
	-with-bindings|--with-bindings)
Packit 0848f5
	    do_bindings=yes
Packit 0848f5
	    ;;
Packit 0848f5
Packit 0848f5
	-without-bindings|--without-bindings)
Packit 0848f5
	    do_bindings=no
Packit 0848f5
	    ;;
Packit 0848f5
Packit 0848f5
	-with-f77|--with-f77)
Packit 0848f5
	    do_f77=yes
Packit 0848f5
	    ;;
Packit 0848f5
Packit 0848f5
	-without-f77|--without-f77)
Packit 0848f5
	    do_f77=no
Packit 0848f5
	    ;;
Packit 0848f5
Packit 0848f5
	-with-autotools=*|--with-autotools=*)
Packit 0848f5
	    autotoolsdir=`echo "A$arg" | sed -e 's/.*=//'`
Packit 0848f5
	    ;;
Packit 0848f5
Packit 0848f5
	-help|--help|-usage|--usage)
Packit 0848f5
	    cat <
Packit 0848f5
   ./autogen.sh [ --with-autotools=dir ] \\
Packit 0848f5
                [ -atdircheck=[yes|no] ] \\
Packit 0848f5
                [ -atvercheck=[yes|no] ] \\
Packit 0848f5
                [ --verbose-autoreconf ] \\
Packit 0848f5
                [ --do=stepname ] [ -distrib ]
Packit 0848f5
    Update the files in the MPICH build tree.  This file builds the 
Packit 0848f5
    configure files, creates the Makefile.in files, extracts the error
Packit 0848f5
    messages.
Packit 0848f5
Packit 0848f5
    You can use --with-autotools=dir to specify a directory that
Packit 0848f5
    contains alternate autotools.
Packit 0848f5
Packit 0848f5
    -atdircheck=[yes|no] specifies the enforcement of all autotools
Packit 0848f5
    should be installed in the same directory.
Packit 0848f5
Packit 0848f5
    -atvercheck=[yes|no] specifies if the check for the version of 
Packit 0848f5
    autotools should be carried out.
Packit 0848f5
Packit 0848f5
    -distrib creates a distribution version of the Makefile.in files (no
Packit 0848f5
    targets for updating the Makefile.in from Makefile.sm or rebuilding the
Packit 0848f5
    autotools targets).  This does not create the configure files because
Packit 0848f5
    some of those depend on rules in the Makefile.in in that directory.  
Packit 0848f5
    Thus, to build all of the files for a distribution, run autogen.sh
Packit 0848f5
    twice, as in 
Packit 0848f5
         autogen.sh && autogen.sh -distrib
Packit 0848f5
Packit 0848f5
    Use --do=stepname to update only a single step.  For example, 
Packit 0848f5
    --do=build_configure only updates the configure scripts.  The available
Packit 0848f5
    steps are:
Packit 0848f5
EOF
Packit 0848f5
	    for step in $AllSteps ; do
Packit 0848f5
		echo "        $step"
Packit 0848f5
	    done
Packit 0848f5
	    exit 1
Packit 0848f5
	    ;;
Packit 0848f5
Packit 0848f5
	*)
Packit 0848f5
	    echo "unknown argument $arg"
Packit 0848f5
	    exit 1
Packit 0848f5
	    ;;
Packit 0848f5
Packit 0848f5
    esac
Packit 0848f5
done
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Check for the location of autotools
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
if [ -z "$autotoolsdir" ] ; then
Packit 0848f5
    autotoolsdir=$MPICH_AUTOTOOLS_DIR
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
if [ -n "$autotoolsdir" ] ; then
Packit 0848f5
    if [ -x $autotoolsdir/autoconf -a -x $autotoolsdir/autoheader ] ; then
Packit 0848f5
        autoconf=$autotoolsdir/autoconf
Packit 0848f5
        autoheader=$autotoolsdir/autoheader
Packit 0848f5
        autoreconf=$autotoolsdir/autoreconf
Packit 0848f5
        automake=$autotoolsdir/automake
Packit 0848f5
        autom4te=$autotoolsdir/autom4te
Packit 0848f5
        aclocal=$autotoolsdir/aclocal
Packit 0848f5
        if [ -x "$autotoolsdir/glibtoolize" ] ; then
Packit 0848f5
            libtoolize=$autotoolsdir/glibtoolize
Packit 0848f5
        else
Packit 0848f5
            libtoolize=$autotoolsdir/libtoolize
Packit 0848f5
        fi
Packit 0848f5
Packit 0848f5
	AUTOCONF=$autoconf
Packit 0848f5
	AUTOHEADER=$autoheader
Packit 0848f5
        AUTORECONF=$autoreconf
Packit 0848f5
        AUTOMAKE=$automake
Packit 0848f5
	AUTOM4TE=$autom4te
Packit 0848f5
        ACLOCAL=$aclocal
Packit 0848f5
        LIBTOOLIZE=$libtoolize
Packit 0848f5
Packit 0848f5
	export AUTOCONF
Packit 0848f5
	export AUTOHEADER
Packit 0848f5
        export AUTORECONF
Packit 0848f5
        export AUTOM4TE
Packit 0848f5
        export AUTOMAKE
Packit 0848f5
        export ACLOCAL
Packit 0848f5
        export LIBTOOLIZE
Packit 0848f5
    else
Packit 0848f5
        echo "could not find executable autoconf and autoheader in $autotoolsdir"
Packit 0848f5
	exit 1
Packit 0848f5
    fi
Packit 0848f5
else
Packit 0848f5
    autoconf=${AUTOCONF:-autoconf}
Packit 0848f5
    autoheader=${AUTOHEADER:-autoheader}
Packit 0848f5
    autoreconf=${AUTORECONF:-autoreconf}
Packit 0848f5
    autom4te=${AUTOM4TE:-autom4te}
Packit 0848f5
    automake=${AUTOMAKE:-automake}
Packit 0848f5
    aclocal=${ACLOCAL:-aclocal}
Packit 0848f5
    if test -z "${LIBTOOLIZE+set}" && ( glibtoolize --version ) >/dev/null 2>&1 ; then
Packit 0848f5
        libtoolize=glibtoolize
Packit 0848f5
    else
Packit 0848f5
        libtoolize=${LIBTOOLIZE:-libtoolize}
Packit 0848f5
    fi
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
ProgHomeDir $autoconf   autoconfdir
Packit 0848f5
ProgHomeDir $automake   automakedir
Packit 0848f5
ProgHomeDir $libtoolize libtooldir
Packit 0848f5
Packit 0848f5
echo_n "Checking if autotools are in the same location... "
Packit 0848f5
if [ "$autoconfdir" = "$automakedir" -a "$autoconfdir" = "$libtooldir" ] ; then
Packit 0848f5
    same_atdir=yes
Packit 0848f5
    echo "yes, all in $autoconfdir"
Packit 0848f5
else
Packit 0848f5
    same_atdir=no
Packit 0848f5
    echo "no"
Packit 0848f5
    echo "	autoconf is in $autoconfdir"
Packit 0848f5
    echo "	automake is in $automakedir"
Packit 0848f5
    echo "	libtool  is in $libtooldir"
Packit 0848f5
    # Emit a big warning message if $same_atdir = no.
Packit 0848f5
    warn "Autotools are in different locations. In rare occasion,"
Packit 0848f5
    warn "resulting configure or makefile may fail in some unexpected ways."
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Check if autoreconf can be patched to work
Packit 0848f5
## when autotools are not in the same location.
Packit 0848f5
## This test needs to be done before individual tests of autotools
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
# If autotools are not in the same location, override autoreconf appropriately.
Packit 0848f5
if [ "$same_atdir" != "yes" ] ; then
Packit 0848f5
    if [ -z "$libtooldir" ] ; then
Packit 0848f5
        ProgHomeDir $libtoolize libtooldir
Packit 0848f5
    fi
Packit 0848f5
    libtoolm4dir="$libtooldir/share/aclocal"
Packit 0848f5
    echo_n "Checking if $autoreconf accepts -I $libtoolm4dir... "
Packit 0848f5
    new_autoreconf_works=no
Packit 0848f5
    if [ -d "$libtoolm4dir" -a -f "$libtoolm4dir/libtool.m4" ] ; then
Packit 0848f5
        recreate_tmp
Packit 0848f5
        cat >.tmp/configure.ac <<_EOF
Packit 0848f5
AC_INIT(foo,1.0)
Packit 0848f5
AC_PROG_LIBTOOL
Packit 0848f5
AC_OUTPUT
Packit 0848f5
_EOF
Packit 0848f5
        AUTORECONF="$autoreconf -I $libtoolm4dir"
Packit 0848f5
        if (cd .tmp && $AUTORECONF -ivf >/dev/null 2>&1) ; then
Packit 0848f5
            new_autoreconf_works=yes
Packit 0848f5
        fi
Packit 0848f5
        rm -rf .tmp
Packit 0848f5
    fi
Packit 0848f5
    echo "$new_autoreconf_works"
Packit 0848f5
    # If autoreconf accepts -I <libtool's m4 dir> correctly, use -I.
Packit 0848f5
    # If not, run libtoolize before autoreconf (i.e. for autoconf <= 2.63)
Packit 0848f5
    # This test is more general than checking the autoconf version.
Packit 0848f5
    if [ "$new_autoreconf_works" != "yes" ] ; then
Packit 0848f5
        echo_n "Checking if $autoreconf works after an additional $libtoolize step... "
Packit 0848f5
        new_autoreconf_works=no
Packit 0848f5
        recreate_tmp
Packit 0848f5
        # Need AC_CONFIG_
Packit 0848f5
        cat >.tmp/configure.ac <<_EOF
Packit 0848f5
AC_INIT(foo,1.0)
Packit 0848f5
AC_CONFIG_AUX_DIR([m4])
Packit 0848f5
AC_CONFIG_MACRO_DIR([m4])
Packit 0848f5
AC_PROG_LIBTOOL
Packit 0848f5
AC_OUTPUT
Packit 0848f5
_EOF
Packit 0848f5
        cat >.tmp/Makefile.am <<_EOF
Packit 0848f5
ACLOCAL_AMFLAGS = -I m4
Packit 0848f5
_EOF
Packit 0848f5
        AUTORECONF="eval $libtoolize && $autoreconf"
Packit 0848f5
        if (cd .tmp && $AUTORECONF -ivf >u.txt 2>&1) ; then
Packit 0848f5
            new_autoreconf_works=yes
Packit 0848f5
        fi
Packit 0848f5
        rm -rf .tmp
Packit 0848f5
        echo "$new_autoreconf_works"
Packit 0848f5
    fi
Packit 0848f5
    if [ "$new_autoreconf_works" = "yes" ] ; then
Packit 0848f5
        export AUTORECONF
Packit 0848f5
        autoreconf="$AUTORECONF"
Packit 0848f5
    else
Packit 0848f5
        # Since all autoreconf workarounds do not work, we need
Packit 0848f5
        # to require all autotools to be in the same directory.
Packit 0848f5
        do_atdir_check=yes
Packit 0848f5
        error "Since none of the autoreconf workaround works"
Packit 0848f5
        error "and autotools are not in the same directory, aborting..."
Packit 0848f5
        error "Updating autotools or putting all autotools in the same location"
Packit 0848f5
        error "may resolve the issue."
Packit 0848f5
        exit 1
Packit 0848f5
    fi
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Verify autoconf version
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
echo_n "Checking for autoconf version... "
Packit 0848f5
recreate_tmp
Packit 0848f5
ver=2.67
Packit 0848f5
# petsc.mcs.anl.gov's /usr/bin/autoreconf is version 2.65 which returns OK
Packit 0848f5
# if configure.ac has AC_PREREQ() withOUT AC_INIT.
Packit 0848f5
#
Packit 0848f5
# ~/> hostname
Packit 0848f5
# petsc
Packit 0848f5
# ~> /usr/bin/autoconf --version
Packit 0848f5
# autoconf (GNU Autoconf) 2.65
Packit 0848f5
# ....
Packit 0848f5
# ~/> cat configure.ac
Packit 0848f5
# AC_PREREQ(2.68)
Packit 0848f5
# ~/> /usr/bin/autoconf ; echo "rc=$?"
Packit 0848f5
# configure.ac:1: error: Autoconf version 2.68 or higher is required
Packit 0848f5
# configure.ac:1: the top level
Packit 0848f5
# autom4te: /usr/bin/m4 failed with exit status: 63
Packit 0848f5
# rc=63
Packit 0848f5
# ~/> /usr/bin/autoreconf ; echo "rc=$?"
Packit 0848f5
# rc=0
Packit 0848f5
cat > .tmp/configure.ac<
Packit 0848f5
AC_INIT
Packit 0848f5
AC_PREREQ($ver)
Packit 0848f5
AC_OUTPUT
Packit 0848f5
EOF
Packit 0848f5
if (cd .tmp && $autoreconf $autoreconf_args >/dev/null 2>&1 ) ; then
Packit 0848f5
    echo ">= $ver"
Packit 0848f5
else
Packit 0848f5
    echo "bad autoconf installation"
Packit 0848f5
    cat <
Packit 0848f5
You either do not have autoconf in your path or it is too old (version
Packit 0848f5
$ver or higher required). You may be able to use
Packit 0848f5
Packit 0848f5
     autoconf --version
Packit 0848f5
Packit 0848f5
Unfortunately, there is no standard format for the version output and
Packit 0848f5
it changes between autotools versions.  In addition, some versions of
Packit 0848f5
autoconf choose among many versions and provide incorrect output).
Packit 0848f5
EOF
Packit 0848f5
    exit 1
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Verify automake version
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
echo_n "Checking for automake version... "
Packit 0848f5
recreate_tmp
Packit 0848f5
ver=1.15
Packit 0848f5
cat > .tmp/configure.ac<
Packit 0848f5
AC_INIT(testver,1.0)
Packit 0848f5
AC_CONFIG_AUX_DIR([m4])
Packit 0848f5
AC_CONFIG_MACRO_DIR([m4])
Packit 0848f5
m4_ifdef([AM_INIT_AUTOMAKE],,[m4_fatal([AM_INIT_AUTOMAKE not defined])])
Packit 0848f5
AM_INIT_AUTOMAKE([$ver foreign])
Packit 0848f5
AC_MSG_RESULT([A message])
Packit 0848f5
AC_OUTPUT([Makefile])
Packit 0848f5
EOF
Packit 0848f5
cat <<EOF >.tmp/Makefile.am
Packit 0848f5
ACLOCAL_AMFLAGS = -I m4
Packit 0848f5
EOF
Packit 0848f5
if [ ! -d .tmp/m4 ] ; then mkdir .tmp/m4 >/dev/null 2>&1 ; fi
Packit 0848f5
if (cd .tmp && $autoreconf $autoreconf_args >/dev/null 2>&1 ) ; then
Packit 0848f5
    echo ">= $ver"
Packit 0848f5
else
Packit 0848f5
    echo "bad automake installation"
Packit 0848f5
    cat <
Packit 0848f5
You either do not have automake in your path or it is too old (version
Packit 0848f5
$ver or higher required). You may be able to use
Packit 0848f5
Packit 0848f5
     automake --version
Packit 0848f5
Packit 0848f5
Unfortunately, there is no standard format for the version output and
Packit 0848f5
it changes between autotools versions.  In addition, some versions of
Packit 0848f5
autoconf choose among many versions and provide incorrect output).
Packit 0848f5
EOF
Packit 0848f5
    exit 1
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Verify libtool version
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
echo_n "Checking for libtool version... "
Packit 0848f5
recreate_tmp
Packit 0848f5
ver=2.4.4
Packit 0848f5
cat <<EOF >.tmp/configure.ac
Packit 0848f5
AC_INIT(testver,1.0)
Packit 0848f5
AC_CONFIG_AUX_DIR([m4])
Packit 0848f5
AC_CONFIG_MACRO_DIR([m4])
Packit 0848f5
m4_ifdef([LT_PREREQ],,[m4_fatal([LT_PREREQ not defined])])
Packit 0848f5
LT_PREREQ($ver)
Packit 0848f5
LT_INIT()
Packit 0848f5
AC_MSG_RESULT([A message])
Packit 0848f5
EOF
Packit 0848f5
cat <<EOF >.tmp/Makefile.am
Packit 0848f5
ACLOCAL_AMFLAGS = -I m4
Packit 0848f5
EOF
Packit 0848f5
if [ ! -d .tmp/m4 ] ; then mkdir .tmp/m4 >/dev/null 2>&1 ; fi
Packit 0848f5
if (cd .tmp && $autoreconf $autoreconf_args >/dev/null 2>&1 ) ; then
Packit 0848f5
    echo ">= $ver"
Packit 0848f5
else
Packit 0848f5
    echo "bad libtool installation"
Packit 0848f5
    cat <
Packit 0848f5
You either do not have libtool in your path or it is too old
Packit 0848f5
(version $ver or higher required). You may be able to use
Packit 0848f5
Packit 0848f5
     libtool --version
Packit 0848f5
Packit 0848f5
Unfortunately, there is no standard format for the version output and
Packit 0848f5
it changes between autotools versions.  In addition, some versions of
Packit 0848f5
autoconf choose among many versions and provide incorrect output).
Packit 0848f5
EOF
Packit 0848f5
    exit 1
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Checking for UNIX find
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
echo_n "Checking for UNIX find... "
Packit 0848f5
find . -name 'configure.ac' > /dev/null 2>&1
Packit 0848f5
if [ $? = 0 ] ; then
Packit 0848f5
    echo "done"
Packit 0848f5
else
Packit 0848f5
    echo "not found (error)"
Packit 0848f5
    exit 1
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Checking if xargs rm -rf works
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
echo_n "Checking if xargs rm -rf works... "
Packit 0848f5
if [ -d "`find . -name __random_dir__`" ] ; then
Packit 0848f5
    error "found a directory named __random_dir__"
Packit 0848f5
    exit 1
Packit 0848f5
else
Packit 0848f5
    mkdir __random_dir__
Packit 0848f5
    find . -name __random_dir__ | xargs rm -rf > /dev/null 2>&1
Packit 0848f5
    if [ $? = 0 ] ; then
Packit 0848f5
	echo "yes"
Packit 0848f5
    else
Packit 0848f5
	echo "no (error)"
Packit 0848f5
	rm -rf __random_dir__
Packit 0848f5
	exit 1
Packit 0848f5
    fi
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
Packit 0848f5
Packit 0848f5
echo
Packit 0848f5
echo
Packit 0848f5
echo "###########################################################"
Packit 0848f5
echo "## Autogenerating required files"
Packit 0848f5
echo "###########################################################"
Packit 0848f5
echo
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Building maint/Version
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
# build a substitute maint/Version script now that we store the single copy of
Packit 0848f5
# this information in an m4 file for autoconf's benefit
Packit 0848f5
echo_n "Generating a helper maint/Version... "
Packit 0848f5
if $autom4te -l M4sugar maint/Version.base.m4 > maint/Version ; then
Packit 0848f5
    echo "done"
Packit 0848f5
else
Packit 0848f5
    echo "error"
Packit 0848f5
    error "unable to correctly generate maint/Version shell helper"
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Building the README
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
echo_n "Updating the README... "
Packit 0848f5
. ./maint/Version
Packit 0848f5
if [ -f README.vin ] ; then
Packit 0848f5
    sed -e "s/%VERSION%/${MPICH_VERSION}/g" README.vin > README
Packit 0848f5
    echo "done"
Packit 0848f5
else
Packit 0848f5
    echo "error"
Packit 0848f5
    error "README.vin file not present, unable to update README version number (perhaps we are running in a release tarball source tree?)"
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Building subsys_include.m4
Packit 0848f5
########################################################################
Packit 0848f5
if [ "X$do_subcfg_m4" = Xyes ] ; then
Packit 0848f5
    echo_n "Creating subsys_include.m4... "
Packit 0848f5
    ./maint/gen_subcfg_m4
Packit 0848f5
    echo "done"
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Building ROMIO glue code
Packit 0848f5
########################################################################
Packit 0848f5
echo_n "Building ROMIO glue code... "
Packit 0848f5
( cd src/glue/romio && chmod a+x ./all_romio_symbols && ./all_romio_symbols ../../mpi/romio/include/mpio.h.in )
Packit 0848f5
echo "done"
Packit 0848f5
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Building non-C interfaces
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
# Create the bindings if necessary 
Packit 0848f5
if [ $do_bindings = "yes" ] ; then
Packit 0848f5
    build_f77=no
Packit 0848f5
    build_f90=no
Packit 0848f5
    build_cxx=no
Packit 0848f5
    if [ $do_f77 = "yes" ] ; then
Packit 0848f5
        if [ ! -s src/binding/fortran/mpif_h/abortf.c ] ; then
Packit 0848f5
	    build_f77=yes
Packit 0848f5
        elif find src/binding/fortran/mpif_h -name 'buildiface' -newer 'src/binding/fortran/mpif_h/abortf.c' >/dev/null 2>&1 ; then
Packit 0848f5
	    build_f77=yes
Packit 0848f5
        fi
Packit 0848f5
        if [ ! -s src/binding/fortran/use_mpi/mpi_base.f90 ] ; then
Packit 0848f5
 	    build_f90=yes
Packit 0848f5
        elif find src/binding/fortran/use_mpi -name 'buildiface' -newer 'src/binding/fortran/use_mpi/mpi_base.f90' >/dev/null 2>&1 ; then
Packit 0848f5
	    build_f90=yes
Packit 0848f5
        fi
Packit 0848f5
        if [ ! -s src/binding/fortran/use_mpi_f08/wrappers_c/cdesc.c ] ; then
Packit 0848f5
	    build_f08=yes
Packit 0848f5
        elif find src/binding/fortran/use_mpi_f08 -name 'buildiface' -newer 'src/binding/fortran/use_mpi_f08/wrappers_c/cdesc.c' >/dev/null 2>&1 ; then
Packit 0848f5
	    build_f08=yes
Packit 0848f5
        fi
Packit 0848f5
    fi
Packit 0848f5
Packit 0848f5
    if [ $build_f77 = "yes" ] ; then
Packit 0848f5
	echo_n "Building Fortran 77 interface... "
Packit 0848f5
	( cd src/binding/fortran/mpif_h && chmod a+x ./buildiface && ./buildiface )
Packit 0848f5
	echo "done"
Packit 0848f5
    fi
Packit 0848f5
    if [ $build_f90 = "yes" ] ; then
Packit 0848f5
	echo_n "Building Fortran 90 interface... "
Packit 0848f5
	# Remove any copy of mpi_base.f90 (this is used to handle the
Packit 0848f5
	# Double precision vs. Real*8 option
Packit 0848f5
	rm -f src/binding/fortran/use_mpi/mpi_base.f90.orig
Packit 0848f5
	( cd src/binding/fortran/use_mpi && chmod a+x ./buildiface && ./buildiface )
Packit 0848f5
	( cd src/binding/fortran/use_mpi && ../mpif_h/buildiface -infile=cf90t.h -deffile=./cf90tdefs)
Packit 0848f5
	echo "done"
Packit 0848f5
    fi
Packit 0848f5
    if [ $build_f08 = "yes" ] ; then
Packit 0848f5
	echo_n "Building Fortran 08 interface... "
Packit 0848f5
	# Top-level files
Packit 0848f5
	( cd src/binding/fortran/use_mpi_f08 && chmod a+x ./buildiface && ./buildiface )
Packit 0848f5
        # Delete the old Makefile.mk
Packit 0848f5
        ( rm -f src/binding/fortran/use_mpi_f08/wrappers_c/Makefile.mk )
Packit 0848f5
        # Execute once for mpi.h.in ...
Packit 0848f5
	( cd src/binding/fortran/use_mpi_f08/wrappers_c && chmod a+x ./buildiface && ./buildiface ../../../../include/mpi.h.in )
Packit 0848f5
        # ... and once for mpio.h.in
Packit 0848f5
	( cd src/binding/fortran/use_mpi_f08/wrappers_c && chmod a+x ./buildiface && ./buildiface ../../../../mpi/romio/include/mpio.h.in )
Packit 0848f5
	echo "done"
Packit 0848f5
    fi
Packit 0848f5
Packit 0848f5
    if [ ! -s src/binding/cxx/mpicxx.h ] ; then 
Packit 0848f5
	build_cxx=yes
Packit 0848f5
    elif find src/binding/cxx -name 'buildiface' -newer 'src/binding/cxx/mpicxx.h' >/dev/null 2>&1 ; then
Packit 0848f5
	build_cxx=yes
Packit 0848f5
    fi
Packit 0848f5
    if [ $build_cxx = "yes" ] ; then
Packit 0848f5
	echo_n "Building C++ interface... "
Packit 0848f5
	( cd src/binding/cxx && chmod a+x ./buildiface &&
Packit 0848f5
	  ./buildiface -nosep -initfile=./cxx.vlist )
Packit 0848f5
	echo "done"
Packit 0848f5
    fi
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Extract error messages
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
# Capture the error messages
Packit 0848f5
if [ $do_geterrmsgs = "yes" ] ; then
Packit 0848f5
    if [ -x maint/extracterrmsgs ] ; then
Packit 0848f5
        echo_n "Extracting error messages... "
Packit 0848f5
        rm -rf .tmp
Packit 0848f5
        rm -f .err
Packit 0848f5
	rm -f unusederr.txt
Packit 0848f5
        maint/extracterrmsgs -careful=unusederr.txt \
Packit 0848f5
	    -skip=src/util/multichannel/mpi.c `cat maint/errmsgdirs` > \
Packit 0848f5
	    .tmp 2>.err
Packit 0848f5
        # (error here is ok)
Packit 0848f5
	echo "done"
Packit 0848f5
Packit 0848f5
        update_errdefs=yes
Packit 0848f5
        if [ -s .err ] ; then 
Packit 0848f5
            cat .err
Packit 0848f5
            rm -f .err2
Packit 0848f5
            grep -v "Warning:" .err > .err2
Packit 0848f5
            if [ -s .err2 ] ; then
Packit 0848f5
                warn "Because of errors in extracting error messages, the file"
Packit 0848f5
                warn "src/mpi/errhan/defmsg.h was not updated."
Packit 0848f5
		error "Error message files in src/mpi/errhan were not updated."
Packit 0848f5
   	        rm -f .tmp .err .err2
Packit 0848f5
		exit 1
Packit 0848f5
            fi
Packit 0848f5
            rm -f .err .err2
Packit 0848f5
        else
Packit 0848f5
            # Incase it exists but has zero size
Packit 0848f5
            rm -f .err
Packit 0848f5
        fi
Packit 0848f5
	if [ -s unusederr.txt ] ; then
Packit 0848f5
	    warn "There are unused error message texts in src/mpi/errhan/errnames.txt"
Packit 0848f5
	    warn "See the file unusederr.txt for the complete list"
Packit 0848f5
        fi
Packit 0848f5
        if [ -s .tmp -a "$update_errdefs" = "yes" ] ; then
Packit 0848f5
            mv .tmp src/mpi/errhan/defmsg.h
Packit 0848f5
        fi
Packit 0848f5
        if [ ! -s src/mpi/errhan/defmsg.h ] ; then
Packit 0848f5
            echo_n "Creating a dummy defmsg.h file... "
Packit 0848f5
	    cat > src/mpi/errhan/defmsg.h <
Packit 0848f5
typedef struct { const unsigned int sentinal1; const char *short_name, *long_name; const unsigned int sentinal2; } msgpair;
Packit 0848f5
static const int generic_msgs_len = 0;
Packit 0848f5
static msgpair generic_err_msgs[] = { {0xacebad03, 0, "no error catalog", 0xcb0bfa11}, };
Packit 0848f5
static const int specific_msgs_len = 0;
Packit 0848f5
static msgpair specific_err_msgs[] = {  {0xacebad03,0,0,0xcb0bfa11}, };
Packit 0848f5
#if MPICH_ERROR_MSG_LEVEL > MPICH_ERROR_MSG_NONE
Packit 0848f5
#define MPIR_MAX_ERROR_CLASS_INDEX 54
Packit 0848f5
static int class_to_index[] = {
Packit 0848f5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Packit 0848f5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Packit 0848f5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Packit 0848f5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Packit 0848f5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Packit 0848f5
0, 0, 0, 0 };
Packit 0848f5
#endif
Packit 0848f5
EOF
Packit 0848f5
	    echo "done"
Packit 0848f5
        fi
Packit 0848f5
    fi
Packit 0848f5
fi  # do_geterrmsgs
Packit 0848f5
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Build required scripts
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
echo
Packit 0848f5
echo "------------------------------------"
Packit 0848f5
echo "Initiating building required scripts"
Packit 0848f5
# Build scripts such as genstates if necessary
Packit 0848f5
ran_maint_configure=no
Packit 0848f5
run_configure=no
Packit 0848f5
# The information that autoconf uses is saved in the autom4te*.cache
Packit 0848f5
# file; since this cache is not accurate, we delete it.
Packit 0848f5
if [ ! -x maint/configure ] ; then
Packit 0848f5
    (cd maint && $autoconf && rm -rf autom4te*.cache )
Packit 0848f5
elif find maint -name 'configure.ac' -newer 'maint/configure' >/dev/null 2>&1 ; then
Packit 0848f5
    # The above relies on the Unix find command
Packit 0848f5
    (cd maint && $autoconf && rm -rf autom4te*.cache)
Packit 0848f5
fi
Packit 0848f5
if [ ! -x maint/genstates ] ; then
Packit 0848f5
    run_configure=yes
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
# The following relies on the Unix find command
Packit 0848f5
if [ -s maint/genstates ] ; then 
Packit 0848f5
    if find maint -name 'genstates.in' -newer 'maint/genstates' >/dev/null 2>&1 ; then
Packit 0848f5
        run_configure=yes
Packit 0848f5
    fi
Packit 0848f5
else
Packit 0848f5
    run_configure=yes
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
if [ "$run_configure" = "yes" ] ; then
Packit 0848f5
    (cd maint && ./configure)
Packit 0848f5
    ran_maint_configure=yes
Packit 0848f5
fi
Packit 0848f5
echo "Done building required scripts"
Packit 0848f5
echo "------------------------------------"
Packit 0848f5
echo
Packit 0848f5
Packit 0848f5
# Run some of the simple codes
Packit 0848f5
echo_n "Creating the enumeration of logging states into src/include/mpiallstates.h... "
Packit 0848f5
if [ -x maint/extractstates -a $do_genstates = "yes" ] ; then
Packit 0848f5
    ./maint/extractstates
Packit 0848f5
fi
Packit 0848f5
echo "done"
Packit 0848f5
Packit 0848f5
# new parameter code
Packit 0848f5
echo_n "Extracting control variables (cvar) ... "
Packit 0848f5
if test -x maint/extractcvars -a "$do_getcvars" = "yes" ; then
Packit 0848f5
    if ./maint/extractcvars --dirs="`cat maint/cvardirs`"; then
Packit 0848f5
        echo "done"
Packit 0848f5
    else
Packit 0848f5
        echo "failed"
Packit 0848f5
        error "unable to extract control variables"
Packit 0848f5
        exit 1
Packit 0848f5
    fi
Packit 0848f5
else
Packit 0848f5
    echo "skipped"
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
# Create and/or update the f90 tests
Packit 0848f5
if [ -x ./maint/f77tof90 -a $do_f77tof90 = "yes" ] ; then
Packit 0848f5
    echo_n "Create or update the Fortran 90 tests derived from the Fortran 77 tests... "
Packit 0848f5
    for dir in test/mpi/f77/* ; do
Packit 0848f5
        if [ ! -d $dir ] ; then continue ; fi
Packit 0848f5
	leafDir=`basename $dir`
Packit 0848f5
        if [ ! -d test/mpi/f90/$leafDir ] ; then
Packit 0848f5
	    mkdir test/mpi/f90/$leafDir
Packit 0848f5
        fi
Packit 0848f5
        if maint/f77tof90 $dir test/mpi/f90/$leafDir Makefile.am Makefile.ap ; then
Packit 0848f5
            echo "timestamp" > test/mpi/f90/$leafDir/Makefile.am-stamp
Packit 0848f5
        else
Packit 0848f5
            echo "failed"
Packit 0848f5
            error "maint/f77tof90 $dir failed!"
Packit 0848f5
            exit 1
Packit 0848f5
        fi
Packit 0848f5
    done
Packit 0848f5
    for dir in test/mpi/errors/f77/* ; do
Packit 0848f5
        if [ ! -d $dir ] ; then continue ; fi
Packit 0848f5
	leafDir=`basename $dir`
Packit 0848f5
        if [ ! -d test/mpi/errors/f90/$leafDir ] ; then
Packit 0848f5
	    mkdir test/mpi/errors/f90/$leafDir
Packit 0848f5
        fi
Packit 0848f5
        if maint/f77tof90 $dir test/mpi/errors/f90/$leafDir Makefile.am Makefile.ap ; then
Packit 0848f5
            echo "timestamp" > test/mpi/errors/f90/$leafDir/Makefile.am-stamp
Packit 0848f5
        else
Packit 0848f5
            echo "failed"
Packit 0848f5
            error "maint/f77tof90 $dir failed!"
Packit 0848f5
            exit 1
Packit 0848f5
        fi
Packit 0848f5
    done
Packit 0848f5
    echo "done"
Packit 0848f5
fi
Packit 0848f5
Packit 0848f5
echo
Packit 0848f5
echo
Packit 0848f5
echo "###########################################################"
Packit 0848f5
echo "## Generating configure files"
Packit 0848f5
echo "###########################################################"
Packit 0848f5
echo
Packit 0848f5
Packit 0848f5
########################################################################
Packit 0848f5
## Running autotools on non-simplemake directories
Packit 0848f5
########################################################################
Packit 0848f5
Packit 0848f5
if [ "$do_build_configure" = "yes" ] ; then
Packit 0848f5
    for external in $externals ; do
Packit 0848f5
       if [ -d "$external" -o -L "$external" ] ; then
Packit 0848f5
           echo "------------------------------------------------------------------------"
Packit 0848f5
           echo "running third-party initialization in $external"
Packit 0848f5
           (cd $external && ./autogen.sh) || exit 1
Packit 0848f5
       fi
Packit 0848f5
    done
Packit 0848f5
Packit 0848f5
    for amdir in $amdirs ; do
Packit 0848f5
	if [ -d "$amdir" -o -L "$amdir" ] ; then
Packit 0848f5
	    echo "------------------------------------------------------------------------"
Packit 0848f5
	    echo "running $autoreconf in $amdir"
Packit 0848f5
            (cd $amdir && $autoreconf $autoreconf_args) || exit 1
Packit 0848f5
            # Patching libtool.m4
Packit 0848f5
            # This works with libtool versions 2.4 - 2.4.2.
Packit 0848f5
            # Older versions are not supported to build mpich.
Packit 0848f5
            # Newer versions should have this patch already included.
Packit 0848f5
            if [ -f $amdir/confdb/libtool.m4 ] ; then
Packit 0848f5
                # There is no need to patch if we're not going to use Fortran.
Packit 0848f5
                ifort_patch_requires_rebuild=no
Packit 0848f5
                if [ $do_bindings = "yes" ] ; then
Packit 0848f5
                    echo_n "Patching libtool.m4 for compatibility with ifort on OSX... "
Packit 0848f5
                    patch -N -s -l $amdir/confdb/libtool.m4 maint/darwin-ifort.patch
Packit 0848f5
                    if [ $? -eq 0 ] ; then
Packit 0848f5
                        ifort_patch_requires_rebuild=yes
Packit 0848f5
                        # Remove possible leftovers, which don't imply a failure
Packit 0848f5
                        rm -f $amdir/confdb/libtool.m4.orig
Packit 0848f5
                        echo "done"
Packit 0848f5
                    else
Packit 0848f5
                        echo "failed"
Packit 0848f5
                    fi
Packit 0848f5
                fi
Packit 0848f5
Packit 0848f5
                if [ $ifort_patch_requires_rebuild = "yes" ] ; then
Packit 0848f5
                    # Rebuild configure
Packit 0848f5
                    (cd $amdir && $autoconf -f) || exit 1
Packit 0848f5
                    # Reset libtool.m4 timestamps to avoid confusing make
Packit 0848f5
                    touch -r $amdir/confdb/ltversion.m4 $amdir/confdb/libtool.m4
Packit 0848f5
                fi
Packit 0848f5
            fi
Packit 0848f5
	fi
Packit 0848f5
    done
Packit 0848f5
fi