File: configure

package info (click to toggle)
pgapack 1.0.0.1-2.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,348 kB
  • ctags: 1,780
  • sloc: ansic: 10,331; fortran: 2,985; sh: 574; makefile: 431; perl: 105
file content (830 lines) | stat: -rwxr-xr-x 25,944 bytes parent folder | download | duplicates (5)
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
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
#!/bin/sh
# This file is configure.
#
# Make all changes to configure.in, if at all possible.  After changing,
# run "autoconf".  If autoconf is not installed, then make changes to
# configure.
#
# Documentation on the autoconf program exists in GNU info file format.
# To read this, run emacs and type C-h i.  Then press the down arrow
# until you come to the line beginning "* Autoconf:".  Pressing enter on
# this line will bring up the documentaition.
#
# Type "configure" (i.e., no arguments) or read below for usage information.
#
print_error() {
    echo "$*" 2>&1 ;
}

print_usage()
{
cat <<.
Usage: configure -arch ARCH_TYPE -cc CC -f77 FC -debug -help
                 -cflags CFLAGS -fflags FFLAGS
                 -mpiinc MPI_INC_DIR -mpilib MPI_LIB
where
   ARCH_TYPE    = the type of machine that PGAPack is to be configured for
   CC           = the name of the ANSI C compiler
   FC           = the name of the FORTRAN 77 compiler
   CFLAGS       = C compiler flags
   FFLAGS       = FORTRAN compiler flags
   MPI_INC_DIR  = the MPI include directory
   MPI_LIB      = the full path to the MPI library


Known architectures are:

Workstations
	sun4		(SUN OS 4.x)
	hpux		(HP UX)
	irix    	(Silicon Graphics IRIX)
	alpha		(DEC Alpha)
	rs6000		(AIX for IBM RS6000)	
	next		(NeXT 680x0)
	freebsd		(PC clones running FreeBSD)
	linux		(PC clones running LINUX)
	generic		(Generic 32-bit UNIX-like machine)

MPP's
	powerchallenge	(Silicon Graphics PowerChallenge)
	challenge	(Silicon Graphics Challenge)
	t3d		(Cray-T3D)
	sp2		(IBM SP2)
	paragon		(Intel Paragon)
	exemplar	(Convex Exemplar)


In the absence of the -f77 or -cc options, configure assumes the name of 
a FORTRAN 77 or ANSI C compiler based on the architecture type.

If the -debug flag is set, then PGAPack will be built for debugging.  This
enables the extensive debugging options and datatype checks.

If both -mpiinc and -mpilib are missing, PGAPack is built using a non-parallel
"stub" library for all MPI calls.

The -help flag causes this usage guide to be printed.

Example 1:
----------
Configure and build for parallel operation on the sun4 architectue.  MPI is
in /usr/local/mpi; the MPI library is /usr/local/mpi/lib/sun4/ch_p4/libmpi.a.

  configure -arch sun4 -mpilib /usr/local/mpi/lib/sun4/ch_p4/libmpi.a \
            -mpiinc /usr/local/mpi/include
  make install

Example 2:
----------
Configure and build a debug sequential library on the rs6000 architecture.

  configure -arch rs6000 -debug
  make install
.
}

###############################################################################
# This section initializes the variables that will be used throughout
# the script.
###############################################################################
#!/bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf.
# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp]
#        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE[=VALUE]]
# Ignores all args except --srcdir, --prefix, --exec-prefix, and
# --with-PACKAGE[=VALUE] unless this script has special code to handle it.

for arg
do
  # Handle --exec-prefix with a space before the argument.
  if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  # Handle --host with a space before the argument.
  elif test x$next_host = xyes; then next_host=
  # Handle --prefix with a space before the argument.
  elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  # Handle --srcdir with a space before the argument.
  elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  else
    case $arg in
     # For backward compatibility, recognize -exec-prefix and --exec_prefix.
     -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
	exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
     -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
	next_exec_prefix=yes ;;

     -gas | --gas | --ga | --g) ;;

     -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
     -host | --host | --hos | --ho | --h)
	next_host=yes ;;

     -nfp | --nfp | --nf) ;;

     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
	prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
     -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
	next_prefix=yes ;;

     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
	srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
	next_srcdir=yes ;;

     -with-* | --with-*)
       package=`echo $arg|sed -e 's/-*with-//' -e 's/=.*//'`
       # Reject names that aren't valid shell variable names.
       if test -n "`echo $package| sed 's/[-a-zA-Z0-9_]//g'`"; then
         echo "configure: $package: invalid package name" >&2; exit 1
       fi
       package=`echo $package| sed 's/-/_/g'`
       case "$arg" in
         *=*) val="`echo $arg|sed 's/[^=]*=//'`" ;;
         *) val=1 ;;
       esac
       eval "with_$package='$val'" ;;

     -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
       verbose=yes ;;

     *) ;;
    esac
  fi
