File: mpiinstall.in

package info (click to toggle)
mpich 1.1.0-3
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 22,116 kB
  • ctags: 27,349
  • sloc: ansic: 193,435; sh: 11,172; fortran: 6,545; makefile: 5,801; cpp: 5,020; tcl: 3,548; asm: 3,536; csh: 1,079; java: 614; perl: 183; awk: 168; sed: 70; f90: 62
file content (702 lines) | stat: -rw-r--r-- 23,236 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
#! /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
#
# Modified by John Goerzen <jgoerzen@complete.org> on Feb 12, 1998 to
# work with Debian's package building system.
#
ARCH=@ARCH@
COMM=@COMM@
PREFIX=@PREFIX@
INSTPREFIX=$PREFIX
BUILDPREFIX=$PREFIX
DEVICE=@DEVICE@
CPRP=@CPRP@
MAKE="@MAKE@"
RSH_COMMAND=@RSH_COMMAND@
DEFAULT_MACHINE=@DEFAULT_MACHINE@
# File access mode
MODE=0664
XMODE=0775
# Uninstall filename
UNINSTALLFILE="util/mpiuninstall"
# If we're doing -libonly, we may want a different file....
#
# dirlist is used to uninstall empty directories at the end
dirlist=""
#
errs=0
#
# set failmode to soft to let failures accumulate
failmode="hard"
Show=eval
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=*)PREFIX=`echo $arg | sed -e 's/-prefix=//g'` ;;
	-aprefix=*)APREFIX=`echo $arg | sed -e 's/-aprefix=//g'` ;;
	-buildprefix=*)BUILDPREFIX=`echo $arg | sed -e 's/-buildprefix=//g'` ;;
	-nonupshot)nonupshot=1 ;;
	-cpnupshot)cpnupshot=1 ;;
	-noman) noman=1 ;;
	-device=*) DEVICE=`echo A$arg | sed -e 's/A-device=//g'` 
	           COMM=$DEVICE ;;
	-manpath=*)MPIMANPATH=`echo $arg | sed -e 's/-manpath=//g'` ;;
	-libonly) libonly=1 ;;
	-t) Show=echo
	    just_testing=1
	    failmode="soft"
	    ;;
	-help|-u|-usage|-h)
	echo "Install MPICH into $PREFIX."
	echo "-mode=nnnn   - mode for regular files.  Default is $MODE ."
	echo "-xmode=nnnn  - mode for execuables and directories.  Default is $XMODE ."
	echo "-prefix=path - Destination directory."
	echo "-aprefix=path- Path to use in sample files.  Default is same"
	echo "               as prefix."
	echo "-t           - Try only; do no installation."
	echo "-libonly     - Install only the libraries; this is "
	echo "               appropriate for installing a second device."
	echo "-manpath=path- Set an alternate path for the man pages"
	echo "-noman       - Do not install the man pages."
	echo "-nonupshot   - Do not try to build or install nupshot."
	echo "-cpnupshot   - Do not build nupshot; install the one in"
	echo "               profiling/nupshot - WARNING - read the "
	echo "               installation manual first!"
	echo "-device=name - Select a different device type to install"
	exit 1
	;;
	*)
	echo "Unrecognized argument $arg ."
	exit 1
	;;
    esac
done
if [ -z "$APREFIX" ] ; then
    APREFIX=$PREFIX
fi
#
# If libonly, we need to get the correct default machine etc.  We could 
# get this from the config.status for the device, but the problem is that
# there are MANY items to restore.  A better approach is to use an install
# script from the library directory itself.
if [ -n "$libonly" ] ; then
#   trialname=`sed -n -e "s/DEFAULT_MACHINE='\(.*\)'/\1/p" \
#	lib/$ARCH/$COMM/config.status`
#   if [ -n "$trialname" ] ; then 
#	DEFAULT_MACHINE="$trialname"
#   fi
    if [ -x lib/$ARCH/$COMM/mpiinstall ] ; then
        . lib/$ARCH/$COMM/mpiinstall "$@"
        exit $?
    fi
