#! /bin/sh # # $Id: autogen.sh,v 1.23 2004/03/13 22:34:05 jsquyres Exp $ # # This script is run on developer copies of LAM/MPI -- *not* # distribution tarballs. : ${ACLOCAL=aclocal} : ${AUTOCONF=autoconf} : ${AUTOMAKE=automake} : ${LIBTOOL=libtool} : ${LIBTOOLIZE=libtoolize} : ${AUTOHEADER=autoheader} # # Some helper functions # # # Subroutine to check for the existence of various standard GNU tools # test_for_existence() { tfe_prog="$1" tfe_foo="`$tfe_prog --version`" if test "$?" != 0; then cat < Errr... there's no configure.in or configure.ac file!" fi if test -n "$fad_cfile"; then auxdir="`grep AC_CONFIG_AUX_DIR $fad_cfile | cut -d\( -f 2 | cut -d\) -f 1`" fi if test -f "$auxdir/$fad_file"; then rm -f "$auxdir/$fad_file" fi unset fad_cfile fi unset fad_file } # # Subroutine to actually do the GNU tool setup in the proper order, etc. # run_gnu_tools() { rgt_dir="$1" rgt_lam_topdir="$2" rgt_cur_dir="`pwd`" if test -d "$rgt_dir"; then cd "$rgt_dir" # See if the package doesn't want us to set it up if test -f .lam_no_gnu; then cat < Found configure.params. Running make_configure.pl" "$rgt_lam_topdir/config/make_configure.pl" \ --lamdir "$rgt_lam_topdir" \ --moduledir "`pwd`" happy=1 file=configure.ac elif test -f configure.in; then happy=1 file=configure.in elif test -f configure.ac; then happy=1 file=configure.ac else echo "---> Err... there's no configure.in or configure.ac file in this directory" echo "---> I'm confused, so I'm going to abort" exit 1 fi unset happy # Find and delete the GNU helper script files find_and_delete config.guess find_and_delete config.sub find_and_delete depcomp find_and_delete install-sh find_and_delete ltconfig find_and_delete ltmain.sh find_and_delete missing find_and_delete mkinstalldirs find_and_delete libtool # Run the GNU tools run_and_check $ACLOCAL # Patch aclocal.m4 for portland compilers echo " -- patching for Portland compilers" if test -z "`grep pgcc aclocal.m4`"; then patch -p0 < "$rgt_lam_topdir/config/patches/libtool-pgi-1.5.14.patch" if test "$?" != "0"; then echo "Patch badness! Exiting!" fi if test -f aclocal.m4.orig; then rm -f aclocal.m4.orig fi if test -f aclocal.m4.rej; then rm -f aclocal.m4.rej fi else echo " ==> your aclocal doesn't need this! yay!" fi # Prior to libtool 1.5.15a, we need more portland fixes. # Some shortcuts here -- we know that a tarball will never # be released with LT < 1.5.14, so only check for that one # bad version. echo " -- second patch for PGI support in Libtool 1.5.14" if test "`$LIBTOOLIZE --version | head -n 1 | cut -d\ -f 4`" = "1.5.14"; then patch -p0 < "$rgt_lam_topdir/config/patches/libtool-pgi-1.5.14.patch" if test "$?" != "0"; then echo "Patch badness! Exiting!" fi if test -f aclocal.m4.orig; then rm -f aclocal.m4.orig fi if test -f aclocal.m4.rej; then rm -f aclocal.m4.rej fi else echo " ==> your aclocal doesn't need this! yay!" fi if test "`grep AC_CONFIG_HEADER $file`" != "" -o \ "`grep AM_CONFIG_HEADER $file`" != ""; then run_and_check $AUTOHEADER fi run_and_check $AUTOCONF # We only need the libltdl stuff for the top-level # configure, not any of the SSI modules. if test -d share; then rm -rf libltdl share/libltdl share/include/lam_ltdl.h run_and_check $LIBTOOLIZE --automake --copy --ltdl mv libltdl share echo "Adjusting libltdl for LAM :-(" cd share/include echo " -- adding sym link for share/include/lam_ltdl.h" ln -s ../libltdl/ltdl.h lam_ltdl.h echo " -- patching for argz bugfix in libtool 1.5" cd ../libltdl if test "`grep 'while ((before >= *pargz) && (before[-1] != LT_EOS_CHAR))' ltdl.c`" != ""; then patch -p0 < "$rgt_lam_topdir/config/patches/libtool-argz-1.5.10.patch" if test "$?" != "0"; then echo "Patch badness! Exiting!" fi if test -f ltdl.c.orig; then rm -f ltdl.c.orig; fi if test -f ltdl.c.rej; then rm -f ltdl.c.rej; fi else echo " ==> your libtool doesn't need this! yay!" fi cd ../.. echo " -- patching configure for broken -c/-o compiler test" sed -e 's/chmod -w \./#LAM\/MPI FIX: chmod -w ./' \ configure > configure.new mv configure.new configure chmod a+x configure else run_and_check $LIBTOOLIZE --automake --copy fi run_and_check $AUTOMAKE --foreign -a --copy --include-deps fi # Go back to the original directory cd "$rgt_cur_dir" fi unset rgt_dir rgt_cur_dir } # # Subroutine to run in just one directory # run_local() { run_gnu_tools . "../../../.." } # # Subroutine to run across the entire LAM tree # run_global() { rg_cwd="`pwd`" # Run the config in the top-level directory run_gnu_tools . "." # Now run the config in every directory in share/ssi/*/* that has # a configure.in or configure.ac script for kind in share/ssi/*; do if test -d "$kind"; then for module in "$kind"/*; do if test -d "$module"; then if test -f "$module/configure.in" -o \ -f "$module/configure.params" -o \ -f "$module/configure.ac"; then run_gnu_tools "$module" "$rg_cwd" fi fi done fi done unset kind module # Run autogen.sh in share/totalview run_gnu_tools share/totalview "$rg_cwd" } ########################################################################## # Main ########################################################################## # Check the command line to see if we should run the whole shebang, or # just in this current directory. want_local=0 for arg in $*; do case $arg in -l) want_local=1 ;; *) ;; esac done # Are we in the right directory? We must be in the top-level LAM # directory. if test "$want_local" = "0"; then if test -f VERSION -a -f configure.in -a -f share/mpi/init.c ; then bad=0 else cat <