root/mpich2/branches/dev/kumudb/maint/updatefiles @ 4870

Revision 4870, 32.0 KB (checked in by kumudb, 5 months ago)

Merge from trunk to kumudb r4748:r4869

  • Property svn:executable set to *
Line 
1#! /bin/sh
2#
3# (C) 2006 by Argonne National Laboratory.
4#     See COPYRIGHT in top-level directory.
5#
6# Update all of the derived files
7# For best performance, execute this in the top-level directory.
8# There are some experimental features to allow it to be executed in
9# subdirectories
10#
11# Eventually, we want to allow this script to be executed anywhere in the
12# mpich tree.  This is not yet implemented.
13error_summary=""
14acVersion=unknown
15
16# finalStatus records whether there have been problems in updatefiles
17# 1 = warning, 3 = fatal, 2 = reserved for future use,
18# 0 = no problems detected.
19finalStatus=0
20at_top=no
21if [ -d maint -a -s maint/simplemake.in ] ; then
22    at_top=yes
23fi
24#
25# Default choices
26# depend choices are dynamic, static, no
27do_depend=dynamic
28do_geterrmsgs=yes
29do_getparms=no
30do_bindings=yes
31do_f77=yes
32do_f77tof90=yes
33do_build_configure=yes
34do_genstates=yes
35do_makefiles=yes
36do_smpdversion=yes
37
38# Allow MAKE to be set from the environment
39MAKE=${MAKE-make}
40
41openpa_dir="src/openpa"
42hydra_dir="src/pm/hydra"
43
44# List of steps that we will consider
45# (We do not include depend because the values for depend are not just yes/no)
46AllSteps="geterrmsgs bindings f77 f77tof90 build_configure genstates makefiles smpdversion getparms"
47stepsCleared=no
48
49# Options for some steps
50autoconfdir=""
51automakedir=""
52autotoolsdir=""
53# Extract defaults from the environment
54if [ "x$MPICH2_AUTOCONF_DIR" != "x" ] ; then
55    autoconfdir=$MPICH2_AUTOCONF_DIR
56fi
57if [ "x$MPICH2_AUTOMAKE_DIR" != "x" ] ; then
58    automakedir=$MPICH2_AUTOMAKE_DIR
59fi
60if [ "x$MPICH2_AUTOTOOLS_DIR" != "x" ] ; then
61    autotoolsdir=$MPICH2_AUTOTOOLS_DIR
62fi
63#
64# Extract the arguments intended for updatefiles.  Any others are
65# given to simplemake. 
66temp_args=""
67for arg in "$@" ; do
68    case $arg in
69    -echo)
70        set -x
71        ;;
72       
73    -do=*)
74    opt=`echo A$arg | sed -e 's/A-do=//'`
75    # Handle some synonyms
76    case $opt in
77        build-configure|configure) opt=build_configure ;;
78        makefile|Makefile|Makefiles) opt=makefiles;;
79    esac
80    var=do_$opt
81    # Check that this opt is known
82    eval oldval=\$"$var"
83    if [ -z "$oldval" ] ; then
84        echo "-do=$opt is unrecognized"
85        exit 1
86    else
87        if [ $stepsCleared = no ] ; then
88            for step in $AllSteps ; do
89                var=do_$step
90                eval $var=no
91            done
92            stepsCleared=yes
93        fi
94        var=do_$opt
95        eval $var=yes
96    fi
97    ;;
98
99    -with-genstates|--with-genstates)
100    do_genstates=yes
101    ;;
102    -without-genstates|--without-genstates)
103    do_genstates=no
104    ;;
105 
106    -with-errmsgs|--with-errmsgs)
107    do_geterrmsgs=yes
108    ;;
109    -without-errmsgs|--without-errmsgs)
110    do_geterrmsgs=no
111    ;;
112
113    -with-bindings|--with-bindings)
114    do_bindings=yes
115    ;;
116    -without-bindings|--without-bindings)
117    do_bindings=no
118    ;;
119
120    -with-f77|--with-f77)
121    do_f77=yes
122    ;;
123    -without-f77|--without-f77)
124    do_f77=no
125    ;;
126
127    -with-autoconf=*|--with-autoconf=*)
128    # Select a location for a different autoconf
129    autoconfdir=`echo "A$arg" | sed -e 's/.*=//'`
130    ;;
131    -with-automake=*|--with-automake=*)
132    automakedir=`echo "A$arg" | sed -e 's/.*=//'`
133    ;;
134    -with-autotools=*|--with-autotools=*)
135    autotoolsdir=`echo "A$arg" | sed -e 's/.*=//'`
136    ;;
137
138    -distrib)
139    do_depend=no
140    do_build_configure=no
141    temp_args="$temp_args $arg"
142    ;;
143
144    -help|--help|-usage|--usage)
145    cat <<EOF
146    updatefiles [ --with-autoconf=dir ] [ --with-automake=dir ] \\
147                [ --with-autotools=dir ] [ -do=stepname ]       \\
148                [ args for simplemake ]
149    Update the files in the MPICH2 build tree.  This file builds the
150    configure files, creates the Makefile.in files (using the simplemake
151    program), extracts the error messages.
152
153    You can use --with-autoconf=dir to specify a directory that contains
154    an alternate autoconf and autoheader.  Similarly --with-automake can
155    be used to specify the location of automake and aclocal.  If
156    autoconf and automake are installed in the same location, they can
157    be specified by the --with-autotools option.
158
159    Use -do=stepname to update only a single step.  For example,
160    -do=build_configure only updates the configure scripts.  The available
161    steps are
162    $AllSteps
163EOF
164    exit
165    ;;
166    *)
167    temp_args="$temp_args $arg"
168    ;;
169    esac
170done
171
172if [ -n "$autotoolsdir" ] ; then
173    if [ -n "$autoconfdir" -o -n "$automakedir" ] ; then
174        # Don't permit --with-autotools together with either --with-autoconf or
175        # --with-automake because which argument takes precedence is not obvious
176        # without immediate explanation.  --with-autotools is really only
177        # present to make life a little easier for those who preferred the old
178        # behavior where --with-autoconf was used to specify the location of
179        # both autoconf and automake.
180        cat <<EOT
181Error: --with-autotools was specified together with either
182--with-autoconf or --with-automake.  --with-autotools is incompatible
183with the other two options.  Please specify only one set or the other.
184EOT
185        exit 1
186    else
187        autoconfdir=$autotoolsdir
188        automakedir=$autotoolsdir
189    fi
190fi
191
192# Reset the arguments.  Note that this doesn't handle arguments that contain
193# blanks.  I hope that we don't need those.
194set -- $temp_args
195#
196if [ $at_top = "no" ] ; then
197    echo "Must execute at top level directory for now"
198    exit 1
199fi
200#
201# On some systems (including Solaris), using -nt in a test statement causes
202# the shell script to abort.  We test for this here to make updatefiles more
203# robust in this case.  We use conftest as the name of the test program
204# because autoconf also uses this name, so we know that it will be ok.
205testNTfails=yes
206rm -rf conftest
207cat <<EOF >>conftest
208#! /bin/sh
209test a -nt b
210exit 2
211EOF
212chmod +x conftest
213./conftest 1>/dev/null 2>&1 >/dev/null
214st=$?
215if [ "$st" = 2 ] ; then
216    testNTfails=no
217fi
218rm -rf conftest
219#
220# Determine the autoconf to use.  If --with-autoconf was set, use
221# autoconf and autoheader from that directory
222# This may also be needed for tools in the maint directory
223if [ -n "$autoconfdir" ] ; then
224    if [ -x $autoconfdir/autoconf -a -x $autoconfdir/autoheader ] ; then
225        autoconf=$autoconfdir/autoconf
226        autoheader=$autoconfdir/autoheader
227        autoreconf=$autoconfdir/autoreconf
228        autom4te=$autoconfdir/autom4te
229        # Simplemake looks in environment variables for the autoconf
230        # and autoheader to use
231        AUTOCONF=$autoconf
232        AUTOHEADER=$autoheader
233        AUTORECONF=$autoreconf
234        AUTOM4TE=$autom4te
235        export AUTOCONF
236        export AUTOHEADER
237        export AUTORECONF
238        export AUTOM4TE
239    else
240        echo "Could not find executable autoconf and autoheader in $autoconfdir"
241        exit 1
242    fi
243else
244    autoconf=${AUTOCONF:-autoconf}
245    autoheader=${AUTOHEADER:-autoheader}
246    autoreconf=${AUTORECONF:-autoreconf}
247    autom4te=${AUTOM4TE:-autom4te}
248fi
249if [ -n "$automakedir" ] ; then
250    if [ -x "$automakedir/aclocal" -a -x "$automakedir/automake" ] ; then
251        # OpenPA uses autoreconf (and consequently aclocal and automake)
252        # but autoreconf uses whatever aclocal/automake is in your path,
253        # not the one from the same autoconf installation as the
254        # autoreconf you are invoking.  So we export ACLOCAL (etc...) so
255        # that it uses the right tools when specifying --with-automake.
256        automake=$automakedir/automake
257        aclocal=$automakedir/aclocal
258        AUTOMAKE=$automake
259        ACLOCAL=$aclocal
260        export AUTOMAKE
261        export ACLOCAL
262    else
263        echo "could not find executable aclocal and automake in $automakedir"
264        exit 1
265    fi
266else
267    automake=${AUTOMAKE:-automake}
268    aclocal=${ACLOCAL:-aclocal}
269fi
270
271#
272# Check that you have a working autoconf.  Autoconf 2.57 is not compatible with
273# previous versions of autoconf (!!), even 2.52 (!!!). 
274acVersion=ok
275if [ -d .tmp ] ; then rm -rf .tmp ; fi
276if [ -s .tmp ] ; then rm -f .tmp ; fi
277if [ ! -d .tmp ] ; then
278    mkdir .tmp 2>&1 >/dev/null
279fi
280# As of autoconf 2.59, the command line arguments changed (again)
281# We now require 2.59 most places, and 2.62 in several (including the
282# top-level), so we just double check
283# Somewhere between 2.12 and 2.58, -l changed to -B
284# Argh.  In autoconf 2.59, -B doesn't work.  You must use -I instead of -B (!!)
285# Find the configure version
286# acSubversion is the version number minus 2.  (we assume autoconf 2.xx)
287# -1 is used for unknown
288acSubversion=-1
289acIncDirFlag=-I
290for ver in 64 63 62 61 60 59 ; do
291    rm -f .tmp/configure.in .tmp/configure
292    cat >.tmp/configure.in <<EOF
293AC_PREREQ(2.$ver)
294EOF
295    if (cd .tmp && $autoconf >/dev/null 2>&1 ) ; then
296        acSubversion=$ver
297        break
298    fi
299done
300rm -f .tmp/configure.in .tmp/configure
301if [ "$acSubversion" -gt 0 ] ; then
302    acVersion="2.$acSubversion"
303    echo "You have autoconf version $acVersion or greater."
304    if [ "$acSubversion" -lt 62 ] ; then
305       cat <<EOF
306autoconf version 2.62 or later is required for MPICH2.
307EOF
308       if [ "$do_build_configure" = yes ] ; then
309            echo "Exiting updatefiles...."
310            exit 1
311       fi
312    fi
313else
314    cat <<EOF
315You either do not have autoconf in your path or updatefiles was unable to
316determine which version of autoconf you have.  You may be able to use
317     autoconf --version
318to see the version of autoconf (unfortunately, there is no standard
319format for the version output and it changes between autoconf versions.
320In addition, some versions of autoconf choose among many versions and
321provide incorrect output).
322EOF
323        error_summary="$error_summary \
324No autoconf in path or unable to determine the version of autoconf."
325        acVersion="Unknown"
326fi
327rm -rf .tmp
328
329#
330# Create the bindings if necessary
331if [ $do_bindings = "yes" ] ; then
332    build_f77=no
333    build_f90=no
334    build_cxx=no
335    if [ $do_f77 = "yes" ] ; then
336        if [ ! -s src/binding/f77/abortf.c ] ; then
337            build_f77=yes
338        elif find src/binding/f77 -name 'buildiface' -newer 'src/binding/f77/abortf.c' >/dev/null 2>&1 ; then
339            build_f77=yes
340        fi
341        if [ ! -s src/binding/f90/mpi_base.f90 ] ; then
342            build_f90=yes
343        elif find src/binding/f90 -name 'buildiface' -newer 'src/binding/f90/mpi_base.f90' >/dev/null 2>&1 ; then
344            build_f90=yes
345        fi
346 
347    fi
348
349    if [ $build_f77 = "yes" ] ; then
350        echo "Building Fortran 77 interface"
351        ( cd src/binding/f77 && chmod a+x ./buildiface && ./buildiface )
352    fi
353    if [ $build_f90 = "yes" ] ; then
354        echo "Building Fortran 90 interface"
355        ( cd src/binding/f90 && chmod a+x ./buildiface && ./buildiface )
356        ( cd src/binding/f90 && ../f77/buildiface -infile=cf90t.h -deffile=cf90tdefs)
357    fi
358
359    if [ ! -s src/binding/cxx/mpicxx.h ] ; then
360        build_cxx=yes
361    elif find src/binding/cxx -name 'buildiface' -newer 'src/binding/cxx/mpicxx.h' >/dev/null 2>&1 ; then
362        build_cxx=yes
363    fi
364    if [ $build_cxx = "yes" ] ; then
365        echo "Building C++ interface"
366        ( cd src/binding/cxx && chmod a+x ./buildiface &&
367          ./buildiface -nosep $otherarg )
368    fi
369fi
370#
371# Capture the error messages
372if [ $do_geterrmsgs = "yes" ] ; then
373    if [ ! -x maint/extracterrmsgs -a -s maint/extracterrmsgs ] ; then
374        # grrr.  CVS doesn't maintain permissions correctly across Windows/Unix
375        chmod a+x maint/extracterrmsgs
376    fi
377    if [ -x maint/extracterrmsgs ] ; then
378        echo "Extracting the error messages..."
379        rm -rf .tmp
380        rm -f .err
381        rm -f unusederr.txt
382        maint/extracterrmsgs -careful=unusederr.txt \
383            -skip=src/util/multichannel/mpi.c `cat maint/errmsgdirs` > \
384            .tmp 2>.err
385        # (error here is ok)
386        update_errdefs=yes
387        if [ -s .err ] ; then
388            cat .err
389            rm -f .err2
390            grep -v "Warning:" .err > .err2
391            if [ -s .err2 ] ; then
392                echo "Because of errors in extracting error messages, the file"
393                echo "src/mpi/errhan/defmsg.h was not updated."
394                error_summary="$error_summary \
395Error message files in src/mpi/errhan were not updated."
396                update_errdefs=no
397                finalStatus=1
398                rm -f .tmp
399            fi
400            rm -f .err .err2
401        else
402            # Incase it exists but has zero size
403            rm -f .err
404        fi
405        if [ -s unusederr.txt ] ; then
406            echo "There are unused error message texts in src/mpi/errhan/errnames.txt"
407            echo "See the file unusederr.txt for the complete list"
408        fi
409        if [ -s .tmp -a "$update_errdefs" = "yes" ] ; then
410            mv .tmp src/mpi/errhan/defmsg.h
411        fi
412        if [ ! -s src/mpi/errhan/defmsg.h ] ; then
413            echo "Creating a dummy defmsg.h file"
414            cat > src/mpi/errhan/defmsg.h <<EOF
415typedef struct { const unsigned int sentinal1; const char *short_name, *long_name; const unsigned int sentinal2; } msgpair;
416static const int generic_msgs_len = 0;
417static msgpair generic_err_msgs[] = { {0xacebad03, 0, "no error catalog", 0xcb0bfa11}, };
418static const int specific_msgs_len = 0;
419static msgpair specific_err_msgs[] = {  {0xacebad03,0,0,0xcb0bfa11}, };
420#if MPICH_ERROR_MSG_LEVEL > MPICH_ERROR_MSG_NONE
421#define MPIR_MAX_ERROR_CLASS_INDEX 54
422static int class_to_index[] = {
4230, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4240, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4250, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4260, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4270, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4280, 0, 0, 0 };
429#endif
430EOF
431        fi
432    fi
433fi  # do_geterrmsgs
434#
435# Build scripts such as simplemake if necessary
436made_simplemake=no
437run_configure=no
438# Later versions of autoconf put the autoconf version into the autom4te*.cache
439# name.
440# Later versions of autoconf (2.57+?) will silently ignore the command to
441# rebuild the configure if it thinks that nothing has changed.  However,
442# it does not accurately decide this (e.g., if aclocal.m4 includes files
443# that have changed, autoconf will ignore that and not regenerate the
444# configure file).  The information that autoconf uses is saved in the
445# autom4te*.cache file; since this cache is not accurate, we delete it.
446if [ ! -x maint/configure ] ; then
447    (cd maint && $autoconf && rm -rf autom4te*.cache )
448elif find maint -name 'configure.in' -newer 'maint/configure' >/dev/null 2>&1 ; then
449    # The above relies on the Unix find command
450    (cd maint && $autoconf && rm -rf autom4te*.cache)
451fi
452if [ ! -x maint/simplemake -o ! -x maint/genstates ] ; then
453    run_configure=yes
454fi
455#
456# The following relies on the Unix find command
457if [ -s maint/simplemake ] ; then
458    if find maint -name 'simplemake.in' -newer 'maint/simplemake' >/dev/null 2>&1 ; then
459        run_configure=yes
460    fi
461else
462    run_configure=yes
463fi
464if [ -s maint/genstates ] ; then
465    if find maint -name 'genstates.in' -newer 'maint/genstates' >/dev/null 2>&1 ; then
466        run_configure=yes
467    fi
468else
469    run_configure=yes
470fi
471
472if [ "$run_configure" = "yes" ] ; then
473    (cd maint && ./configure)
474    made_simplemake=yes
475fi
476
477#
478if [ ! -x maint/simplemake -a $do_makefiles = yes ] ; then
479    echo "Could not create simplemake"
480    echo "You can copy simplemake.in to simplemake, replacing @PERL@ with the"
481    echo "path to Perl (version5).  Make sure the resulting file has"
482    echo "execute permissions set."
483    exit 1
484fi
485
486# Run some of the simple codes
487#
488# if [ -x maint/genstates -a $do_genstates = "yes" ] ; then
489#     echo "Creating the enumeration of logging states into src/include/mpiallstates.h"
490#     maint/genstates
491# fi
492if [ -x maint/extractstates -a $do_genstates = "yes" ] ; then
493    echo "Creating the enumeration of logging states into src/include/mpiallstates.h"
494    maint/extractstates
495fi
496if [ -x maint/extractparms -a $do_getparms = "yes" ] ; then
497    maint/extractparms -outfile=parms.htm
498fi
499# Create and/or update the f90 tests
500if [ -x maint/f77tof90 -a $do_f77tof90 = "yes" ] ; then
501    echo "Create or update the Fortran 90 tests derived from the Fortran 77 tests"
502    for dir in test/mpi/f77/* ; do
503        if [ ! -d $dir ] ; then continue ; fi
504        leafDir=`basename $dir`
505        if [ ! -d test/mpi/f90/$leafDir ] ; then
506            mkdir test/mpi/f90/$leafDir
507        fi
508        maint/f77tof90 $dir test/mpi/f90/$leafDir Makefile.sm Makefile.ap
509    done
510fi
511
512if [ $made_simplemake != "no" -a $do_makefiles = yes ] ; then
513    # Check that only the first three lines were changed:
514    rm -f .t1 .t2
515    sed -e 1,3d maint/simplemake.in > .t1
516    sed -e 1,3d maint/simplemake > .t2
517    if diff .t1 .t2 >/dev/null 2>&1 ; then
518        :
519    else
520        echo "Something is wrong with simplemake; configure may have"
521        echo "replaced variables that it should not have."
522        diff .t1 .t2
523        exit 1
524    fi
525    rm -f .t1 .t2
526fi
527#
528# Create the Makefile.in files
529# Make sure that these files exist so that the gcc dependency creation
530# can work
531rm_prepost=no
532if [ ! -s src/include/mpidpre.h ] ; then
533    rm_prepost=yes
534fi
535otherargs="$@"
536# If there is no mpi.h file (and other files, but testing on mpi.h should
537# be enough), don't generate the dependency information in the Makefiles
538# with the static dependency target.  The new default in simplemake is
539# dynamic dependency data
540# Currently, the dependency generation relies on using gcc, so we may
541# want to test on that as well.
542#
543#
544if [ $do_depend = static -a ! -s src/include/mpi.h ] ; then
545    # Static dependencies require a mpi.h file
546    echo "Turning off static generation of dependencies because there is no mpi.h file"
547    do_depend=no
548fi
549if [ $do_depend = no ] ; then
550    otherargs="$otherargs -nodepend"
551#else
552#    # The next two files may be needed to build the dependency lists
553#    touch src/include/mpidpre.h src/include/mpidpost.h
554fi
555#
556# autoconf 2.57 drastically changed the command line arguments.
557# Up through 2.52, -l dir was the "localdir for searching"
558# By 2.57, -l was no longer accepted, and -B dir or --prepend-include=DIR
559# was used. 
560# To make things more exciting, the format of autoconf --version has
561# changed, making it very hard to automatically extract the version number
562# so that programs like this can work around poor software engineering,
563# such as incompatible changes in a minor-numbered release.
564#
565# Just to make this even more interesting, the cygwin version of
566# autoconf selects a version.  But the code to so this causes --version
567# (and --help!) to fail unless there is a configure.in file in the current
568# directory. 
569if [ $do_makefiles = yes ] ; then
570    if maint/simplemake -common=maint/makedefs \
571        -docnamedefs='${master_top_srcdir}/maint/docnotes' \
572        -autoconf="$acIncDirFlag ROOTDIR/confdb" \
573        -libdir='${MPILIBNAME}'=ROOTDIR/lib \
574        -smroot='${master_top_srcdir}/maint' $otherargs \
575        Makefile.sm ; then
576        :
577    else
578        echo "Simplemake step failed!"
579        exit 1
580    fi
581fi
582
583# Create the configure files and run autoheader
584# Eventually, make this a test for find available.  Perhaps
585# find . -name configure.in > /dev/null 2>&1
586# The problem is that even though cygwin has find, the DOS find
587# is identified first.  We probably need a test for this case
588fixBackWhackCtrlMBug=no
589if [ $do_build_configure = yes ] ; then
590    find . -name 'configure.in' >/dev/null 2>&1
591    if [ $? = 0 ] ; then has_unix_find=yes ; else has_unix_find=no ; fi
592    # if [ $? = 0 ] ; then .. code with find
593    if [ "$has_unix_find" = "yes" -a "$do_build_configure" = "yes" ] ; then
594        # Check for out-of-date configures (the dependency handling
595        # isn't 100% accurate, so we use this step as an additional
596        # check)
597        if [ ! -s maint/conftimestamp ] ; then
598            echo "Rebuilding all configure script because of missing confdbtimestamp"
599            find . -name configure -print | grep -v maint/configure | xargs rm -f
600            # If we don't delete the autom4te.cache files, bugs in
601            # autoconf may fail to correctly update configure
602            # Gah. Some xargs don't accept -r, other break if there is no
603            # input.  To avoid that, we do this in two steps: first the
604            # find, then the rm (if there are any files)
605            rm -f .atmp
606            find . -name autom4te.cache > .atmp 2>/dev/null
607            if [ -s .atmp ] ; then xargs rm -f < .atmp ; fi
608            rm -f .atmp
609            date > maint/conftimestamp
610        else
611            # We can't use a status check here because find will always
612            # report success, even if there are no newer files in confdb
613            files=`find confdb -newer  maint/conftimestamp 2>&1`
614            if [ -n "$files" ] ; then
615                echo "Rebuilding all configure script because of changes in confdb"
616                find . -name configure -print | grep -v maint/configure | xargs rm -f
617                date > maint/conftimestamp
618            fi
619        fi
620        #
621        for dir in `find . -name 'configure.in' -print` ; do
622            dir=`dirname $dir`
623            allowFailure=no
624            builtConfigure=no
625            #echo $dir
626            qmpe2dir=`echo $dir | sed -e 's%.*src/mpe2.*%FOUNDMPE2%'`
627            if [ "$qmpe2dir" = "FOUNDMPE2" ] ; then
628                # echo "Found MPE2 directory; skipping"
629                # MPE2 has its own updatefiles script, which should
630                # be used instead of this one.
631                continue
632            fi
633            qtestmaint=`echo $dir | sed -e 's%.*test/mpi/maint.*%FOUNDTESTMAINT%'`
634            if [ "$qtestmaint" = "FOUNDTESTMAINT" ] ; then
635                # echo "Found test/maint directory; skipping"
636                # test/maint has its own updatefiles script, which should
637                # be used instead of this one when building that configure
638                continue
639            fi
640            qhydra=`echo $dir | sed -e 's%.*'"$hydra_dir"'.*%FOUNDHYDRA%'`
641            if [ "$qhydra" = "FOUNDHYDRA" ] ; then
642                # hydra is updated using autoreconf later in this script
643                continue
644            fi
645            qopenpa=`echo $dir | sed -e 's%.*'"$openpa_dir"'.*%FOUNDOPENPA%'`
646            if [ "$qopenpa" = "FOUNDOPENPA" ] ; then
647                # openpa is updated using autoreconf later in this script
648                continue
649            fi
650            qopenpa=`echo $dir | sed -e 's%.*openpa.*%FOUNDOPENPA%'`
651            if [ "$qopenpa" = "FOUNDOPENPA" ] ; then
652                # this is the old openpa location (in the root of the package)
653                # this clause exists because SVN won't delete the old directory
654                # when you run "svn update".
655                continue
656            fi
657            if [ -s $dir/Makefile.in ] ; then
658                #echo "Found $dir/configure.in"
659                #
660                # Check for known problems
661                if [ $dir = "./src/mpi/romio" ] ; then
662                    echo "Creating configure in $dir"
663                    # Using an explicit acIncDirFlag will force
664                    # a consistent choice of autoconf
665                    # Only use autoheader if AC_CONFIG_HEADER is
666                    # present
667                    if grep AC_CONFIG_HEADER $dir/configure.in >/dev/null 2>&1 ; then
668                        (cd $dir && $autoheader $acIncDirFlag . )
669                    fi
670                    (cd $dir && \
671                        $autoconf $acIncDirFlag . && rm -rf autom4te*.cache )
672                    if grep 'mpi2-other/info/Makefile \\
673' $dir/configure 2>&1 >/dev/null ; then
674                        fixBackWhackCtrlMBug=yes
675                    fi
676                    # Add other tests here (sigh) as necessary
677                    if [ "$fixBackWhackCtrlMBug" = yes ] ; then
678                        rm -f c.tmp
679                        sed -e '/"\\
680/d' -e 's/\\
681//g' $dir/configure > c.tmp
682                        rm -f $dir/configure
683                        mv c.tmp $dir/configure
684                        chmod a+x $dir/configure
685                    fi
686                    builtConfigure=yes
687                    continue
688                elif [ $dir = "./src/mpe2" ] ; then
689                    # Use acIncDirFlag to ensure that a consistent
690                    # choice of autoconf is made by systems that
691                    # support 2.1x and 2.57+
692                    echo "Creating configure in $dir"
693                    if grep AC_CONFIG_HEADER $dir/configure.in >/dev/null 2>&1 ; then
694                        (cd $dir && $autoheader $acIncDirFlag . )
695                    fi
696                    builtConfigure=yes
697                    (cd $dir && $autoconf $acIncDirFlag . && rm -rf autom4te*.cache)
698                    continue
699                fi
700                # First, check for a configure target in Makefile.in
701                if grep 'configure:' $dir/Makefile.in >/dev/null 2>&1 ; then
702                    # The make -q checks whether the target is upto date first;
703                    # if it isn't, we remake it.
704                    rm -f $dir/mf.out
705                    rm -f $dir/mf.newer
706                    date > $dir/mf.newer
707                    (cd $dir && rm -f mf.tmp ; \
708                    sed -e 's%@SHELL@%/bin/sh%' \
709                        -e "s%@srcdir@%.%g" \
710                        -e '/include .*alldeps/d' \
711                        -e '/@SET_MAKE@/d' Makefile.in > mf.tmp ;\
712                        if ${MAKE} -q -f mf.tmp configure >mf.out 2>&1 ; then \
713                    : ; else \
714                    echo "Found $dir/configure.in; executing make configure target" ; \
715                    ${MAKE} -f mf.tmp configure ; fi ; \
716                        if [ -s configure ] ; then rm -f mf.tmp ; \
717                        else echo "See `pwd`/mf.tmp for Makefile that failed" ;\
718                        fi ;\
719                    )
720                    # Newer versions of test support -nt, which is
721                    # filea newer-than fileb.  If this doesn't
722                    # work on your platform, simply comment out this test
723                    # and set builtConfigure to true (or use find with
724                    # -newer if you want to replace the test)
725                    # Test for support of -nt
726                    if [ "$testNTfails" = "no" ] ; then
727                        rm -f .foo
728                        test $dir/configure -nt $dir/mf.newer 2>.foo
729                        # If .foo is empty, there was no error in test with -nt
730                        if [ ! -s ".foo" ] ; then
731                            if [ $dir/configure -nt $dir/mf.newer ] ; then
732                                builtConfigure=yes
733                            fi
734                        fi
735                        rm -f .foo
736                    fi
737                    #
738                    rm -f $dir/mf.newer
739                    if [ ! -x $dir/configure ] ; then
740                        echo "Error! Could not build configure in $dir with make configure"
741                        finalStatus=3
742                    elif grep PAC_ $dir/configure >/dev/null 2>&1 ; then
743                        # If the user manually builds the configure without
744                        # properly specifying the include path, then
745                        # this code will detect the problem but will
746                        # the message may be confusing since the make
747                        # step above will *not* have rebuilt the configure
748                        # (once the user builds it manually, the make step
749                        # will see the configure as newer than its
750                        # dependencies and not rebuild it).
751                        mydir=$dir
752                        if [ "$dir" = "." ] ; then
753                            mydir=`pwd`
754                        fi
755                        if [ "$buildConfigure" = "yes" ] ; then
756                            echo "Error! autoconf did not find local macro definitions for configure in $mydir"
757                            echo "Try removing configure in `pwd` and rerunning maint/updatefiles"
758                            echo "The following (at most 40 lines) local macros were not found:"
759                            grep PAC_ $dir/configure | head -40
760                            if [ -s $dir/mf.out ] ; then
761                                echo "Output of make configure step was:"
762                                cat mf.out
763                            fi
764                        else
765                            echo "Error! The file $mydir/configure contains local macro names (PAC_) and was not built by this "
766                            echo "updatefiles step.  Try removing $mydir/configure (but do not"
767                            echo "remove $mydir/configure.in) and rerun maint/updatefiles."
768                            if [ -s $dir/aclocal.m4 ] ; then
769                                echo "Also, make sure that $mydir/aclocal.m4 is correct; only src/mpi/romio, "
770                                echo "src/pm/mpd, and src/mpe2/... directories should have an aclocal.m4"
771                                echo "file in the same directory with configure.in (others use the "
772                                echo "aclocal.m4 in confdb)."
773                            fi
774                            echo "*Never* run autoconf or autoheader manually because many of the configure.in "
775                            echo "files require extra definitions from confdb/aclocal.m4 ."
776                        fi
777                        finalStatus=3
778                    fi
779                    # Remove make output now that we no longer need it.
780                    rm -f $dir/mf.out
781                else
782                    if [ -x $dir/makeconfigure ] ; then
783                        echo "Using makeconfigure in $dir"
784                        (cd $dir && ./makeconfigure )
785                    else
786                        # Check for old 1.7 configure files (in MPE, at least for
787                        # now)
788                        if egrep 'AC_ARG|AC_CHECK_FUNCS' $dir/configure.in >/dev/null 2>&1 ; then
789                            echo "Trying simple autoheader/autoconf in $dir"
790                            if grep AC_CONFIG_HEADER $dir/configure.in >/dev/null 2>&1 ; then
791                                (cd $dir && $autoheader $acIncDirFlag . )
792                            fi
793                            (cd $dir && $autoconf $acIncDirFlag . && rm -rf autom4te*.cache)
794                        else
795                            # Try autoconf-1.7; accepts failures gracefully
796                            echo "Trying simple autoconf using 1.7 in $dir"
797                            # Don't panic if we can't build this configure; it
798                            # is too old.
799                            allowFailure=yes
800                            (cd $dir && autoconf-1.7)
801                        fi
802                    fi
803                fi
804                #
805                # Under cygwin, sometimes (?) configure ends up containing \^M
806                # (that's <ctrl>-M).  We may need to add this sed step
807                # sed -e '/"\
808"/d' -e 's/\
809//g'
810                # (the first removes case statements on \^M, the second
811                # removes the \^M from the ac_config_files statement
812                fixBackWhackCtrlMBug=no
813                if [ ! -s $dir/configure -a "$allowFailure" != yes ] ; then
814                    echo "PANIC: Could not make configure from configure.in"
815                    echo "In directory $dir"
816                    exit 1
817                elif [ -s $dir/configure ] ; then
818                    if grep 'src/Makefile \\ src' $dir/configure 2>&1 >/dev/null ; then
819                        fixBackWhackCtrlMBug=yes
820                    elif grep 'src/Makefile \\
821 src' $dir/configure 2>&1 >/dev/null ; then
822                        fixBackWhackCtrlMBug=yes
823                    elif grep 'attr/Makefile \\ util' $dir/configure 2>&1 >/dev/null ; then
824                        fixBackWhackCtrlMBug=yes
825                    elif grep 'attr/Makefile \\
826' $dir/configure 2>&1 >/dev/null ; then
827                        fixBackWhackCtrlMBug=yes
828                    elif grep 'mpi2-other/info/Makefile \\
829' $dir/configure 2>&1 >/dev/null ; then
830                        fixBackWhackCtrlMBug=yes
831                    elif grep 'maint/testmerge \\
832' $dir/configure 2>&1 >/dev/null ; then
833                        fixBackWhackCtrlMBug=yes
834                    fi
835                    # Add other tests here (sigh) as necessary
836                    if [ "$fixBackWhackCtrlMBug" = yes ] ; then
837                        rm -f c.tmp
838                        sed -e '/"\\
839/d' -e 's/\\
840//g' $dir/configure > c.tmp
841                        rm -f $dir/configure
842                        mv c.tmp $dir/configure
843                        chmod a+x $dir/configure
844                    fi
845                fi
846            fi
847        if [ ! -x $dir/configure -a "$allowFailure" != yes ] ; then
848            # Check for a few allowed exceptions
849            if [ "$dir" = "./src/pmi/winmpd" ] ; then
850                continue
851            fi
852            if [ -s $dir/Makefile.sm -a ! -s $dir/Makefile.in ] ; then
853                # This is an old directory that is no longer processed
854                # by simplemake; these are ignored
855                continue
856            fi
857            echo "Could not build configure from configure.in in $dir"
858            echo "Aborting updatefiles!"
859            exit 1
860        fi
861        done
862    elif [ "$has_unix_find" = no ] ; then
863        echo "You need to install find (in findutils)"
864        exit 1
865    else
866        echo "Skipping creation of configure files"
867    fi
868fi
869
870# must come after the above autoreconf-like logic because the above
871# logic will delete the results of this actual autoreconf
872if [ -d "$openpa_dir" -o -L "$openpa_dir" ] ; then
873    echo "running autoreconf in $openpa_dir"
874    (cd $openpa_dir && $autoreconf -vif) || exit 1
875fi
876if [ -d "$hydra_dir" -o -L "$hydra_dir" ] ; then
877    echo "running autoreconf in $hydra_dir"
878    (cd $hydra_dir && $autoreconf -vif) || exit 1
879fi
880
881if [ -f src/mpe2/maint/updatefiles -a "$do_build_configure" = "yes" ] ; then
882    # If we have the mpe2 updatefiles, execute it from the mpe directory
883    (cd src/mpe2 && chmod a+x maint/updatefiles && maint/updatefiles )
884fi
885if [ $rm_prepost = yes ] ; then
886    rm -f src/include/mpidpre.h src/include/mpidpost.h
887fi
888if [ "$do_smpdversion" = yes ] ; then
889    echo "Creating src/pm/smpd/smpd_version.h"
890    smpdVersion=`cat maint/Version`
891    cat >src/pm/smpd/smpd_version.h <<EOF
892/* -*- Mode: C; c-basic-offset:4 ; -*- */
893/* 
894 *  (C) 2005 by Argonne National Laboratory.
895 *      See COPYRIGHT in top-level directory.
896 */
897#define SMPD_VERSION "$smpdVersion"
898EOF
899fi
900
901echo "Updating README's version ID."
902VERSION=`cat maint/Version`
903sed -e "s/%VERSION%/${VERSION}/g" README.vin > README
904
905BASIC_VERSION=`expr $VERSION : '\([0-9]*\.[0-9]*[\.]*[0-9]*\)[a-zA-Z]*[0-9]*'`
906VERSION_EXT=`expr $VERSION : '[0-9]*\.[0-9]*[\.]*[0-9]*\([a-zA-Z]*[0-9]*\)'`
907sed -e "s/%BASIC_VERSION%/${BASIC_VERSION}/g" -e "s/%VERSION_EXT%/${VERSION_EXT}/g" \
908    src/packaging/spec/fedora.spec.vin > src/packaging/spec/fedora.spec
909
910#
911# The following must be the last statements executed
912if [ -n "$error_summary" ] ; then
913    echo " "
914    echo "Problems encountered while running updatefiles."
915    echo "These may cause problems when configuring or building MPICH2."
916    echo "$error_summary"
917fi
918case $finalStatus in
919   0) # all is well
920        ;;
921   1) # warnings
922        ;;
923   2) # reserved for future use
924        ;;
925   3) # fatal, cannot continue
926        echo "updatefiles step failed!  Review the output and fix the problem"
927        echo "before continuing"
928        exit 1
929        ;;     
930   *) # unknown
931        echo "Internal error in updatefiles; finalStatus=$finalStatus"
932        exit 1
933        ;;
934esac
Note: See TracBrowser for help on using the browser.