fi
#
# Update some fields that contain the build root directory
# These work by extracting the syntax for specifying the library, and then
# adding the correct destination to it.
NFLIB_PATH=`echo "@FLIB_PATH@" | \
	sed -e "s%^\([^/ ]*\)/[^ ]*%\1$PREFIX/lib/$ARCH/$COMM%g"`
NFINC=`echo "@FINC@" | \
	sed -e "s%^\([^/ ]*\)/[^ ]*%\1$PREFIX/include%g"`
#
# Remove old uninstall file
/bin/rm -f $UNINSTALLFILE
cat > $UNINSTALLFILE <<EOF
#! /bin/sh
set -x
EOF
chmod +x $UNINSTALLFILE
#
#
# We could use install, but install is too different and too hard to 
# test.  So here are the routines to copy file, make directories, and 
# replace #...# and @...@ in files
CP=cp
#
CopyFile() {
if [ -z "$3" ] ; then
    mode=$MODE
else
    mode=$3
fi
if [ -d $2 ] ; then
    dest=$2/`basename $1`
else
    dest=$2
fi
if [ -f $dest ] ; then
    echo "$dest exists; not changed"
elif [ -d $1 ] ; then
    echo ">>> $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
    echo "Copying $1 to $dest"
    $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 "/bin/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 [ $failmode = "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
}