done

trap 'rm -fr conftest* confdefs* core; exit 1' 1 3 15
trap 'rm -f confdefs*' 0

# NLS nuisances.
# These must not be set unconditionally because not all systems understand
# e.g. LANG=C (notably SCO).
if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi
if test "${LANG+set}"   = 'set' ; then LANG=C;   export LANG;   fi

rm -f conftest* confdefs.h
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
echo > confdefs.h
compile='${CC-cc} $CFLAGS conftest.c -o conftest $LIBS >/dev/null 2>&1'

# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
unique_file=source/pga.c

# Find the source files, if location was not specified.
if test -z "$srcdir"; then
  srcdirdefaulted=yes
  # Try the directory containing this script, then `..'.
  prog=$0
  confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  test "X$confdir" = "X$prog" && confdir=.
  srcdir=$confdir
  if test ! -r $srcdir/$unique_file; then
    srcdir=..
  fi
fi
if test ! -r $srcdir/$unique_file; then
  if test x$srcdirdefaulted = xyes; then
    echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  else
    echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  fi
  exit 1
fi
# Preserve a srcdir of `.' to avoid automounter screwups with pwd.
# But we can't avoid them for `..', to make subdirectories work.
case $srcdir in
  .|/*|~*) ;;
  *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
esac


# Save the original args to write them into config.status later.
configure_args="$*"

ARCH=""                         # architecture type
PARALLEL=0                      # parallel libray, or use stub routines?
OPTIMIZE=1                      # optimized?
CPPFLAGS=""                     # flags to send to the C preprocessor
LDFLAGS=""                      # link flags
CFLAGS=""                       # flags to send to the C compiler
FFLAGS=""                       # flags to send to the FORTRAN compiler
PGA_DIR="`pwd`"                 # the root of the pgapack tree
PGA_DIR=`echo $PGA_DIR | sed "s=tmp_mnt/=="`    # get rid of 'tmp_mnt/'
HEADERS="$PGA_DIR/include/pgapack.h" # headers upon which pgapack depends
INCLUDES="-I$PGA_DIR/include"   # directories where to search for include files
LIB_DIRS=""                     # directories where to search for libraries
LIBS=""                         # libraries with which to link
MPI_INC_DIR=""
MPI_LIB=""
SHELL="/usr/bin/sh"
RM="/bin/rm -f"                 # command to force removal of files

OBJS='$(PGA_LIB_DIR)/binary.o        \\\
      $(PGA_LIB_DIR)/char.o          \\\
      $(PGA_LIB_DIR)/cmdline.o       \\\
      $(PGA_LIB_DIR)/create.o        \\\
      $(PGA_LIB_DIR)/cross.o         \\\
      $(PGA_LIB_DIR)/debug.o         \\\
      $(PGA_LIB_DIR)/duplcate.o      \\\
      $(PGA_LIB_DIR)/evaluate.o      \\\
      $(PGA_LIB_DIR)/fitness.o       \\\
      $(PGA_LIB_DIR)/hamming.o       \\\
      $(PGA_LIB_DIR)/heap.o          \\\
      $(PGA_LIB_DIR)/integer.o       \\\
      $(PGA_LIB_DIR)/mutation.o      \\\
      $(PGA_LIB_DIR)/parallel.o      \\\
      $(PGA_LIB_DIR)/pga.o           \\\
      $(PGA_LIB_DIR)/pop.o           \\\
      $(PGA_LIB_DIR)/random.o        \\\
      $(PGA_LIB_DIR)/real.o          \\\
      $(PGA_LIB_DIR)/report.o        \\\
      $(PGA_LIB_DIR)/restart.o       \\\
      $(PGA_LIB_DIR)/select.o        \\\
      $(PGA_LIB_DIR)/stop.o          \\\
      $(PGA_LIB_DIR)/system.o        \\\
      $(PGA_LIB_DIR)/user.o          \\\
      $(PGA_LIB_DIR)/utility.o'      # these are pgapack's object files

###############################################################################
# This section parse the command line options. There a two types of options:
# those that take arguments and those that don't.  Parsing the case where an
# option takes an argument is a little tricky.  This is how it works.  Suppose
# that the program comes upon "-cc".  Then we know that the next argument
# will be the name of the C compiler.  Hence, we set the flag next_cc to be
# equal to "yes".  The next time through the loop, it will be the case that
# x$next_cc equal "xyes" because $next_cc expands to "yes".  Thus, we know that
# this argument is the name of the compiler and we assign it to USR_CC.  Then
# we set next_cc back to a null string.  This way on the next time through
# the loop x$next_cc will equal just "x".  Since the shell initializes
# variables to null strings, we do not have to initialize the "next_" family
# of variables by hand.
###############################################################################
for arg
do
    if test x$next_arch = xyes
        then
            ARCH=$arg
            next_arch=
        elif test x$next_mpiinc = xyes
            then
                MPI_INC_DIR=$arg
                next_mpiinc=
        elif test x$next_mpilib = xyes
            then
                MPI_LIB=$arg
                next_mpilib=
        elif test x$next_f77 = xyes
            then
                USR_FC=$arg
                next_f77=
        elif test x$next_cc = xyes
            then
                USR_CC=$arg
                next_cc=
        elif test x$next_cflags = xyes
            then
                CFLAGS="$arg $CFLAGS"
                next_cflags=
        elif test x$next_fflags = xyes
            then
                FFLAGS="$arg $FFLAGS"
                next_fflags=
        else
            case $arg in
                -arch)
                    next_arch=yes
                    ;;
                -f77)
                    next_f77=yes
                    ;;
                -cc)
                    next_cc=yes
                    ;;
                -mpiinc)
                    next_mpiinc=yes
                    PARALLEL=1
                    ;;
                -mpilib)
                    next_mpilib=yes
                    PARALLEL=1
                    ;;
                -debug)
                    OPTIMIZE=0
                    ;;
                -cflags)
                    next_cflags=yes
                    ;;
                -fflags)
                    next_fflags=yes
                    ;;
                -help)
                    print_usage >& 2
                    exit 1
                    ;;
                *) 
                    ;;
            esac
    fi
done

if test "$MPI_LIB" -a "$MPI_INC_DIR" ; then
    if test ! -d "$MPI_INC_DIR" ; then
        print_error "MPI_INC_DIR == $MPI_INC_DIR is not a valid directory!"
        exit 1
    fi
    if test ! -f "$MPI_INC_DIR/mpi.h" ; then
        print_error "Couldn't find $MPI_INC_DIR/mpi.h!"
        exit 1
    fi

    if test ! -f "$MPI_LIB" ; then
        print_error "MPI_LIB == $MPI_LIB is not a file!"
        exit 1
    fi

    PARALLEL=1
else
    PARALLEL=0
    CPPFLAGS="-DFAKE_MPI $CPPFLAGS"
fi

if test $OPTIMIZE -eq 1 ; then
	CPPFLAGS="-DOPTIMIZE $CPPFLAGS"
	CFLAGS="-O $CFLAGS"
	FFLAGS="-O $FFLAGS"
	PGA_LIB="pgaO"
else
	CFLAGS="-g $CFLAGS"
	FFLAGS="-g $FFLAGS"
	PGA_LIB="pgag"
fi


###############################################################################
# This section sets the default values of certain variables based upon the
# architecture type specified.  If no architecture was specified, the script
# issues an error and aborts.
###############################################################################
if test -z "$ARCH"
    then
        print_error "You must specify the architecture with -arch <value>"
        print_error "Valid architectures are the following:"	
	print_error " Workstations      MPP's"
	print_error "    sun4        powerchallenge"
	print_error "    next        challenge"
	print_error "    rs6000      t3d"
	print_error "    freebsd     sp2"
	print_error "    irix        paragon"
	print_error "    linux       exemplar"
	print_error "    hpux"
	print_error "    alpha"
	print_error "    generic"
	print_error ""
	print_error "For more information type configure -help."
        exit 1
fi

case $ARCH in
    sun4)
        CC=cc
        FC=f77
        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
        ;;
    next)
        CC=cc
        FC=
        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
        ;;
    rs6000)
        CC=cc
        FC=f77
        CPPFLAGS="-DWL=32 $CPPFLAGS"
        ;;
    freebsd)
        CC=cc
        FC=f77
	FFLAGS="-w"
        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
        ;;
    irix)
        CC=cc
        FC=f77
        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
        ;;
    alpha)
        CC=cc
        FC=f77
        CPPFLAGS="-DWL=64 -DFORTRANUNDERSCORE $CPPFLAGS"
        ;;
    hpux)
        CC=cc
        FC=f77
        CPPFLAGS="-DWL=32 $CPPFLAGS"
	SHELL=/bin/sh
        ;;
    linux)
	SHELL="/bin/sh"
        CC=cc
        FC=f77
	FFLAGS="-w"
	LDFLAGS="-s $LDFLAGS"
        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
        ;;
    t3d)
        CC=/mpp/bin/cc
        FC=/mpp/bin/cf77
        CFLAGS="-T cray-t3d"
        FFLAGS="-C cray-t3d -dp"
        CPPFLAGS="-DWL=64 -DFORTRANCAP $CPPFLAGS"
	SHELL=/bin/sh
        ;;
    powerchallenge)
        CC=cc
        FC=f77
	CFLAGS="-mips4 -fullwarn -64"
        CPPFLAGS="-DWL=64 -DFORTRANUNDERSCORE $CPPFLAGS"
        ;;
    challenge)
        CC=cc
        FC=f77
	CFLAGS="-mips2 -fullwarn -32"
        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
        ;;
    paragon)
        CC=cc
        FC=f77
        CFLAGS="-nx $CFLAGS"
        FFLAGS="-nx $FFLAGS"
        CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS"
        ;;
    sp2)
        CC=cc
        FC=f77
        CPPFLAGS="-DWL=32 $CPPFLAGS"
        ;;
    exemplar)
        CC=cc
        FC=fort77
	FFLAGS="-L/usr/lib -lU77 $FFLAGS"
        CPPFLAGS="-DWL=32 $CPPFLAGS"
	SHELL=/bin/sh
        ;;
    *)
	CC=cc
	FC=f77
	CPPFLAGS="-DWL=32 $CPPFLAGS"
	print_error "WARNING:  Configuring for untested architecture.  Using"
        print_error "          word size of 32 bits, cc and f77 as compilers."
	print_error "          You might have trouble with Fortran programs"
        print_error "          not linking correctly.  Check the manual on"
        print_error "          the FORTRANUNDERSCORE #define."
	;;
esac

###############################################################################
# This section sets the variables that do not relate to parallel code.
###############################################################################
CPPFLAGS="-D$ARCH $CPPFLAGS"
PGA_LIB_DIR="../lib/$ARCH"
LIB_DIRS="-L$PGA_DIR/lib/$ARCH $LIB_DIRS"
LIBS="-l$PGA_LIB $LIBS"

#     Set output variable `RANLIB' to `ranlib' if `ranlib' is found,
#     otherwise to `:' (do nothing).
if test -z "$RANLIB"; then
  # Extract the first word of `ranlib', so it can be a program name with args.
  set dummy ranlib; word=$2
  echo checking for $word
  IFS="${IFS= 	}"; saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$word; then
      RANLIB="ranlib"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$RANLIB" && RANLIB=":"
test -n "$RANLIB" && test -n "$verbose" && echo "	setting RANLIB to $RANLIB"


#    "Determine a C compiler to use.  If `CC' is not already set in the
#     environment, check for `gcc', and use `cc' if it's not found.  Set
#     output variable `CC' to the name of the compiler found.
#
#    "If using the GNU C compiler, set shell variable `GCC' to `yes',
#     empty otherwise.  If output variable `CFLAGS' was not already set,
#     set it to `-g -O' for the GNU C compiler (`-O' on systems where
#     GCC does not accept `-g'), or `-g' for other compilers."
if test -n "$USR_CC"
     then
          CC=$USR_CC
     else
          if test -z "$CC"; then
  # Extract the first word of `gcc', so it can be a program name with args.
  set dummy gcc; word=$2
  echo checking for $word
  IFS="${IFS= 	}"; saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$word; then
      CC="gcc"
      break
    fi
  done
  IFS="$saveifs"
fi
test -z "$CC" && CC="cc"
test -n "$CC" && test -n "$verbose" && echo "	setting CC to $CC"

# Find out if we are using GNU C, under whatever name.
cat > conftest.c <<EOF
#ifdef __GNUC__
  yes
#endif
EOF
${CC-cc} -E conftest.c > conftest.out 2>&1
if egrep yes conftest.out >/dev/null 2>&1; then
  GCC=1 # For later tests.
fi
rm -f conftest*

fi

#     Check for each program in the whitespace-separated list
#     PROGS-TO-CHECK-FOR exists in `PATH'.  If it is found, set VARIABLE
#     to the name of that program.  Otherwise, continue checking the
#     next program in the list.  If none of the programs in the list are
#     found, set VARIABLE to VALUE-IF-NOT-FOUND; if VALUE-IF-NOT-FOUND
#     is not specified, the value of VARIABLE is not changed.
if test -n "$USR_FC"
     then
          FC=$USR_FC
     else
          for p in f77 fortran xlf gf77 mpxlf if77
do
if test -z "$FC"; then
  # Extract the first word of `$p', so it can be a program name with args.
  set dummy $p; word=$2
  echo checking for $word
  IFS="${IFS= 	}"; saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    if test -f $dir/$word; then
      FC="$p"
      break
    fi
  done
  IFS="$saveifs"
fi

test -n "$FC" && test -n "$verbose" && echo "	setting FC to $FC"

test -n "$FC" && break
done

fi

# Originally had
#                     OBJS="$OBJS $(PGA_LIB_DIR)/f2c.o"
# However, freebsd bourne shell equates $(var) and `var`.  Hence, I had
# to break the assignment up into two parts.  $FORTWRAP is a Makefile
# dependency line defining how to compile f2c.c
if test -n "$FC"
    then
	TEMP='$(PGA_LIB_DIR)/f2c.o'
        OBJS="$OBJS $TEMP"
        FORTWRAP='$(PGA_LIB_DIR)/f2c.o: f2c.c $(HEADERS)\
	$(COMPILE.c) f2c.c'
fi

if test ! -d lib
    then
        mkdir lib
fi

if test ! -d lib/$ARCH
    then
        mkdir lib/$ARCH
fi

#  Set up symlinks for pgapackf.h to any directories with Fortran source
rm -f ./examples/fortran/pgapackf.h ./examples/mgh/pgapackf.h ./test/pgapackf.h
ln -s ../../include/pgapackf.h ./examples/fortran/pgapackf.h
ln -s ../../include/pgapackf.h ./examples/mgh/pgapackf.h
ln -s ../include/pgapackf.h    ./test/pgapackf.h

#  Use the stub library.
if test $PARALLEL -eq 0
  then
    rm -f ./include/mpi.h ./include/mpif.h ./examples/fortran/mpif.h ./examples/mgh/mpif.h ./test/mpif.h
    ln -s fakempi_h include/mpi.h
    ln -s fakempif_h include/mpif.h
    ln -s ../../include/mpif.h ./examples/fortran/mpif.h
    ln -s ../../include/mpif.h ./examples/mgh/mpif.h
    ln -s ../include/mpif.h ./test/mpif.h
    TEMP='$(PGA_LIB_DIR)/mpi_stub.o'
    OBJS="$OBJS $TEMP"
    MPICOMP='$(PGA_LIB_DIR)/mpi_stub.o: mpi_stub.c $(HEADERS)\
	$(COMPILE.c) mpi_stub.c'
#  The tab above is IMPORTANT!  Needed for make!
else
    rm -f ./include/mpi.h ./include/mpif.h ./examples/fortran/mpif.h ./examples/mgh/mpif.h ./test/mpif.h
    ln -s $MPI_INC_DIR/mpif.h ./examples/fortran/mpif.h
    ln -s $MPI_INC_DIR/mpif.h ./examples/mgh/mpif.h
    ln -s $MPI_INC_DIR/mpif.h ./test/mpif.h
    LIBS="$LIBS $MPI_LIB"
    INCLUDES="$INCLUDES -I$MPI_INC_DIR"
fi

LIBS="$LIBS -lm"
CPPFLAGS="$INCLUDES $CPPFLAGS"
LDFLAGS="$LDFLAGS $LIB_DIRS $LIBS"
###############################################################################
# This section exports the variables that have previously been set.
# Configure creates the Makefiles listed on the last line from the
# Makefile.in in each directory.  It does this by substituting the value
# of $VAR for every occurent of @VAR@ in the Makefile.in.  For
# example, if the characters @CC@ occur any place in a Makefile.in, they
# will be replaced with the value that $CC has when ac_subst(CC) is
# called.
###############################################################################
















# Set default prefixes.
if test -n "$prefix"; then
  test -z "$exec_prefix" && exec_prefix='${prefix}'
  prsub="s%^prefix\\([ 	]*\\)=\\([ 	]*\\).*$%prefix\\1=\\2$prefix%"
fi
if test -n "$exec_prefix"; then
  prsub="$prsub
s%^exec_prefix\\([ 	]*\\)=\\([ 	]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
fi
# Quote sed substitution magic chars in DEFS.
cat >conftest.def <<EOF
$DEFS
EOF
escape_ampersand_and_backslash='s%[&\\]%\\&%g'
DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
rm -f conftest.def
# Substitute for predefined variables.

trap 'rm -f config.status; exit 1' 1 3 15
echo creating config.status
rm -f config.status
cat > config.status <<EOF
#!/bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
#
# $0 $configure_args

for arg
do
  case "\$arg" in
    -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
    echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args
    exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args ;;
    *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  esac
done

trap 'rm -f Makefile source/Makefile test/Makefile test/Makefile \
	  examples/Makefile examples/c/Makefile examples/fortran/Makefile \
	  examples/mgh/Makefile; exit 1' 1 3 15
RANLIB='$RANLIB'
CC='$CC'
FC='$FC'
CFLAGS='$CFLAGS'
FFLAGS='$FFLAGS'
CPPFLAGS='$CPPFLAGS'
FORTWRAP='$FORTWRAP'
HEADERS='$HEADERS'
LDFLAGS='$LDFLAGS'
PARALLEL='$PARALLEL'
PGA_LIB_DIR='$PGA_LIB_DIR'
PGA_LIB='$PGA_LIB'
OBJS='$OBJS'
MPICOMP='$MPICOMP'
RM='$RM'
SHELL='$SHELL'
LIBS='$LIBS'
srcdir='$srcdir'
DEFS='$DEFS'
prefix='$prefix'
exec_prefix='$exec_prefix'
prsub='$prsub'
extrasub='$extrasub'
EOF
cat >> config.status <<\EOF

top_srcdir=$srcdir

CONFIG_FILES=${CONFIG_FILES-"Makefile source/Makefile test/Makefile test/Makefile \
	  examples/Makefile examples/c/Makefile examples/fortran/Makefile \
	  examples/mgh/Makefile"}
for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then
  srcdir=$top_srcdir
  # Remove last slash and all that follows it.  Not all systems have dirname.
  dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  if test "$dir" != "$file"; then
    test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
    test ! -d $dir && mkdir $dir
  fi
  echo creating $file
  rm -f $file
  echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  sed -e "
$prsub
$extrasub
s%@RANLIB@%$RANLIB%g
s%@CC@%$CC%g
s%@FC@%$FC%g
s%@CFLAGS@%$CFLAGS%g
s%@FFLAGS@%$FFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@FORTWRAP@%$FORTWRAP%g
s%@HEADERS@%$HEADERS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@PARALLEL@%$PARALLEL%g
s%@PGA_LIB_DIR@%$PGA_LIB_DIR%g
s%@PGA_LIB@%$PGA_LIB%g
s%@OBJS@%$OBJS%g
s%@MPICOMP@%$MPICOMP%g
s%@RM@%$RM%g
s%@SHELL@%$SHELL%g
s%@LIBS@%$LIBS%g
s%@srcdir@%$srcdir%g
s%@DEFS@%$DEFS%
" $top_srcdir/${file}.in >> $file
fi; done


exit 0
EOF
chmod +x config.status
${CONFIG_SHELL-/bin/sh} config.status


if test ! -f ".pgapack" ; then
  if test $PARALLEL -eq 1 ; then
      OPERATION="parallel"
      ECHO_LIBS="$MPI_LIB"
  else
      OPERATION="sequential"
      ECHO_LIBS="stub routines in mpi_stub.c"
  fi
  if test $OPTIMIZE -eq 1 ; then
      OPERATION="optimized $OPERATION"
  else
      OPERATION="debug $OPERATION"
  fi
  echo " "
  echo "PGAPack has been configured for $OPERATION operation on"
  echo "the $ARCH architecture, using $ECHO_LIBS."
  echo " "
  echo "**********************************************************************"
  echo "*  Please register your copy of PGAPack by sending a mail message    *"
  echo "*  to pgapack@mcs.anl.gov.  This will allow us to notify you of bug  *"
  echo "*  fixes, enhancements, and new releases. The PGAPack homepage is at *"
  echo "*  http://www.mcs.anl.gov/pgapack.html.                              *"
  echo "**********************************************************************"
  echo " "
  echo "Type \"make install\" to install PGAPack."
  echo " "
fi