#! /bin/sh # # This is a script to install mpi. It can be called from the top-level # Makefile or directly. Note that this script needs to be built by configure. # # As the install takes place, it keeps a list of files that were installed # in a form that allows their easy removal # # Bug: If there is an error before the install is finished, the mpiuninstall # file will not contain the directories to remove. # Possible fix: add a routine that appends these to the uninstall file # that can be called before any exit # # *CHANGE* # In previous versions, files were not overwritten. This caused mysterious # problems for users that did a reinstall over a damaged or incorrect # installation (for example, installing a correction produced by a patch). # The previous behavior is available with the -noreplace option # *CHANGE* # We now build the libraries in lib and the binaries in bin. # Installation into architecture-specific directories is done by this script, # not by the original build. # *CHANGE IN PROGRESS* # Changing the various "FixupFile" proceedures to work with the configured # versions, looking for specific directory assignment statements such as # prefix=... and includedir=... (config.status does something similar). # This requires changing the affected scripts to follow a standard format; # see mpif90.in for an example CPP_DIR=@CPP_DIR@ buildcpp=@buildcpp@ CPP_COMPILER="@CPP_COMPILER@" ARCH=@ARCH@ COMM=@COMM@ PREFIX=@PREFIX@ prefix=@prefix@ DEVICE=@DEVICE@ CPRP="@CPRP@" MAKE="@MAKE@" RSHCOMMAND="@RSHCOMMAND@" NOMPE=@NOMPE@ SHAREDLIB_LOCALDIR=@SHAREDLIB_LOCALDIR@ MPIR_HOME=@MPIR_HOME@ # EXEEXT is the extension for executable (binary) programs. Typically # null for Unix, .exe for DOS/Windows. EXEEXT=@EXEEXT@ # # Default paths (set at configure time) exec_prefix=@exec_prefix@ bindir=@bindir@ sbindir=@sbindir@ includedir=@includedir@ sysconfdir=@sysconfdir@ libdir=@libdir@ sharedlib_dir=@sharedlib_dir@ messagecat_dir=@messagecat_dir@ mandir=@mandir@ htmldir=@htmldir@ datadir=@datadir@ docdir=@docdir@ # Location of sources top_srcdir=@top_srcdir@ # includebuild_dir=@includebuild_dir@ binbuild_dir=@binbuild_dir@ libbuild_dir=@libbuild_dir@ # File access mode. Does not include group write. MODE=0644 XMODE=0755 replace=1 # Propagate install arguments to mpe install mpeargs="" # If we're doing -libonly, we may want a different file.... # # dirlist is used to uninstall empty directories at the end dirlist="" # inlib=0 # errs=0 # # set failmode to soft to let failures accumulate failmode="hard" # chmod can fail for various reasons. Let it? chmodfailmode="hard" Show=eval # set verbose to 0 to suppress success output verbose=0 just_testing=0 for arg in "$@" ; do case "$arg" in -echo) set -x ;; -mode=*) MODE=`echo $arg | sed -e 's/-mode=//g'` ;; -xmode=*)XMODE=`echo $arg | sed -e 's/-xmode=//g'` ;; -prefix=*) # make install passes the prefix. If the old and # new prefix are the same, don't set the override # switch incase mandir etc. were set on the configure # line (it uses the PREFIX, not prefix, value) prefix=`echo $arg | sed -e 's/-prefix=//g'` if [ "$prefix" != "$PREFIX" ] ; then prefix_override=1 fi ;; -aprefix=*)APREFIX=`echo $arg | sed -e 's/-aprefix=//g'` arg="" ;; # aprefix not valid for mpeargs -shliblocal=*) SHAREDLIB_LOCALDIR=`echo A$arg | sed -e 's/A-shliblocal=//g'` arg="" ;; # shliblocal not valid for mpeargs -noreplace|-no_replace) replace=0 ;; -replace) replace=1 ;; -noman) noman=1 ;; -device=*) DEVICE=`echo A$arg | sed -e 's/A-device=//g'` COMM=$DEVICE arg="" ;; # device not valid for mpeargs -manpath=*)mandir=`echo $arg | sed -e 's/-manpath=//g'` mandir_override=1 arg="" ;; # manpath not valid for mpeargs -libonly) libonly=1 arg="" ;; # libonly not valid for mpeargs # -inlib is a private option -inlib) inlib=1 arg="" ;; # inlib not valid for mpeargs #-arch=*) ARCH=`echo A$arg | sed -e 's/A-arch=//g'` ;; -no_verbose|-noverbose) verbose=0 ;; -verbose) verbose=1 ;; -soft) failmode="soft" ; chmodfailmode="soft" ;; -hard) failmode="hard" ; chmodfailmode="hard" ;; -softchmod) chmodfailmode="soft" ;; -t) Show=echo just_testing=1 failmode="soft" ;; -help|-u|-usage|-h) cat <>> $1 is a directory; not copied <<<" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit 1 ; fi elif [ ! -f $1 ] ; then echo "**File $1 does not exist (or is not a regular file)!" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit 1 ; fi else if [ $verbose = 1 ] ; then echo "Copying $1 to $dest" ; fi # We don't delete the file in the event that we are copying the # file over itself (we SHOULD check for that separately, by checking # that directories are distinct) #if [ -f $dest ] ; then $Show rm -f $dest ; fi $Show $CP $1 $dest rc=$? if [ $rc != 0 ] ; then echo "**Error copying file $1 to $dest **" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi else echo "rm -f $dest" >> $UNINSTALLFILE fi $Show chmod $mode $dest rc=$? if [ $rc != 0 ] ; then echo "**Error setting mode on file $dest**" errs=`expr $errs + 1` if [ $chmodefailmode = "hard" ] ; then exit $rc ; fi fi fi } # # A version of copy file that preserves file dates CopyFileP() { CP="$CPRP -p" CopyFile $1 $2 $3 CP=cp } # # Make the given directory. This handles building intermediate directories # as required, and maintains a list of created directories in dirlist. MkDir() { if [ ! -d $DESTDIR$1 ] ; then dir_to_make=`echo $DESTDIR$1 | sed 's%/% /%g'` path_to_date='' for path in $dir_to_make ; do path_to_date="$path_to_date$path" if [ ! -d $path_to_date ] ; then if [ $verbose = 1 ] ; then echo "Creating directory $1" ; fi $Show "mkdir $path_to_date" rc=$? if [ $rc != 0 ] ; then echo "**Error making directory $1**" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi echo "Failed to create directory $path_to_date" exit 1 else # Note that we store in inverse order dirlist="$1 $dirlist" fi $Show chmod $XMODE $path_to_date rc=$? if [ $rc != 0 ] ; then echo "**Error setting mode on directory $path_to_date**" errs=`expr $errs + 1` if [ $chmodfailmode = "hard" ] ; then exit $rc ; fi fi fi done fi } # # Fixup files that need #...# replaced # Only mpireconfig and ch4p_servs. chp4_servs should be replaced with a # perl program. mpireconfig can use FixupFile2 . # FixupFile() { dest=$DESTDIR$2 if [ -d $dest ] ; then dest=$dest/`basename $1` else dest=$dest fi if [ $replace = 0 -a -f $dest ] ; then if [ $verbose = 1 ] ; then echo "$dest exists; not changed" ; fi elif [ -d $1 ] ; then echo "$1 is a directory; not copied" else if [ -f $dest ] ; then $Show rm -f $dest ; fi if [ $just_testing = 0 ] ; then sed \ -e "s%\#datadir\#%$datadir%g" \ -e "s%\#DEFAULT_ARCH\#%$ARCH%g" \ -e "s%\#MPIR_HOME\#%$prefix%g" \ -e "s%\#PREFIX\#%$prefix%g" \ -e "s%\#RSHCOMMAND\#%$RSHCOMMAND%g" \ -e "s%\#top_srcdir\#%@top_srcdir@%g" \ -e "s%\#bindir\#%@bindir@%g" \ -e "s%\#binbuild_dir\#%@bindir@%g" \ $1 > $dest rc=$? if [ $rc != 0 ] ; then echo "**Error fixing up file $dest**" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi else echo "rm -f $dest" >> $UNINSTALLFILE fi else if [ $verbose = 1 ] ; then echo "Fixup $1.in and copy to $dest" ; fi fi fi if [ -z "$3" ] ; then mode=$MODE else mode=$3 fi $Show chmod $mode $dest rc=$? if [ $rc != 0 ] ; then echo "**Error setting mode on file $2**" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi fi } # # This version merely replaces builddir versions with the master versions # FixupFile2() { dest=$DESTDIR$2 if [ -d $dest ] ; then dest=$dest/`basename $1` else dest=$dest fi if [ $replace = 0 -a -f $dest ] ; then if [ $verbose = 1 ] ; then echo "$dest exists; not changed" ; fi elif [ -d $1 ] ; then echo "$1 is a directory; not copied" else if [ -f $dest ] ; then $Show rm -f $dest ; fi if [ $just_testing = 0 ] ; then # The $ forms are for PERL programs sed -e "s%^prefix=.*%prefix=$prefix%g" \ -e "s%^includedir=.*%includedir=$includedir%g" \ -e "s%^mandir=.*%mandir=$mandir%g" \ -e "s%\$bindir=.*;%\$bindir=\"$bindir\";%"g \ -e "s%^bindir=.*%bindir=$bindir%"g \ -e "s%\$datadir=.*;%\$datadir=\"$datadir\";%"g \ -e "s%^datadir=.*%datadir=$datadir%"g \ -e "s%^libdir=.*%libdir=$libdir%g" \ -e "s%^sharedlibdir=.*%sharedlibdir=$sharedlib_dir%g" \ $1 > $dest rc=$? if [ $rc != 0 ] ; then echo "**Error fixing up file $dest**" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi else echo "rm -f $dest" >> $UNINSTALLFILE fi else if [ $verbose = 1 ] ; then echo "Fixup $1 and copy to $dest" ; fi fi fi if [ -z "$3" ] ; then mode=$MODE else mode=$3 fi $Show chmod $mode $dest rc=$? if [ $rc != 0 ] ; then echo "**Error setting mode on file $2**" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi fi } ############################################################################## # # End of routines # ############################################################################## if [ ! -s $libbuild_dir/lib@MPILIBNAME@.a ] ; then echo "You must make MPI before installing it!" echo "Could not find $libbuild_dir/lib@MPILIBNAME@.a !" exit 1 fi if [ ! -n "$prefix" ] ; then echo "Set an installation location with -prefix= ." exit 1 fi if [ $verbose = 1 ] ; then echo "Install into $DESTDIR$prefix on the $ARCH with $DEVICE" fi if [ -d "$DESTDIR$prefix" ] ; then if [ $verbose = 1 ] ; then echo "using existing directory $DESTDIR$prefix" ; fi else MkDir $prefix fi # # These build the default paths to libdir/bindir/includedir. # We need to replace this with code that picks apart the directories. # MkDir $libdir MkDir $sharedlib_dir if [ -n "$SHAREDLIB_LOCALDIR" ] ; then MkDir $SHAREDLIB_LOCALDIR fi MkDir $bindir MkDir $sbindir MkDir $includedir MkDir $datadir MkDir $docdir MkDir $sysconfdir MkDir $prefix/examples if [ -n "$CPP_DIR" -a "$buildcpp" = 1 ] ; then MkDir $prefix/examples/$CPP_DIR MkDir $includedir/mpi2c++ fi # # Remove old uninstall file. We can't do this until we've created the # sbindir directory. if [ -x $UNINSTALLFILE ] ; then if [ -x ${UNINSTALLFILE}.old ] ; then rm -f ${UNINSTALLFILE}.old fi mv $UNINSTALLFILE ${UNINSTALLFILE}.old fi rm -f $UNINSTALLFILE cat > $UNINSTALLFILE <.in (some variations are mapped to different # devices) # ch_p4, execer also use # mpirun.pg.in # This needs to be modified to simply move the needed files, not # all of them. # Install should not execute a make. # See the install_$DEVICE script. # tstmachines is handled as part of the ch_p4 device code (and placed in # sbin) # This step relies on a clean bin build directory # Only mpirun really needs FixupFile2; all others just need copyfile #if [ -x mpid/${DEVICE}/mpirun_setup ] ; then # if [ -x bin/mpirun ] ; then for file in bin/mpirun* ; do bfile=`basename $file` FixupFile2 $file ${bindir}/$bfile $XMODE done fi #echo "rm -f $bindir/mpirun" >> $UNINSTALLFILE if [ ! -x $bindir/tarch ] ; then CopyFile $top_srcdir/bin/tarch $bindir $XMODE fi # $Show rm -f $DESTDIR$bindir/mpireconfig if [ $verbose = 1 ] ; then echo "Creating mpireconfig from util/mpireconfig.in" fi FixupFile $top_srcdir/util/mpireconfig.in $bindir/mpireconfig $XMODE # # Updating the config.status file is trickier, since we need to edit # the directories that might have contained the original path. # It is important to update the CORRECT file, in the case that we are doing # a -libonly installation on a previously constructed version. # if [ $just_testing = 0 ] ; then # Be VERY careful to only change the assignments that begin a line, # since other asignments may be strings (arguments to configure) sed -e 's%$top_srcdir/$file%$file%g' \ -e 's%$top_srcdir/${file}%${file}%g' \ -e "s%^bindir=.*%bindir=$bindir%g" \ -e "s%^includedir=.*%includedir=$includedir%g" \ -e "s%^prefix=.*%prefix=$prefix%g" \ -e "s%^datadir=.*%datadir=$datatid%g" \ -e "s%^MPIR_HOME=.*\$%MPIR_HOME='$prefix'%g" \ -e "s%^LIB_PATH=\([^/ ]*\)/[^ ']*%LIB_PATH=\1$libdir%g" \ -e "s%^FINC=\([^/ ]*\)/[^ ']*%FINC=\1$includedir%g" \ -e "s%^FLIB_PATH=\([^/ ]*\)/[^ ']*%FLIB_PATH=\1$libdir%g" \ -e "s%^F90INC=\([^/ ]*\)/[^ ']*%F90INC=\1$includedir%g" \ -e "s%^F90LIB_PATH=\([^/ ]*\)/[^ ']*%F90LIB_PATH=\1$libdir%g" \ -e "s%^MPE_DIR=.*\$%MPE_DIR='$prefix/mpe'%g" \ -e "s%^MPICC=\([^/ ]*\)/.*\$%MPICC=$bindir/mpicc%g" \ -e "s%^MPIF77=\([^/ ]*\)/.*\$%MPIF77=$bindir/mpif77%g" \ -e "s%^MPIF90=\([^/ ]*\)/.*\$%MPIF90=$bindir/mpif90%g" \ -e "s%^MPICPLUSPLUS=\([^/ ]*\)/.*\$%MPICPLUSPLUS=$bindir/mpicxx%g" \ config.status > ${DESTDIR}${bindir}/mpireconfig.dat chmod $XMODE ${DESTDIR}${bindir}/mpireconfig.dat echo "rm -f ${bindir}/mpireconfig.dat" >> $UNINSTALLFILE else echo "Construct new ${bindir}/mpireconfig.dat from config.status" fi #$Show rm -f $bindir/execer #CopyFile $top_srcdir/util/execer $bindir/execer $XMODE # # mpicc, mpif77, mpif90 FixupFile2 bin/mpicc $bindir/mpicc $XMODE if [ -x src/fortran/src/mpif77 -a "@NOF77@" = "0" ] ; then CopyFile src/fortran/src/mpif77 $bindir/mpif77 $XMODE CopyFile src/fortran/src/mpif77.conf $sysconfdir CopyFile $includebuild_dir/mpif.h $includedir fi if [ -x src/fortran/src/mpif90 -a "@NO_F90@" = "0" ] ; then CopyFile src/fortran/src/mpif90 $bindir/mpif90 $XMODE CopyFile src/fortran/src/mpif90.conf $sysconfdir fi # # mpiCC, if C++ selected if [ -n "$CPP_COMPILER" ] ; then # If the file system doesn't preserve case, only use the # mpicxx version. if [ "@CASE_SENSITIVE@" = "yes" ] ; then FixupFile2 bin/mpiCC $bindir/mpiCC $XMODE fi FixupFile2 bin/mpicxx $bindir/mpicxx $XMODE fi # If there is a device install script, use that. We # put this last in case it wants to update any of the scripts or # other files that are installed. This is executed as an included # script so that it has access to the various variables (e.g., # prefix and bindir). If you need to run a program, run it from # within the script # These should use MODE and XMODE if [ -x mpid/$DEVICE/install_$DEVICE ] ; then . mpid/$DEVICE/install_$DEVICE elif [ -x $top_srcdir/mpid/$DEVICE/install_$DEVICE ] ; then . $top_srcdir/mpid/$DEVICE/install_$DEVICE fi else # libonly # # mpirun et al. # Only mpirun really needs FixupFile2; all others just need copyfile if [ -x bin/mpirun ] ; then for file in bin/mpirun* ; do bfile=`basename $file` FixupFile2 $file $bindir/$bfile $XMODE done fi if [ ! -x $bindir/tarch ] ; then CopyFile $binbuild_dir/tarch $bindir/tarch $XMODE fi FixupFile2 bin/mpicc $bindir/mpicc $XMODE if [ -n "$CPP_COMPILER" ] ; then # If the file system doesn't preserve case, only use the # mpicxx version. if [ "@CASE_SENSITIVE@" = "yes" ] ; then FixupFile2 bin/mpiCC $bindir/mpiCC $XMODE fi FixupFile2 bin/mpicxx $bindir/mpicxx $XMODE fi if [ -x "bin/mpichversion.exe" ] ; then CopyFile bin/mpichversion.exe $bindir $XMODE else CopyFile bin/mpichversion $bindir $XMODE fi CopyFile util/mpichlib.conf ${sysconfdir} # Copy the source file for mpichversion to the sysconfdir CopyFile $top_srcdir/util/mpichversion.c ${sysconfdir} FixupFile $top_srcdir/util/mpireconfig.in $bindir/mpireconfig $XMODE # No user include uses mpichconf.h CopyFile $includebuild_dir/mpichconf.h $sysconfdir/mpichconf.h.dat CopyFile $includebuild_dir/mpidefs.h $includedir CopyFile $includebuild_dir/mpi.h $includedir if [ -s $includebuild_dir/mpif.h -a "@NOF77@" = "0" ] ; then CopyFile $includebuild_dir/mpi_fortdefs.h $includedir CopyFile src/fortran/src/mpif77 $bindir/mpif77 $XMODE CopyFile src/fortran/src/mpif77.conf $sysconfdir CopyFile $includebuild_dir/mpif.h $includedir fi if [ -x src/fortran/src/mpif90 -a "@NO_F90@" = "0" ] ; then CopyFile src/fortran/src/mpif90 $bindir/mpif90 $XMODE CopyFile src/fortran/src/mpif90.conf $sysconfdir fi if [ -s romio/include/mpio.h ] ; then CopyFile romio/include/mpio.h $includedir CopyFile romio/include/mpiof.h $includedir fi # Fortran 90 modules if [ -d $includebuild_dir/f90base -a "@NO_F90@" = "0" ] ; then MkDir $includedir/f90base for file in $includebuild_dir/f90base/* ; do CopyFile $file $includedir/f90base done if [ -s $includebuild_dir/f90base/mpimod.pcl ] ; then rm -f $includedir/f90base/mpimod.pcl echo "mpimod.pc" >$includedir/f90base/mpimod.pcl echo "$includedir/f90base/mpimod.pc" >> $includedir/f90base/mpimod.pcl echo "rm -f $includedir/f90base/mpimod.pcl" >> $UNINSTALLFILE fi fi if [ -d $includebuild_dir/f90choice -a "@NO_F90@" = "0" ] ; then MkDir $includedir/f90choice for file in $includebuild_dir/f90choice/* ; do if [ -s $file ] ; then # Just in case the choice directory is empty CopyFile $file $includedir/f90choice fi done if [ -s $includebuild_dir/f90choice/mpimod.pcl ] ; then rm -f $includedir/f90choice/mpimod.pcl echo "mpimod.pc" >$includedir/f90choice/mpimod.pcl echo "$includedir/f90choice/mpimod.pc" >> $includedir/f90choice/mpimod.pcl echo "rm -f $includedir/f90choice/mpimod.pcl" >> $UNINSTALLFILE fi fi fi # # P4 if [ "$DEVICE" = "ch_p4" ] ; then FixupFile2 util/tstmachines $sbindir/tstmachines $XMODE # Installs should not do builds if [ -x mpid/server/serv_p4$EXEEXT ] ; then CopyFile mpid/server/serv_p4$EXEEXT $bindir $XMODE $Show rm -f util/chp4_servs FixupFile $top_srcdir/util/chp4_servs.in $sbindir/chp4_servs $XMODE FixupFile2 util/chkserv $sbindir/chkserv $XMODE else echo "Server not available" fi fi # if [ -z "$libonly" ] ; then # # Machines database # if [ ! -d $prefix/util/machines.anl ] ; then \ # mkdir $prefix/util/machines.anl ; fi # $CPRP -r util/machines $prefix/util/machines.anl for file in util/machines/machines* ; do if [ -s $file ] ; then CopyFile $file $datadir fi done # # Include files CopyFile $includebuild_dir/mpi.h $includedir if [ -s $includebuild_dir/mpif.h -a "@NOF77@" = "0" ] ; then CopyFile $includebuild_dir/mpi_fortdefs.h $includedir fi CopyFile $includebuild_dir/mpi_errno.h $includedir #CopyFile include/protofix.h $includedir #CopyFile include/patchlevel.h $includedir # No user include uses mpichconf.h CopyFile $includebuild_dir/mpichconf.h $sysconfdir/mpichconf.h.dat CopyFile $includebuild_dir/mpidefs.h $includedir # Install ROMIO files if [ -s romio/include/mpio.h ] ; then CopyFile romio/include/mpio.h $includedir CopyFile romio/include/mpiof.h $includedir fi # Fortran 90 modules if [ -d $includebuild_dir/f90base -a "@NO_F90@" = "0" ] ; then MkDir $includedir/f90base for file in $includebuild_dir/f90base/* ; do if [ -s $file ] ; then CopyFile $file $includedir/f90base fi done if [ -s $includebuild_dir/f90base/mpimod.pcl ] ; then rm -f $includedir/f90base/mpimod.pcl echo "mpimod.pc" >$includedir/f90base/mpimod.pcl echo "$includedir/f90base/mpimod.pc" >> $includedir/f90base/mpimod.pcl echo "rm -f $includedir/f90base/mpimod.pcl" >> $UNINSTALLFILE fi fi if [ -d $includebuild_dir/f90choice -a "@NO_F90@" = "0" ] ; then MkDir $includedir/f90choice for file in $includebuild_dir/f90choice/* ; do if [ -s $file ] ; then CopyFile $file $includedir/f90choice fi done if [ -s $includebuild_dir/f90choice/mpimod.pcl ] ; then rm -f $includedir/f90choice/mpimod.pcl echo "mpimod.pc" >$includedir/f90choice/mpimod.pcl echo "$includedir/f90choice/mpimod.pc" >> $includedir/f90choice/mpimod.pcl echo "rm -f $includedir/f90choice/mpimod.pcl" >> $UNINSTALLFILE fi fi fi # # Include files for C++ # (We should eventually use the install target in C++) if [ -n "$CPP_DIR" -a "$buildcpp" = 1 ] ; then if [ ! -d $includedir/mpi2c++ ] ; then MkDir $includedir/mpi2c++ fi # MPI-2-C++/src has the regular files; MPI-2-C++ has the config-dependent # files for file in $top_srcdir/MPI-2-C++/src/mpi2c++/*.h \ MPI-2-C++/src/mpi2c++/mpi2c++_config.h ; do if [ -s $file ] ; then CopyFile $file $includedir/mpi2c++ fi done fi # # Libaries (including shared libraries) # Warning: the -h option for testing for a symbolic link # is not universally recognized. for file in $libbuild_dir/*.a ; do if [ -f $file ] ; then # Be careful of libpmpich.a (may be a link to libmpich.a) if [ "@HAS_WEAK_SYMBOLS@" = 0 ] ; then CopyFileP $file $libdir elif [ ! -h $file ] ; then CopyFileP $file $libdir # else we'll need to make a link... (see below) fi fi done # Copy the Message Queue dynamic link library if it exists. Handle the # shared library versioning. This is the same as the step that installs # the shared libraries # # Problem: Installation sometimes builds libtvmpich.so and libtvmpich.so.1.0 # as files, causing problems when installing. # for file in $libbuild_dir/libtvmpich.so* ; do # Also need to handle any links! if [ ! -h $file -a -f $file ] ; then CopyFileP $file $libdir $XMODE fi done # Get the current directory (see pushd/popd comments in shared lib code) curdir="`pwd`" # Create links from foo.so.n.m to foo.so.n and foo.so.n to foo.so for file in $DESTDIR$libdir/libtvmpich.so* ; do # pushd would be cleaner, but not all systems support it (e.g.,IRIX) #pushd $sharedlib_dir >/dev/null cd $DESTDIR$libdir >/dev/null file=`basename $file` filebase=`echo $file | sed -e 's%\.[0-9]*$%%'` while [ $filebase != $file ]; do if [ ! -h $filebase -a -s $file ] ; then $Show ln -sf $file $filebase # We need to debug this. If there is an error, generate # some information on the failure if [ $? != 0 ] ; then echo "Error in setting link. Files in libdir are:" ls -l $libdir/libtvmpich.* echo "Files in source dir are" ls -l $libbuild_dir/libtvmpich.so* fi echo "rm -f $libdir/$filebase" >>$UNINSTALLFILE fi file=$filebase filebase=`echo $file | sed -e 's%\.[0-9]*$%%'` done cd "$curdir" >/dev/null done # The Fortran wrapper libraries should have been created in libbuild_dir #if [ "@NOF77@" = "0" ] ; then # for file in src/fortran/src/lib*.a ; do # if [ -f $file ] ; then # CopyFileP $file $libdir # fi # done #fi # Copy the shared library versions. Set the permissions to allow execute # access. for file in $libbuild_dir/shared/*.so* ; do # Also need to handle any links! if [ ! -h $file -a -f $file ] ; then CopyFileP $file $sharedlib_dir $XMODE if [ -n "$SHAREDLIB_LOCALDIR" -a \ "$SHAREDLIB_LOCALDIR" != $sharedlib_dir ] ; then CopyFileP $file $SHAREDLIB_LOCALDIR $XMODE fi fi done # Get the current directory (see pushd/popd comments below) curdir=`pwd` # Create links from foo.so.n.m to foo.so.n and foo.so.n to foo.so for file in $DESTDIR$sharedlib_dir/*.so* ; do # pushd would be cleaner, but not all systems support it (e.g.,IRIX) #pushd $sharedlib_dir >/dev/null cd $DESTDIR$sharedlib_dir >/dev/null file=`basename $file` filebase=`echo $file | sed -e 's%\.[0-9]*$%%'` while [ $filebase != $file ]; do if [ ! -h $filebase -a -s $file ] ; then $Show ln -sf $file $filebase echo "rm -f $sharedlib_dir/$filebase" >>$UNINSTALLFILE fi file=$filebase filebase=`echo $file | sed -e 's%\.[0-9]*$%%'` done # popd is not universal #popd >/dev/null cd $curdir >/dev/null done # # Handle the case of a weak-symbol profiling library if [ ! -s $DESTDIR$libdir/libp@MPILIBNAME@.a ] ; then (cd $DESTDIR$libdir ; ln -s lib@MPILIBNAME@.a libp@MPILIBNAME@.a ) echo "rm -f $libdir/libp@MPILIBNAME@.a" >> $UNINSTALLFILE fi # Message queue routine for debuggers must be built with the proper prefix. # This is a mess; it really should be configured and built like that from the # start. if [ -n "@SHAREDKIND_FOR_TV@" -a "@SHAREDKIND_FOR_TV@" != "ignore" -a \ "$prefix" != "@PREFIX@" ] ; then echo "You must set the prefix when you configure to get the message queues" echo "Reconfigure and remake MPICH to get working message queue routines" fi # # Special programs (helper executables) # So far we have # spxcp - Executable copy program for IBM SP. for file in spxcp ; do if [ -x bin/$file ] ; then CopyFileP bin/$file $bindir fi done # # Message files if [ -z "$libonly" ] ; then # Note that we need to get the mpich.*.m files for IRIX which has # a message file directory as well as the message file. for file in $libbuild_dir/mpich.* ; do if [ $file = "mpich.cat" ] ; then # This is a link; it assumes that En_US is the default. if [ -f $messagecat_dir/mpich.En_US.cat ] ; then $Show ln -s $messagecat_dir/mpich.En_US.cat \ $messagecat_dir/mpich.cat echo "rm -f $messagecat_dir/mpich.cat" >>$UNINSTALLFILE fi elif [ -s $file ] ; then # This will handle the case of no mpich.* matches CopyFile $file $messagecat_dir fi done fi # Other files in lib need to be updated... CopyFile $includebuild_dir/mpidefs.h $includedir # # Documentation if [ -z "$noman" -a -z "$libonly" ] ; then # Add a note that we're installing the documentation because it # is a large number of files and can take significant time. echo "Installing documentation ... " if [ -z "$mandir" ] ; then mandir=$prefix/man fi MkDir $mandir CopyFile $top_srcdir/man/mandesc $mandir # No files in man5 (was ADI routines) for dir1 in man1 man3 man4 ; do MkDir $mandir/$dir1 for file in $top_srcdir/man/$dir1/* ; do # man5 in particular might be empty; be careful if [ -f "$file" -a -s "$file" ] ; then CopyFile $file $mandir/$dir1 fi done done # do the Romio man pages, only man3 for file in $top_srcdir/romio/man/man3/* ; do if [ -f "$file" -a -s "$file" ] ; then CopyFile $file $mandir/man3 fi done # HTML pages if [ -z "$htmldir" ] ; then htmldir=$prefix/www fi MkDir $htmldir if [ -s $top_srcdir/www/index.html ] ; then # Some development versions don't include the www directories # Be careful of the top-level directory. Some users may # pick a top-level (e.g., /usr/doc/www) directory, and we # do not want to replace index.html in that directory. # This is a little more awkward for people who install # into a separate directory, but it is more important not # to overwrite a general index.html file CopyFile $top_srcdir/www/index.html $htmldir/mpich.html # No files in www5 (was ADI routines) for dir1 in www1 www3 www4 ; do MkDir $htmldir/$dir1 for file in $top_srcdir/www/$dir1/* ; do # www5 in particular might be empty; be careful if [ -f "$file" -a -s "$file" ] ; then CopyFile $file $htmldir/$dir1 fi done done fi echo "Done installing documentation" fi if [ -z "$libonly" ] ; then echo "Installing manuals" for file in $top_srcdir/doc/mpichman*.ps.gz \ $top_srcdir/doc/mpeman*.ps.gz \ $top_srcdir/doc/mpichman*.pdf \ $top_srcdir/doc/mpeman*.pdf \ $top_srcdir/doc/mpiman.ps ; do if [ -f $file ] ; then CopyFile $file $docdir fi done if [ -f $top_srcdir/romio/doc/users-guide.ps.gz ] ; then CopyFile $top_srcdir/romio/doc/users-guide.ps.gz $docdir/romio-users.ps.gz fi #$Show $CPRP -r doc $prefix #if [ -f ref/adiman.ps.gz ] ; then # CopyFile ref/adiman.ps.gz $prefix/doc #fi if [ -f $top_srcdir/ref/mpiman.ps.gz ] ; then CopyFile $top_srcdir/ref/mpiman.ps.gz $docdir fi echo "Done installing manuals" fi # if [ "$NOMPE" = "0" ] ; then if [ ! -x mpe/sbin/mpeinstall ] ; then echo "** mpeinstall script is not available in mpe/sbin!" echo "** MPE will not be installed" else echo "Installing MPE" # mpeargs should be the same for the most part as mpi args. # see command line processing. mpeargs="$mpeargs -uninstall=$UNINSTALLFILE" ( cd mpe ; ./sbin/mpeinstall $mpeargs -mode=$MODE -xmode=$XMODE ) fi fi # # If we used SYSV semaphores or ipcs, we should copy cleanipcs into sbin. CopyFile $top_srcdir/util/cleanipcs $sbindir $XMODE # # Example programs CopyFile $top_srcdir/installtest/Makefile.in $prefix/examples # # This SHOULD use mpireconfig... Savevar=$prefix # Configure (version 1) has the *FEATURE* of replacing prefix=xxxx with # prefix=@prefix@ when ever prefix= starts in the first column (!) # It also does this with exec_prefix (!!) prefix=$APREFIX (cd $DESTDIR$prefix/examples ; $DESTDIR$bindir/mpireconfig Makefile ) echo "(cd $prefix/examples ; $MAKE clean)" >> $UNINSTALLFILE echo "rm -f $prefix/examples/Makefile" >> $UNINSTALLFILE prefix=$Savevar CopyFile $DESTDIR$prefix/examples/Makefile $datadir/Makefile.sample CopyFile $top_srcdir/installtest/cpi.c $prefix/examples CopyFile $top_srcdir/installtest/cpip.c $prefix/examples CopyFile $top_srcdir/installtest/cpilog.c $prefix/examples CopyFile $top_srcdir/installtest/hello++.cc $prefix/examples if [ "@NOF77@" = "0" ] ; then CopyFile $top_srcdir/installtest/pi3.f $prefix/examples CopyFile $top_srcdir/installtest/pi3p.f $prefix/examples if [ "@NO_F90@" = "0" ] ; then CopyFile $top_srcdir/installtest/pi3f90.f90 $prefix/examples fi fi if [ -s $top_srcdir/romio/test/simple.c ] ; then CopyFile $top_srcdir/romio/test/simple.c $prefix/examples/simpleio.c fi CopyFile $top_srcdir/installtest/README $prefix/examples # # Test build the examples $Show "(cd $DESTDIR$prefix/examples ; rm -f mpirun ; \ ln -s ../bin/mpirun mpirun )" echo "rm -f $prefix/examples/mpirun" >> $UNINSTALLFILE # echo "About to run installation test..." if [ "x$DESTDIR" = "x" ]; then # only works when DESTDIR is blank, and installing on final location. $Show "(cd $DESTDIR$prefix/examples; $MAKE all ; $MAKE clean )" if [ @SHAREDKIND@ != "ignore" ] ; then echo "About to run installation test for shared libraries ..." $Show "(cd $DESTDIR$prefix/examples; MPICH_USE_SHLIB="yes"; export MPICH_USE_SHLIB; $MAKE all ; $MAKE clean )" fi fi # # This SHOULD use mpireconfig... Savevar=$prefix if [ -n "$CPP_DIR" -a "$buildcpp" = 1 ] ; then # Removed the installation of these extra examples. # C++ Example programs # CopyFile $top_srcdir/installtest/mpi-2-c++/Makefile.in $prefix/examples/$CPP_DIR # prefix=$APREFIX # CPPEXDIR=$top_srcdir/$CPP_DIR/contrib/examples # # This isn't correct because it doesn't handle all of the fields in # # the C++ examples Makefile, particularly the TEMPLATE_REP field # # The intent here is to update the directories; but we also need # # to update a few additional fields # (cd $prefix/examples/$CPP_DIR ; $bindir/mpireconfig Makefile ) # echo "(cd $prefix/examples/$CPP_DIR ; $MAKE clean)" >> $UNINSTALLFILE # echo "rm -f $prefix/examples/$CPP_DIR/Makefile" >> $UNINSTALLFILE # prefix=$Savevar # CopyFile $CPPEXDIR/hello_world.cc $prefix/examples/$CPP_DIR # CopyFile $CPPEXDIR/ring.cc $prefix/examples/$CPP_DIR # CopyFile $CPPEXDIR/topology.cc $prefix/examples/$CPP_DIR # CopyFile $CPPEXDIR/user_bcast.cc $prefix/examples/$CPP_DIR # CopyFile $CPPEXDIR/chapter_10_mpi2.cc $prefix/examples/$CPP_DIR # CopyFile $CPPEXDIR/pi.cc $prefix/examples/$CPP_DIR # CopyFile $CPPEXDIR/README $prefix/examples/$CPP_DIR # # # # Test build the C++ examples # $Show "(cd $prefix/examples/$CPP_DIR ; rm -f mpirun ; \ # ln -s ../../bin/mpirun mpirun )" # echo "rm -f $prefix/examples/$CPP_DIR/mpirun" >> $UNINSTALLFILE # # # echo "About to run C++ installation test..." # $Show "(cd $prefix/examples/$CPP_DIR; $MAKE ; $MAKE clean)" # # A temporary fix because C++ clean doesn't remove any template # # directories. This will eventually need to be changed into a for loop # # (even better, the clean target in the Makefile should be fixed) # if [ -d $prefix/examples/$CPP_DIR/ii_files ] ; then # $Show rm -rf $prefix/examples/$CPP_DIR/ii_files # fi # fi # echo "rm -f $UNINSTALLFILE" >> $UNINSTALLFILE # Add the directory removes to the UNINSTALL file for dir in $dirlist ; do echo "if [ -d $dir ] ; then rmdir $dir ; fi" >> $UNINSTALLFILE done # echo installed MPICH in $prefix echo $UNINSTALLFILE may be used to remove the installation. # if [ $errs -gt 0 ] ; then rc=1 else rc=0 fi exit $rc