MkDir() {
if [ ! -d $1 ] ; then
    echo "Creating directory $1"
    $Show mkdir $1
    rc=$?
    if [ $rc != 0 ] ; then
	echo "**Error making directory $1**"
        errs=`expr $errs + 1`
        if [ $failmode = "hard" ] ; then exit $rc ; fi
    else
	# Note that we store in inverse order
	dirlist="$1 $dirlist"
    fi
    $Show chmod $XMODE $1
    rc=$?
    if [ $rc != 0 ] ; then
	echo "**Error setting mode on directory $dest**"
        errs=`expr $errs + 1`
        if [ $failmode = "hard" ] ; then exit $rc ; fi
    fi
fi
}
#
# Fixup files that need #...# replaced
#
FixupFile() {
if [ -d $2 ] ; then
    dest=$2/`basename $1`
else
    dest=$2
fi
if [ -f $dest ] ; then
    echo "$dest exists; not changed"
elif [ -d $1 ] ; then
    echo "$1 is a directory; not copied"
else
    if [ $just_testing = 0 ] ; then
        sed \
	-e "s%\#ARCH\#%$ARCH%g" \
	-e "s%\#AUTOMOUNTFIX\#%@AUTOMOUNTFIX@%g" \
        -e "s%\#BITMAP_DIR\#%$INSTPREFIX/lib/bitmaps%g" \
	-e "s%\#CC\#%@CC@%g" \
	-e "s%\#CFLAGS\#%@CFLAGS@%g" \
	-e "s%\#CLINKER\#%@CLINKER@%g" \
	-e "s%\#COMM\#%$COMM%g" \
	-e "s%\#DEFAULT_ARCH\#%$ARCH%g" \
	-e "s%\#DEFAULT_DEVICE\#%$DEVICE%g" \
	-e "s%\#DEFAULT_MACHINE\#%$DEFAULT_MACHINE%g" \
       	-e "s%\#EXECER_DIR\#%$INSTPREFIX/util%g" \
	-e "s%\#F77\#%@F77@%g" \
	-e "s%\#FFLAGS\#%@FFLAGS@%g" \
	-e "s%\#FLIB_PATH_LEADER\#%@FLIB_PATH_LEADER@%g" \
	-e "s%\#FLINKER\#%@FLINKER@%g" \
	-e "s%\#INCLUDE_PATH\#%@INCLUDE_PATH@%g" \
	-e "s%\#INSTALL_DIR\#%$INSTPREFIX%g" \
	-e "s%\#LIB_LIST\#%@LIB_LIST@%g" \
	-e "s%\#MPIRUN_BIN\#%lib/$ARCH/$COMM%g" \
        -e "s%\#MPIR_HOME\#%$INSTPREFIX%g" \
	-e "s%\#OPTFLAGS\#%@OPTFLAGS@%g" \
	-e "s%\#INSTPREFIX\#%$INSTPREFIX%g" \
	-e "s%\#BUILDPREFIX\#%$BUILDPREFIX%g" \
	-e "s%\#PREFIX\#%$INSTPREFIX%g" \
	-e "s%\#RSH_COMMAND\#%$RSH_COMMAND%g" \
	-e "s%\#SYNCLOC\#%@SYNCLOC@%g" \
	-e "s%\#TK_VERSION\#%@TK_VERSION@%g" \
	-e "s%\#MPILIBNAME\#%@MPILIBNAME@%g" \
	-e "s%\#wishloc\#%@wishloc@%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 "/bin/rm -f $dest" >> $UNINSTALLFILE
        fi
    else
	echo "Fixup $1.in and copy to $dest"
    fi
fi
if [ -z "$3" ] ; then
    mode=$MODE
else
    mode=$3
fi
$Show chmod $mode $2
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 is a version of FixupFile that handles @...@ instead of #...#.
# This is a little trickier, since this file itself is processed by
# with @...@ replacements.  We take advantage of the fact that [char] 
# matches the same things as char.
# This has a few more fields than FixupFile
#
FixupFileWithAt() {
    # Change the FIRST libpath to the new form.  This allows 
    # the LIB_PATH to contain multiple names, as long as the MPICH libpath
    # is first
    NLIBPATH=`echo "@LIB_PATH@" | \
	sed -e "s%^\([^/ ]*\)/[^ ]*%\1$INSTPREFIX/lib/$ARCH/$COMM%g"`
if [ -d $2 ] ; then
    dest=$2/`basename $1`
else
    dest=$2
fi
if [ -f $dest ] ; then
    echo "$dest exists; not changed"
elif [ -d $1 ] ; then
    echo "$1 is a directory; not copied"
else
    if [ $just_testing = 0 ] ; then
        sed \
	-e "s%[@]ARCH[@]%$ARCH%g" \
	-e "s%[@]AUTOMOUNTFIX[@]%@AUTOMOUNTFIX@%g" \
	-e "s%[@]FINC[@]%$NFINC%g" \
        -e "s%[@]BITMAP_DIR[@]%$INSTPREFIX/lib/bitmaps%g" \
	-e "s%[@]CC[@]%@CC@%g" \
	-e "s%[@]CCC[@]%@CCC@%g" \
	-e "s%[@]CPP_COMPILER[@]%@CPP_COMPILER@%g" \
	-e "s%[@]CFLAGS[@]%@CFLAGS@%g" \
	-e "s%[@]CLINKER[@]%@CLINKER@%g" \
	-e "s%[@]CCLINKER[@]%@CCLINKER@%g" \
	-e "s%[@]COMM[@]%$COMM%g" \
	-e "s%[@]DEFAULT_ARCH[@]%$ARCH%g" \
	-e "s%[@]DEFAULT_DEVICE[@]%$DEVICE%g" \
	-e "s%[@]DEFAULT_MACHINE[@]%$DEFAULT_MACHINE%g" \
       	-e "s%[@]EXECER_DIR[@]%$INSTPREFIX/util%g" \
	-e "s%[@]F77[@]%@F77@%g" \
	-e "s%[@]FFLAGS[@]%@FFLAGS@%g" \
	-e "s%[@]FLIB_PATH_LEADER[@]%@FLIB_PATH_LEADER@%g" \
	-e "s%[@]FLIB_PATH[@]%$NFLIB_PATH%g" \
	-e "s%[@]FLINKER[@]%@FLINKER@%g" \
	-e "s%[@]INCLUDE_PATH[@]%@INCLUDE_PATH@%g" \
	-e "s%[@]INSTALL_DIR[@]%$INSTPREFIX%g" \
	-e "s%[@]LIB_PATH[@]%$NLIBPATH%g" \
	-e "s%[@]LIB_LIST[@]%@LIB_LIST@%g" \
	-e "s%[@]MPE_LIBS[@]%@MPE_LIBS@%g" \
        -e "s%[@]MPIR_HOME[@]%$INSTPREFIX%g" \
        -e "s%[@]MPILIBNAME[@]%@MPILIBNAME@%g" \
	-e "s%[@]OPTFLAGS[@]%@OPTFLAGS@%g" \
	-e "s%[@]INSTPREFIX[@]%$INSTPREFIX%g" \
	-e "s%[@]BUILDPREFIX[@]%$BUILDPREFIX%g" \
	-e "s%[@]PREFIX[@]%$INSTPREFIX%g" \
	-e "s%[@]RSH_COMMAND[@]%$RSH_COMMAND%g" \
	-e "s%[@]SYNCLOC[@]%@SYNCLOC@%g" \
	-e "s%[@]wishloc[@]%@wishloc@%g" \
	-e "s%[@]X_LIB[@]%@X_LIB@%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 "/bin/rm -f $dest" >> $UNINSTALLFILE
        fi
    else
	echo "Fixup $1.in and copy to $dest"
    fi
fi
if [ -z "$3" ] ; then
    mode=$MODE
else
    mode=$3
fi
$Show chmod $mode $2
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
#
##############################################################################
echo "=========="
echo "Installation prefix is: $INSTPREFIX"
echo "Build prefix is: $BUILDPREFIX"
echo "=========="

# Set PREFIX to buildprefix now.

PREFIX=$BUILDPREFIX
APREFIX=$BUILDPREFIX

if [ ! -s lib/$ARCH/$COMM/lib@MPILIBNAME@.a ] ; then 
    echo "You must make MPI before installing it!"
    echo "Could not find lib/$ARCH/$COMM/lib@MPILIBNAME@.a !"
    exit 1
fi
if [ ! -n "$PREFIX" ] ; then 
  echo "Set an installation location with -prefix=<location> ."
  exit 1
fi
echo "Install into $PREFIX on the $ARCH with $COMM"
if [ -d $PREFIX ] ; then
    echo "using existing directory $PREFIX"
else
    MkDir $PREFIX 
fi

MkDir $PREFIX/lib
MkDir $PREFIX/lib/$ARCH
MkDir $PREFIX/lib/$ARCH/$COMM
MkDir $PREFIX/lib/bitmaps
MkDir $PREFIX/util
MkDir $PREFIX/util/machines
MkDir $PREFIX/include
#MkDir $PREFIX/mpid
#MkDir $PREFIX/mpid/$DEVICE
MkDir $PREFIX/examples
MkDir $PREFIX/bin
MkDir $PREFIX/man
MkDir $PREFIX/doc
if [ -z "$libonly" ] ; then
    CopyFile util/tarch $PREFIX/bin $XMODE
    CopyFile util/tdevice $PREFIX/bin $XMODE
    #
    # mpiman
    $Show /bin/rm -f $PREFIX/bin/mpiman
    FixupFile util/mpiman.in $PREFIX/bin/mpiman $XMODE
    CopyFile $PREFIX/bin/mpiman $PREFIX/lib/$ARCH/$COMM $XMODE
    #
    # Upshot and Nupshot
    # Do Upshot/Nupshot early in case there is a problem.
    if [ -z "$nonupshot" ] ; then 
        $Show /bin/rm -f $PREFIX/bin/upshot
        FixupFile profiling/upshot/bin/upshot.in $PREFIX/bin/upshot $XMODE
        #
        # Should clean nupshot sources  (*.c/h) 
        if [ -n "@TCL_DIR@" -a -z "$cpnupshot" -a -n "@TK_DIR@" -a \
	   "@TK_VERSION@" = "3.6" ] ; then 
            echo "Attempting to build nupshot... "
            $Show $CPRP -r profiling/nupshot $PREFIX
	    echo "/bin/rm -rf $PREFIX/nupshot" >> $UNINSTALLFILE
            $Show "(cd $PREFIX/nupshot ; \
	        if configure -tcldir=@TCL_DIR@ -tkdir=@TK_DIR@ ; then \
	        $MAKE clean ; $MAKE ; \
    	        mv nupshot ../bin ; $MAKE clean ; fi )"
	    echo "/bin/rm -f $PREFIX/bin/nupshot" >> $UNINSTALLFILE
	elif [ -n "$cpnupshot" -a -f profiling/nupshot ] ; then 
            $Show $CPRP -r profiling/nupshot $PREFIX
	    echo "/bin/rm -rf $PREFIX/nupshot" >> $UNINSTALLFILE
            $Show "(cd $PREFIX/nupshot ; \
	        mv nupshot ../bin ; $MAKE clean )"
	    echo "/bin/rm -f $PREFIX/bin/nupshot" >> $UNINSTALLFILE
        fi
    fi
    #
    # mpirun et al.  This would be a good place to identify 
    # "partial" mpirun installations
    # mpirun.sh.in requires:
    #     mpirun.args.in
    #     mpirun.<device>.in (some variations are mapped to different
    #                         devices)
    # ch_p4, execer also use
    #     mpirun.pg.in
    for file in util/mpirun.*.in util/tstmachines.in ; do
        bfile=`basename $file .in`
        echo "Creating $PREFIX/bin/$bfile from $file"
        FixupFile $file $PREFIX/bin/$bfile $XMODE
        $Show /bin/rm -f $PREFIX/lib/$ARCH/$COMM/$bfile 
        CopyFile $PREFIX/bin/$bfile $PREFIX/lib/$ARCH/$COMM $XMODE
    done
    $Show mv $PREFIX/bin/mpirun.sh $PREFIX/bin/mpirun
    echo "/bin/rm -f $PREFIX/bin/mpirun" >> $UNINSTALLFILE
    $Show mv $PREFIX/lib/$ARCH/$COMM/mpirun.sh $PREFIX/lib/$ARCH/$COMM/mpirun
    echo "/bin/rm -f $PREFIX/lib/$ARCH/$COMM/mpirun" >> $UNINSTALLFILE
    if [ ! -r $PREFIX/lib/$ARCH/$COMM/tarch ] ; then
	( cd $PREFIX/lib/$ARCH/$COMM ; 	ln -s ../../../bin/tarch tarch )
        echo "/bin/rm -f $PREFIX/lib/$ARCH/$COMM/tarch" >> $UNINSTALLFILE
    fi
    #
    $Show /bin/rm -f $PREFIX/bin/mpireconfig
    echo "Creating mpireconfig from util/mpireconfig.in"
    FixupFile util/mpireconfig.in $PREFIX/bin/mpireconfig $XMODE
    CopyFile $PREFIX/bin/mpireconfig $PREFIX/lib/$ARCH/$COMM $XMODE
    $Show /bin/rm -f $PREFIX/bin/execer
    CopyFile util/execer $PREFIX/bin/execer $XMODE
    #
    # mpicc, mpif77
    FixupFileWithAt util/mpicc.in $PREFIX/bin/mpicc $XMODE
    CopyFile $PREFIX/bin/mpicc $PREFIX/lib/$ARCH/$COMM $XMODE
    FixupFileWithAt util/mpif77.in $PREFIX/bin/mpif77 $XMODE
    CopyFile $PREFIX/bin/mpif77 $PREFIX/lib/$ARCH/$COMM $XMODE
    #
    # mpiCC, if C++ selected
    if [ -n "@CPP_COMPILER@" ] ; then 
	FixupFileWithAt util/mpiCC.in $PREFIX/bin/mpiCC $XMODE
        CopyFile $PREFIX/bin/mpiCC $PREFIX/lib/$ARCH/$COMM $XMODE
    fi
else
    # libonly
    #
    # mpirun et al.
    for file in util/mpirun.*.in util/tstmachines.in ; do
        bfile=`basename $file .in`
        echo "Creating $PREFIX/lib/$ARCH/$COMM/$bfile from $file"
        FixupFile $file $PREFIX/lib/$ARCH/$COMM/$bfile $XMODE
    done
    $Show mv $PREFIX/lib/$ARCH/$COMM/mpirun.sh $PREFIX/lib/$ARCH/$COMM/mpirun
    if [ ! -r $PREFIX/lib/$ARCH/$COMM/tarch ] ; then
	( cd $PREFIX/lib/$ARCH/$COMM ; 	ln -s ../../../bin/tarch tarch )
        echo "/bin/rm -f $PREFIX/lib/$ARCH/$COMM/tarch" >> $UNINSTALLFILE
    fi
    FixupFileWithAt util/mpicc.in $PREFIX/lib/$ARCH/$COMM/mpicc $XMODE
    if [ -n "@CPP_COMPILER@" ] ; then
        FixupFileWithAt util/mpiCC.in $PREFIX/lib/$ARCH/$COMM/mpiCC $XMODE
    fi
    FixupFileWithAt util/mpif77.in $PREFIX/lib/$ARCH/$COMM/mpif77 $XMODE
    FixupFile util/mpireconfig.in $PREFIX/lib/$ARCH/$COMM/mpireconfig $XMODE
fi
#
# 
# P4 server
if [ "$DEVICE" = "ch_p4" ] ; then 
    echo "Attempting to build ch_p4 secure server"
    $Show "( cd mpid/ch_p4/p4-1.4/servers ; make serv_p4 ; )" 
    $Show CopyFile mpid/ch_p4/p4-1.4/bin/serv_p4 $PREFIX/bin $XMODE
    $Show CopyFile $PREFIX/bin/serv_p4 $PREFIX/lib/$ARCH/$COMM $XMODE
    $Show /bin/rm -f util/chp4_servs
    FixupFile util/chp4_servs.in $PREFIX/util/chp4_servs $XMODE
    CopyFile $PREFIX/util/chp4_servs $PREFIX/lib/$ARCH/$COMM $XMODE
    CopyFile util/chkserv $PREFIX/util/chkserv $XMODE
    CopyFile $PREFIX/util/chkserv $PREFIX/lib/$ARCH/$COMM $XMODE
fi
#
# P4 and nexus
if [ "$DEVICE" = "ch_p4" -o "$DEVICE" = "ch_nexus" ] ; then
    if [ -x mpid/server/server ] ; then 
	$Show CopyFile mpid/server/server $PREFIX/bin $XMODE
        $Show CopyFile mpid/server/server $PREFIX/lib/$ARCH/$COMM $XMODE
	$Show /bin/rm -f util/chp4_servs
	FixupFile util/chp4_servs.in $PREFIX/util/chp4_servs $XMODE
	CopyFile $PREFIX/util/chp4_servs $PREFIX/lib/$ARCH/$COMM $XMODE
	CopyFile util/chkserv $PREFIX/util/chkserv $XMODE
	CopyFile $PREFIX/util/chkserv $PREFIX/lib/$ARCH/$COMM $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/* ; do
        $Show CopyFile $file $PREFIX/util/machines
    done
    for file in profiling/upshot/bitmaps/* ; do 
        $Show CopyFile $file $PREFIX/lib/bitmaps
    done
    #
    # Include files
    CopyFile include/mpi.h $PREFIX/include
    CopyFile include/mpi++.h $PREFIX/include
    CopyFile include/mpi++P.h $PREFIX/include
    CopyFile include/mpif.h $PREFIX/include
    CopyFile include/mpi_errno.h $PREFIX/include
    CopyFile include/binding.h $PREFIX/include
    CopyFile include/protofix.h $PREFIX/include
    CopyFile include/mpeexten.h $PREFIX/include
    CopyFile include/patchlevel.h $PREFIX/include
    CopyFile mpe/mpe.h $PREFIX/include
    CopyFile mpe/mpe_graphics.h $PREFIX/include
    CopyFile mpe/mpe_log.h $PREFIX/include
    CopyFile mpe/mpetools.h $PREFIX/include
    CopyFile mpe/basex11.h $PREFIX/include
fi
#
# Libaries
for file in lib/$ARCH/$COMM/*.a ; do
    $Show CopyFileP $file $PREFIX/lib/$ARCH/$COMM
done
#
# Special programs (helper executeables)
# So far we have
#     spxcp - Executable copy program for IBM SP.
for file in spxcp ; do
    if [ -x lib/$ARCH/$COMM/$file ] ; then 
        $Show CopyFileP lib/$ARCH/$COMM/$file $PREFIX/lib/$ARCH/$COMM
    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 lib/$ARCH/mpich.* ; do
        if [ $file = "mpich.cat" ] ; then
	    # This is a link; it assumes that En_US is the default.
            if [ -f lib/$ARCH/mpich.En_US.cat ] ; then 
                $Show ln -s $PREFIX/lib/$ARCH/mpich.En_US.cat \
	   		    $PREFIX/lib/$ARCH/mpich.cat
            fi
        elif [ -s $file ] ; then 
	    # This will handle the case of no mpich.* matches
            $Show CopyFile $file $PREFIX/lib/$ARCH
        fi
    done
fi
    
# Other files in lib need to be updated...
#
# Documentation
# Note that we're not doing the www pages yet.
if [ -z "$noman" -a -z "$libonly" ] ; then 
    if [ -z "$MPIMANPATH" ] ; then
        MPIMANPATH=$PREFIX/man
    fi
    CopyFile man/mandesc $MPIMANPATH
    for dir in man1 man3 man4 man5 ; do
       MkDir $MPIMANPATH/$dir
        for file in man/$dir/* ; do 
	    # man5 in particular might be empty; be careful
            if [ -s "$file" ] ; then 
  	        CopyFile $file $MPIMANPATH/$dir
	    fi
        done
    done
fi
if [ -z "$libonly" ] ; then
    for file in functions.ps.Z guide.ps.Z install.ps.Z ; do
        CopyFile doc/$file $PREFIX/doc
    done
    #$Show $CPRP -r doc $PREFIX
    CopyFile ref/adiman.ps.Z $PREFIX/doc
    CopyFile ref/mpiman.ps.Z $PREFIX/doc
fi
#
# 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
    cat lib/$ARCH/$COMM/config.status | \
	sed -e "s%MPIR_HOME=.*\$%MPIR_HOME='$INSTPREFIX'%g" \
    -e "s%^LIB_PATH=\([^/ ]*\)/[^ ']*%LIB_PATH=\1$INSTPREFIX/lib/$ARCH/$COMM%g" \
    -e "s%^FLIB_PATH=\([^/ ]*\)/[^ ']*%FLIB_PATH=\1$INSTPREFIX/lib/$ARCH/$COMM%g" \
		-e "s%MPE_DIR=.*\$%MPE_DIR='$INSTPREFIX/mpe'%g" \
    -e "s%^MPICC=\([^/ ]*\)/.*\$%MPICC=$INSTPREFIX/lib/$ARCH/$COMM/mpicc%g" \
    -e "s%^MPIF77=\([^/ ]*\)/.*\$%MPIF77=$INSTPREFIX/lib/$ARCH/$COMM/mpif77%g" \
    -e "s%^MPICPLUSPLUS=\([^/ ]*\)/.*\$%MPICPLUSPLUS=$INSTPREFIX/lib/$ARCH/$COMM/mpiCC%g" \
		        > $PREFIX/lib/$ARCH/$COMM/config.status 
    echo "/bin/rm -f $PREFIX/lib/$ARCH/$COMM/config.status" >> $UNINSTALLFILE
    chmod $XMODE $PREFIX/lib/$ARCH/$COMM/config.status 
else 
cat <<.
cat lib/$ARCH/$COMM/config.status | \
	sed -e "s%MPIR_HOME=.*\$%MPIR_HOME='$PREFIX'%g" \
    -e "s%^LIB_PATH=\([^/ ]*\)/[^ ']*%LIB_PATH=\1$PREFIX/lib/$ARCH/$COMM%g" \
    -e "s%^FLIB_PATH=\([^/ ]*\)/[^ ']*%FLIB_PATH=\1$PREFIX/lib/$ARCH/$COMM%g" \
		-e "s%MPE_DIR=.*\$%MPE_DIR='$PREFIX/mpe'%g" \
    -e "s%^MPICC=\([^/ ]*\)/.*\$%MPICC=$PREFIX/lib/$ARCH/$COMM/mpicc%g" \
    -e "s%^MPIF77=\([^/ ]*\)/.*\$%MPIF77=$PREFIX/lib/$ARCH/$COMM/mpif77%g" \
    -e "s%^MPICPLUSPLUS=\([^/ ]*\)/.*\$%MPICPLUSPLUS=$PREFIX/lib/$ARCH/$COMM/mpiCC%g" \
		        > $PREFIX/lib/$ARCH/$COMM/config.status
    chmod $XMODE $PREFIX/lib/$ARCH/$COMM/config.status 
.
fi
if [ -z "$libonly" ] ; then
    $Show CopyFile $PREFIX/lib/$ARCH/$COMM/config.status $PREFIX
    #
    $Show /bin/rm -f $PREFIX/examples/mpif.h
    $Show ln -s $PREFIX/include/mpif.h $PREFIX/examples/mpif.h
    echo "/bin/rm -f $PREFIX/examples/mpif.h" >> $UNINSTALLFILE
fi
#
# Example programs
CopyFile installtest/Makefile.in $PREFIX/examples
#
# This SHOULD use mpireconfig...
Savevar=$PREFIX
PREFIX=$APREFIX
#FixupFile installtest/makefile.proto $PREFIX/examples/Makefile
#(cd $PREFIX/examples ; $PREFIX/lib/$ARCH/$COMM/mpireconfig Makefile )
(SAVE=`pwd`;
   cd $PREFIX/examples ; $SAVE/util/mpireconfig Makefile )
echo "(cd $PREFIX/examples ; $MAKE clean)" >> $UNINSTALLFILE
echo "/bin/rm -f $PREFIX/examples/Makefile" >> $UNINSTALLFILE
PREFIX=$Savevar
CopyFile $PREFIX/examples/Makefile $PREFIX/lib/$ARCH/$COMM/Makefile.sample
CopyFile installtest/cpi.c $PREFIX/examples
CopyFile installtest/pi3.f $PREFIX/examples
CopyFile installtest/cpilog.c $PREFIX/examples
CopyFile installtest/README $PREFIX/examples
#
# Test build the examples
$Show "(cd $PREFIX/examples ; /bin/rm -f mpirun ; \
	  ln -s ../bin/mpirun mpirun )"
echo "/bin/rm -f $PREFIX/examples/mpirun" >> $UNINSTALLFILE
#
echo "About to run installation test..."
$Show "(cd $PREFIX/examples; $MAKE)"
#
# Use the alternate method, using mpif77 and mpicc
$Show "(cd $PREFIX/examples ; $MAKE clean ; $MAKE alternate)"
#
echo "/bin/rm -f $PREFIX/mpiuninstall" >> $UNINSTALLFILE
# Add the directory removes to the UNINSTALL file
for dir in $dirlist ; do
    echo "if [ -d $dir ] ; then rmdir $dir ; fi" >> $UNINSTALLFILE
done
#
cp $UNINSTALLFILE $PREFIX/mpiuninstall
#
echo installed $ARCH/$COMM/$DEVICE MPI in $PREFIX
echo $PREFIX/mpiuninstall may be used to remove the installation.
#
if [ $errs -gt 0 ] ; then
    rc=1
else
    rc=0
fi
exit $rc