#! /bin/sh # # (C) 2006 by Argonne National Laboratory. # See COPYRIGHT in top-level directory. # # Update all of the derived files # For best performance, execute this in the top-level directory. # There are some experimental features to allow it to be executed in # subdirectories # # Eventually, we want to allow this script to be executed anywhere in the # mpich tree. This is not yet implemented. error_summary="" acVersion=unknown # finalStatus records whether there have been problems in updatefiles # 1 = warning, 3 = fatal, 2 = reserved for future use, # 0 = no problems detected. finalStatus=0 at_top=no if [ -d maint -a -s maint/f77tof90.in ] ; then at_top=yes fi # # Default choices do_f77tof90=yes do_build_configure=yes do_makefiles=yes # Allow MAKE to be set from the environment MAKE=${MAKE-make} # List of steps that we will consider # (We do not include depend because the values for depend are not just yes/no) AllSteps="f77tof90 build_configure makefiles" stepsCleared=no # Options for some steps autoconfdir="" # Extract the arguments intended for updatefiles. temp_args="" for arg in "$@" ; do case $arg in -echo) set -x ;; -do=*) opt=`echo A$arg | sed -e 's/A-do=//'` # Handle some synonyms case $opt in build-configure|configure) opt=build_configure ;; makefile|Makefile|Makefiles) opt=makefiles;; esac var=do_$opt # Check that this opt is known eval oldval=\$"$var" if [ -z "$oldval" ] ; then echo "-do=$opt is unrecognized" exit 1 else if [ $stepsCleared = no ] ; then for step in $AllSteps ; do var=do_$step eval $var=no done stepsCleared=yes fi var=do_$opt eval $var=yes fi ;; -with-autoconf=*|--with-autoconf=*) # Select a location for a different autoconf autoconfdir=`echo "A$arg" | sed -e 's/.*=//'` ;; -distrib) do_build_configure=no temp_args="$temp_args $arg" ;; -help|--help|-usage|--usage) cat <&1 >/dev/null fi # we require autoconf version 2.67 or greater # acSubversion is the version number minus 2. (we assume autoconf 2.xx) # -1 is used for unknown acSubversion=-1 acIncDirFlag=-I for ver in 70 69 68 67 ; do rm -f .tmp/configure.ac .tmp/configure cat >.tmp/configure.ac </dev/null 2>&1 ) ; then acSubversion=$ver break fi done rm -f .tmp/configure.ac .tmp/configure if [ "$acSubversion" -gt 0 ] ; then acVersion="2.$acSubversion" echo "You have autoconf version $acVersion." else cat </dev/null 2>&1 ; then # The above relies on the Unix find command (cd maint && $autoconf && rm -rf autom4te*.cache) fi if [ ! -x maint/f77tof90 ] ; then run_configure=yes fi # # The following relies on the Unix find command if [ -s maint/f77tof90 ] ; then if find maint -name 'f77tof90.in' -newer 'maint/f77tof90' >/dev/null 2>&1 ; then run_configure=yes fi else run_configure=yes fi if [ "$run_configure" = "yes" ] ; then (cd maint && ./configure) fi # Create and/or update the f90 tests if [ -x maint/f77tof90 -a $do_f77tof90 = "yes" ] ; then echo "Create or update the Fortran 90 tests derived from the Fortran 77 tests" for dir in f77/* ; do if [ ! -d $dir ] ; then continue ; fi leafDir=`basename $dir` if [ ! -d f90/$leafDir ] ; then mkdir f90/$leafDir fi maint/f77tof90 $dir f90/$leafDir Makefile.sm Makefile.ap done fi # # Create the Makefile.in files # Make sure that these files exist so that the gcc dependency creation # can work rm_prepost=no if [ ! -s src/include/mpidpre.h ] ; then rm_prepost=yes fi # Create the configure files and run autoheader # Eventually, make this a test for find available. Perhaps # find . -name configure.ac > /dev/null 2>&1 # The problem is that even though cygwin has find, the DOS find # is identified first. We probably need a test for this case fixBackWhackCtrlMBug=no if [ $do_build_configure = yes ] ; then # If we don't delete the autom4te.cache files, bugs in # autoconf may fail to correctly update configure # Gah. Some xargs don't accept -r, other break if there is no # input. To avoid that, we do this in two steps: first the # find, then the rm (if there are any files) $autoreconf -vif $acIncDirFlag confdb if [ ! -x configure ] ; then # Check for a few allowed exceptions echo "Could not build configure from configure.ac in $dir" echo "Aborting updatefiles!" exit 1 fi fi # # The following must be the last statements executed if [ -n "$error_summary" ] ; then echo " " echo "Problems encountered while running updatefiles." echo "These may cause problems when configuring or building MPICH." echo "$error_summary" fi case $finalStatus in 0) # all is well ;; 1) # warnings ;; 2) # reserved for future use ;; 3) # fatal, cannot continue echo "updatefiles step failed! Review the output and fix the problem" echo "before continuing" exit 1 ;; *) # unknown echo "Internal error in updatefiles; finalStatus=$finalStatus" exit 1 ;; esac