1 | #!/bin/sh |
---|
2 | # This file is configure. |
---|
3 | # |
---|
4 | # Make all changes to configure.in, if at all possible. After changing, |
---|
5 | # run "autoconf". If autoconf is not installed, then make changes to |
---|
6 | # configure. |
---|
7 | # |
---|
8 | # Documentation on the autoconf program exists in GNU info file format. |
---|
9 | # To read this, run emacs and type C-h i. Then press the down arrow |
---|
10 | # until you come to the line beginning "* Autoconf:". Pressing enter on |
---|
11 | # this line will bring up the documentaition. |
---|
12 | # |
---|
13 | # Type "configure" (i.e., no arguments) or read below for usage information. |
---|
14 | # |
---|
15 | print_error() { |
---|
16 | echo "$*" 2>&1 ; |
---|
17 | } |
---|
18 | |
---|
19 | print_usage() |
---|
20 | { |
---|
21 | cat <<. |
---|
22 | Usage: configure -arch ARCH_TYPE -cc CC -f77 FC -debug -help |
---|
23 | -cflags CFLAGS -fflags FFLAGS |
---|
24 | -mpiinc MPI_INC_DIR -mpilib MPI_LIB |
---|
25 | where |
---|
26 | ARCH_TYPE = the type of machine that PGAPack is to be configured for |
---|
27 | CC = the name of the ANSI C compiler |
---|
28 | FC = the name of the FORTRAN 77 compiler |
---|
29 | CFLAGS = C compiler flags |
---|
30 | FFLAGS = FORTRAN compiler flags |
---|
31 | MPI_INC_DIR = the MPI include directory |
---|
32 | MPI_LIB = the full path to the MPI library |
---|
33 | |
---|
34 | |
---|
35 | Known architectures are: |
---|
36 | |
---|
37 | Workstations |
---|
38 | sun4 (SUN OS 4.x) |
---|
39 | hpux (HP UX) |
---|
40 | irix (Silicon Graphics IRIX) |
---|
41 | alpha (DEC Alpha) |
---|
42 | rs6000 (AIX for IBM RS6000) |
---|
43 | next (NeXT 680x0) |
---|
44 | freebsd (PC clones running FreeBSD) |
---|
45 | linux (PC clones running LINUX) |
---|
46 | generic (Generic 32-bit UNIX-like machine) |
---|
47 | |
---|
48 | MPP's |
---|
49 | powerchallenge (Silicon Graphics PowerChallenge) |
---|
50 | challenge (Silicon Graphics Challenge) |
---|
51 | t3d (Cray-T3D) |
---|
52 | sp2 (IBM SP2) |
---|
53 | paragon (Intel Paragon) |
---|
54 | exemplar (Convex Exemplar) |
---|
55 | |
---|
56 | |
---|
57 | In the absence of the -f77 or -cc options, configure assumes the name of |
---|
58 | a FORTRAN 77 or ANSI C compiler based on the architecture type. |
---|
59 | |
---|
60 | If the -debug flag is set, then PGAPack will be built for debugging. This |
---|
61 | enables the extensive debugging options and datatype checks. |
---|
62 | |
---|
63 | If both -mpiinc and -mpilib are missing, PGAPack is built using a non-parallel |
---|
64 | "stub" library for all MPI calls. |
---|
65 | |
---|
66 | The -help flag causes this usage guide to be printed. |
---|
67 | |
---|
68 | Example 1: |
---|
69 | ---------- |
---|
70 | Configure and build for parallel operation on the sun4 architectue. MPI is |
---|
71 | in /usr/local/mpi; the MPI library is /usr/local/mpi/lib/sun4/ch_p4/libmpi.a. |
---|
72 | |
---|
73 | configure -arch sun4 -mpilib /usr/local/mpi/lib/sun4/ch_p4/libmpi.a \ |
---|
74 | -mpiinc /usr/local/mpi/include |
---|
75 | make install |
---|
76 | |
---|
77 | Example 2: |
---|
78 | ---------- |
---|
79 | Configure and build a debug sequential library on the rs6000 architecture. |
---|
80 | |
---|
81 | configure -arch rs6000 -debug |
---|
82 | make install |
---|
83 | . |
---|
84 | } |
---|
85 | |
---|
86 | ############################################################################### |
---|
87 | # This section initializes the variables that will be used throughout |
---|
88 | # the script. |
---|
89 | ############################################################################### |
---|
90 | #!/bin/sh |
---|
91 | # Guess values for system-dependent variables and create Makefiles. |
---|
92 | # Generated automatically using autoconf. |
---|
93 | # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. |
---|
94 | |
---|
95 | # This program is free software; you can redistribute it and/or modify |
---|
96 | # it under the terms of the GNU General Public License as published by |
---|
97 | # the Free Software Foundation; either version 2, or (at your option) |
---|
98 | # any later version. |
---|
99 | |
---|
100 | # This program is distributed in the hope that it will be useful, |
---|
101 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
102 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
103 | # GNU General Public License for more details. |
---|
104 | |
---|
105 | # You should have received a copy of the GNU General Public License |
---|
106 | # along with this program; if not, write to the Free Software |
---|
107 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
108 | |
---|
109 | # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] |
---|
110 | # [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE[=VALUE]] |
---|
111 | # Ignores all args except --srcdir, --prefix, --exec-prefix, and |
---|
112 | # --with-PACKAGE[=VALUE] unless this script has special code to handle it. |
---|
113 | |
---|
114 | for arg |
---|
115 | do |
---|
116 | # Handle --exec-prefix with a space before the argument. |
---|
117 | if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix= |
---|
118 | # Handle --host with a space before the argument. |
---|
119 | elif test x$next_host = xyes; then next_host= |
---|
120 | # Handle --prefix with a space before the argument. |
---|
121 | elif test x$next_prefix = xyes; then prefix=$arg; next_prefix= |
---|
122 | # Handle --srcdir with a space before the argument. |
---|
123 | elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir= |
---|
124 | else |
---|
125 | case $arg in |
---|
126 | # For backward compatibility, recognize -exec-prefix and --exec_prefix. |
---|
127 | -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*) |
---|
128 | exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;; |
---|
129 | -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e) |
---|
130 | next_exec_prefix=yes ;; |
---|
131 | |
---|
132 | -gas | --gas | --ga | --g) ;; |
---|
133 | |
---|
134 | -host=* | --host=* | --hos=* | --ho=* | --h=*) ;; |
---|
135 | -host | --host | --hos | --ho | --h) |
---|
136 | next_host=yes ;; |
---|
137 | |
---|
138 | -nfp | --nfp | --nf) ;; |
---|
139 | |
---|
140 | -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) |
---|
141 | prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;; |
---|
142 | -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) |
---|
143 | next_prefix=yes ;; |
---|
144 | |
---|
145 | -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*) |
---|
146 | srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;; |
---|
147 | -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s) |
---|
148 | next_srcdir=yes ;; |
---|
149 | |
---|
150 | -with-* | --with-*) |
---|
151 | package=`echo $arg|sed -e 's/-*with-//' -e 's/=.*//'` |
---|
152 | # Reject names that aren't valid shell variable names. |
---|
153 | if test -n "`echo $package| sed 's/[-a-zA-Z0-9_]//g'`"; then |
---|
154 | echo "configure: $package: invalid package name" >&2; exit 1 |
---|
155 | fi |
---|
156 | package=`echo $package| sed 's/-/_/g'` |
---|
157 | case "$arg" in |
---|
158 | *=*) val="`echo $arg|sed 's/[^=]*=//'`" ;; |
---|
159 | *) val=1 ;; |
---|
160 | esac |
---|
161 | eval "with_$package='$val'" ;; |
---|
162 | |
---|
163 | -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v) |
---|
164 | verbose=yes ;; |
---|
165 | |
---|
166 | *) ;; |
---|
167 | esac |
---|
168 | fi |
---|
169 | done |
---|
170 | |
---|
171 | trap 'rm -fr conftest* confdefs* core; exit 1' 1 3 15 |
---|
172 | trap 'rm -f confdefs*' 0 |
---|
173 | |
---|
174 | # NLS nuisances. |
---|
175 | # These must not be set unconditionally because not all systems understand |
---|
176 | # e.g. LANG=C (notably SCO). |
---|
177 | if test "${LC_ALL+set}" = 'set' ; then LC_ALL=C; export LC_ALL; fi |
---|
178 | if test "${LANG+set}" = 'set' ; then LANG=C; export LANG; fi |
---|
179 | |
---|
180 | rm -f conftest* confdefs.h |
---|
181 | # AIX cpp loses on an empty file, so make sure it contains at least a newline. |
---|
182 | echo > confdefs.h |
---|
183 | compile='${CC-cc} $CFLAGS conftest.c -o conftest $LIBS >/dev/null 2>&1' |
---|
184 | |
---|
185 | # A filename unique to this package, relative to the directory that |
---|
186 | # configure is in, which we can look for to find out if srcdir is correct. |
---|
187 | unique_file=source/pga.c |
---|
188 | |
---|
189 | # Find the source files, if location was not specified. |
---|
190 | if test -z "$srcdir"; then |
---|
191 | srcdirdefaulted=yes |
---|
192 | # Try the directory containing this script, then `..'. |
---|
193 | prog=$0 |
---|
194 | confdir=`echo $prog|sed 's%/[^/][^/]*$%%'` |
---|
195 | test "X$confdir" = "X$prog" && confdir=. |
---|
196 | srcdir=$confdir |
---|
197 | if test ! -r $srcdir/$unique_file; then |
---|
198 | srcdir=.. |
---|
199 | fi |
---|
200 | fi |
---|
201 | if test ! -r $srcdir/$unique_file; then |
---|
202 | if test x$srcdirdefaulted = xyes; then |
---|
203 | echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2 |
---|
204 | else |
---|
205 | echo "configure: Can not find sources in \`${srcdir}'." 1>&2 |
---|
206 | fi |
---|
207 | exit 1 |
---|
208 | fi |
---|
209 | # Preserve a srcdir of `.' to avoid automounter screwups with pwd. |
---|
210 | # But we can't avoid them for `..', to make subdirectories work. |
---|
211 | case $srcdir in |
---|
212 | .|/*|~*) ;; |
---|
213 | *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute. |
---|
214 | esac |
---|
215 | |
---|
216 | |
---|
217 | # Save the original args to write them into config.status later. |
---|
218 | configure_args="$*" |
---|
219 | |
---|
220 | ARCH="" # architecture type |
---|
221 | PARALLEL=0 # parallel libray, or use stub routines? |
---|
222 | OPTIMIZE=1 # optimized? |
---|
223 | CPPFLAGS="" # flags to send to the C preprocessor |
---|
224 | LDFLAGS="" # link flags |
---|
225 | CFLAGS="" # flags to send to the C compiler |
---|
226 | FFLAGS="" # flags to send to the FORTRAN compiler |
---|
227 | PGA_DIR="`pwd`" # the root of the pgapack tree |
---|
228 | PGA_DIR=`echo $PGA_DIR | sed "s=tmp_mnt/=="` # get rid of 'tmp_mnt/' |
---|
229 | HEADERS="$PGA_DIR/include/pgapack.h" # headers upon which pgapack depends |
---|
230 | INCLUDES="-I$PGA_DIR/include" # directories where to search for include files |
---|
231 | LIB_DIRS="" # directories where to search for libraries |
---|
232 | LIBS="" # libraries with which to link |
---|
233 | MPI_INC_DIR="" |
---|
234 | MPI_LIB="" |
---|
235 | SHELL="/usr/bin/sh" |
---|
236 | RM="/bin/rm -f" # command to force removal of files |
---|
237 | |
---|
238 | OBJS='$(PGA_LIB_DIR)/binary.o \\\ |
---|
239 | $(PGA_LIB_DIR)/char.o \\\ |
---|
240 | $(PGA_LIB_DIR)/cmdline.o \\\ |
---|
241 | $(PGA_LIB_DIR)/create.o \\\ |
---|
242 | $(PGA_LIB_DIR)/cross.o \\\ |
---|
243 | $(PGA_LIB_DIR)/debug.o \\\ |
---|
244 | $(PGA_LIB_DIR)/duplcate.o \\\ |
---|
245 | $(PGA_LIB_DIR)/evaluate.o \\\ |
---|
246 | $(PGA_LIB_DIR)/fitness.o \\\ |
---|
247 | $(PGA_LIB_DIR)/hamming.o \\\ |
---|
248 | $(PGA_LIB_DIR)/heap.o \\\ |
---|
249 | $(PGA_LIB_DIR)/integer.o \\\ |
---|
250 | $(PGA_LIB_DIR)/mutation.o \\\ |
---|
251 | $(PGA_LIB_DIR)/parallel.o \\\ |
---|
252 | $(PGA_LIB_DIR)/pga.o \\\ |
---|
253 | $(PGA_LIB_DIR)/pop.o \\\ |
---|
254 | $(PGA_LIB_DIR)/random.o \\\ |
---|
255 | $(PGA_LIB_DIR)/real.o \\\ |
---|
256 | $(PGA_LIB_DIR)/report.o \\\ |
---|
257 | $(PGA_LIB_DIR)/restart.o \\\ |
---|
258 | $(PGA_LIB_DIR)/select.o \\\ |
---|
259 | $(PGA_LIB_DIR)/stop.o \\\ |
---|
260 | $(PGA_LIB_DIR)/system.o \\\ |
---|
261 | $(PGA_LIB_DIR)/user.o \\\ |
---|
262 | $(PGA_LIB_DIR)/utility.o' # these are pgapack's object files |
---|
263 | |
---|
264 | ############################################################################### |
---|
265 | # This section parse the command line options. There a two types of options: |
---|
266 | # those that take arguments and those that don't. Parsing the case where an |
---|
267 | # option takes an argument is a little tricky. This is how it works. Suppose |
---|
268 | # that the program comes upon "-cc". Then we know that the next argument |
---|
269 | # will be the name of the C compiler. Hence, we set the flag next_cc to be |
---|
270 | # equal to "yes". The next time through the loop, it will be the case that |
---|
271 | # x$next_cc equal "xyes" because $next_cc expands to "yes". Thus, we know that |
---|
272 | # this argument is the name of the compiler and we assign it to USR_CC. Then |
---|
273 | # we set next_cc back to a null string. This way on the next time through |
---|
274 | # the loop x$next_cc will equal just "x". Since the shell initializes |
---|
275 | # variables to null strings, we do not have to initialize the "next_" family |
---|
276 | # of variables by hand. |
---|
277 | ############################################################################### |
---|
278 | for arg |
---|
279 | do |
---|
280 | if test x$next_arch = xyes |
---|
281 | then |
---|
282 | ARCH=$arg |
---|
283 | next_arch= |
---|
284 | elif test x$next_mpiinc = xyes |
---|
285 | then |
---|
286 | MPI_INC_DIR=$arg |
---|
287 | next_mpiinc= |
---|
288 | elif test x$next_mpilib = xyes |
---|
289 | then |
---|
290 | MPI_LIB=$arg |
---|
291 | next_mpilib= |
---|
292 | elif test x$next_f77 = xyes |
---|
293 | then |
---|
294 | USR_FC=$arg |
---|
295 | next_f77= |
---|
296 | elif test x$next_cc = xyes |
---|
297 | then |
---|
298 | USR_CC=$arg |
---|
299 | next_cc= |
---|
300 | elif test x$next_cflags = xyes |
---|
301 | then |
---|
302 | CFLAGS="$arg $CFLAGS" |
---|
303 | next_cflags= |
---|
304 | elif test x$next_fflags = xyes |
---|
305 | then |
---|
306 | FFLAGS="$arg $FFLAGS" |
---|
307 | next_fflags= |
---|
308 | else |
---|
309 | case $arg in |
---|
310 | -arch) |
---|
311 | next_arch=yes |
---|
312 | ;; |
---|
313 | -f77) |
---|
314 | next_f77=yes |
---|
315 | ;; |
---|
316 | -cc) |
---|
317 | next_cc=yes |
---|
318 | ;; |
---|
319 | -mpiinc) |
---|
320 | next_mpiinc=yes |
---|
321 | PARALLEL=1 |
---|
322 | ;; |
---|
323 | -mpilib) |
---|
324 | next_mpilib=yes |
---|
325 | PARALLEL=1 |
---|
326 | ;; |
---|
327 | -debug) |
---|
328 | OPTIMIZE=0 |
---|
329 | ;; |
---|
330 | -cflags) |
---|
331 | next_cflags=yes |
---|
332 | ;; |
---|
333 | -fflags) |
---|
334 | next_fflags=yes |
---|
335 | ;; |
---|
336 | -help) |
---|
337 | print_usage >& 2 |
---|
338 | exit 1 |
---|
339 | ;; |
---|
340 | *) |
---|
341 | ;; |
---|
342 | esac |
---|
343 | fi |
---|
344 | done |
---|
345 | |
---|
346 | if test "$MPI_LIB" -a "$MPI_INC_DIR" ; then |
---|
347 | if test ! -d "$MPI_INC_DIR" ; then |
---|
348 | print_error "MPI_INC_DIR == $MPI_INC_DIR is not a valid directory!" |
---|
349 | exit 1 |
---|
350 | fi |
---|
351 | if test ! -f "$MPI_INC_DIR/mpi.h" ; then |
---|
352 | print_error "Couldn't find $MPI_INC_DIR/mpi.h!" |
---|
353 | exit 1 |
---|
354 | fi |
---|
355 | |
---|
356 | if test ! -f "$MPI_LIB" ; then |
---|
357 | print_error "MPI_LIB == $MPI_LIB is not a file!" |
---|
358 | exit 1 |
---|
359 | fi |
---|
360 | |
---|
361 | PARALLEL=1 |
---|
362 | else |
---|
363 | PARALLEL=0 |
---|
364 | CPPFLAGS="-DFAKE_MPI $CPPFLAGS" |
---|
365 | fi |
---|
366 | |
---|
367 | if test $OPTIMIZE -eq 1 ; then |
---|
368 | CPPFLAGS="-DOPTIMIZE $CPPFLAGS" |
---|
369 | CFLAGS="-O $CFLAGS" |
---|
370 | FFLAGS="-O $FFLAGS" |
---|
371 | PGA_LIB="pgaO" |
---|
372 | else |
---|
373 | CFLAGS="-g $CFLAGS" |
---|
374 | FFLAGS="-g $FFLAGS" |
---|
375 | PGA_LIB="pgag" |
---|
376 | fi |
---|
377 | |
---|
378 | |
---|
379 | ############################################################################### |
---|
380 | # This section sets the default values of certain variables based upon the |
---|
381 | # architecture type specified. If no architecture was specified, the script |
---|
382 | # issues an error and aborts. |
---|
383 | ############################################################################### |
---|
384 | if test -z "$ARCH" |
---|
385 | then |
---|
386 | print_error "You must specify the architecture with -arch <value>" |
---|
387 | print_error "Valid architectures are the following:" |
---|
388 | print_error " Workstations MPP's" |
---|
389 | print_error " sun4 powerchallenge" |
---|
390 | print_error " next challenge" |
---|
391 | print_error " rs6000 t3d" |
---|
392 | print_error " freebsd sp2" |
---|
393 | print_error " irix paragon" |
---|
394 | print_error " linux exemplar" |
---|
395 | print_error " hpux" |
---|
396 | print_error " alpha" |
---|
397 | print_error " generic" |
---|
398 | print_error "" |
---|
399 | print_error "For more information type configure -help." |
---|
400 | exit 1 |
---|
401 | fi |
---|
402 | |
---|
403 | case $ARCH in |
---|
404 | sun4) |
---|
405 | CC=cc |
---|
406 | FC=f77 |
---|
407 | CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS" |
---|
408 | ;; |
---|
409 | next) |
---|
410 | CC=cc |
---|
411 | FC= |
---|
412 | CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS" |
---|
413 | ;; |
---|
414 | rs6000) |
---|
415 | CC=cc |
---|
416 | FC=f77 |
---|
417 | CPPFLAGS="-DWL=32 $CPPFLAGS" |
---|
418 | ;; |
---|
419 | freebsd) |
---|
420 | CC=cc |
---|
421 | FC=f77 |
---|
422 | FFLAGS="-w" |
---|
423 | CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS" |
---|
424 | ;; |
---|
425 | irix) |
---|
426 | CC=cc |
---|
427 | FC=f77 |
---|
428 | CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS" |
---|
429 | ;; |
---|
430 | alpha) |
---|
431 | CC=cc |
---|
432 | FC=f77 |
---|
433 | CPPFLAGS="-DWL=64 -DFORTRANUNDERSCORE $CPPFLAGS" |
---|
434 | ;; |
---|
435 | hpux) |
---|
436 | CC=cc |
---|
437 | FC=f77 |
---|
438 | CPPFLAGS="-DWL=32 $CPPFLAGS" |
---|
439 | SHELL=/bin/sh |
---|
440 | ;; |
---|
441 | linux) |
---|
442 | SHELL="/bin/sh" |
---|
443 | CC=cc |
---|
444 | FC=f77 |
---|
445 | FFLAGS="-w" |
---|
446 | LDFLAGS="-s $LDFLAGS" |
---|
447 | CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS" |
---|
448 | ;; |
---|
449 | t3d) |
---|
450 | CC=/mpp/bin/cc |
---|
451 | FC=/mpp/bin/cf77 |
---|
452 | CFLAGS="-T cray-t3d" |
---|
453 | FFLAGS="-C cray-t3d -dp" |
---|
454 | CPPFLAGS="-DWL=64 -DFORTRANCAP $CPPFLAGS" |
---|
455 | SHELL=/bin/sh |
---|
456 | ;; |
---|
457 | powerchallenge) |
---|
458 | CC=cc |
---|
459 | FC=f77 |
---|
460 | CFLAGS="-mips4 -fullwarn -64" |
---|
461 | CPPFLAGS="-DWL=64 -DFORTRANUNDERSCORE $CPPFLAGS" |
---|
462 | ;; |
---|
463 | challenge) |
---|
464 | CC=cc |
---|
465 | FC=f77 |
---|
466 | CFLAGS="-mips2 -fullwarn -32" |
---|
467 | CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS" |
---|
468 | ;; |
---|
469 | paragon) |
---|
470 | CC=cc |
---|
471 | FC=f77 |
---|
472 | CFLAGS="-nx $CFLAGS" |
---|
473 | FFLAGS="-nx $FFLAGS" |
---|
474 | CPPFLAGS="-DWL=32 -DFORTRANUNDERSCORE $CPPFLAGS" |
---|
475 | ;; |
---|
476 | sp2) |
---|
477 | CC=cc |
---|
478 | FC=f77 |
---|
479 | CPPFLAGS="-DWL=32 $CPPFLAGS" |
---|
480 | ;; |
---|
481 | exemplar) |
---|
482 | CC=cc |
---|
483 | FC=fort77 |
---|
484 | FFLAGS="-L/usr/lib -lU77 $FFLAGS" |
---|
485 | CPPFLAGS="-DWL=32 $CPPFLAGS" |
---|
486 | SHELL=/bin/sh |
---|
487 | ;; |
---|
488 | *) |
---|
489 | CC=cc |
---|
490 | FC=f77 |
---|
491 | CPPFLAGS="-DWL=32 $CPPFLAGS" |
---|
492 | print_error "WARNING: Configuring for untested architecture. Using" |
---|
493 | print_error " word size of 32 bits, cc and f77 as compilers." |
---|
494 | print_error " You might have trouble with Fortran programs" |
---|
495 | print_error " not linking correctly. Check the manual on" |
---|
496 | print_error " the FORTRANUNDERSCORE #define." |
---|
497 | ;; |
---|
498 | esac |
---|
499 | |
---|
500 | ############################################################################### |
---|
501 | # This section sets the variables that do not relate to parallel code. |
---|
502 | ############################################################################### |
---|
503 | CPPFLAGS="-D$ARCH $CPPFLAGS" |
---|
504 | PGA_LIB_DIR="../lib/$ARCH" |
---|
505 | LIB_DIRS="-L$PGA_DIR/lib/$ARCH $LIB_DIRS" |
---|
506 | LIBS="-l$PGA_LIB $LIBS" |
---|
507 | |
---|
508 | # Set output variable `RANLIB' to `ranlib' if `ranlib' is found, |
---|
509 | # otherwise to `:' (do nothing). |
---|
510 | if test -z "$RANLIB"; then |
---|
511 | # Extract the first word of `ranlib', so it can be a program name with args. |
---|
512 | set dummy ranlib; word=$2 |
---|
513 | echo checking for $word |
---|
514 | IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" |
---|
515 | for dir in $PATH; do |
---|
516 | test -z "$dir" && dir=. |
---|
517 | if test -f $dir/$word; then |
---|
518 | RANLIB="ranlib" |
---|
519 | break |
---|
520 | fi |
---|
521 | done |
---|
522 | IFS="$saveifs" |
---|
523 | fi |
---|
524 | test -z "$RANLIB" && RANLIB=":" |
---|
525 | test -n "$RANLIB" && test -n "$verbose" && echo " setting RANLIB to $RANLIB" |
---|
526 | |
---|
527 | |
---|
528 | # "Determine a C compiler to use. If `CC' is not already set in the |
---|
529 | # environment, check for `gcc', and use `cc' if it's not found. Set |
---|
530 | # output variable `CC' to the name of the compiler found. |
---|
531 | # |
---|
532 | # "If using the GNU C compiler, set shell variable `GCC' to `yes', |
---|
533 | # empty otherwise. If output variable `CFLAGS' was not already set, |
---|
534 | # set it to `-g -O' for the GNU C compiler (`-O' on systems where |
---|
535 | # GCC does not accept `-g'), or `-g' for other compilers." |
---|
536 | if test -n "$USR_CC" |
---|
537 | then |
---|
538 | CC=$USR_CC |
---|
539 | else |
---|
540 | if test -z "$CC"; then |
---|
541 | # Extract the first word of `gcc', so it can be a program name with args. |
---|
542 | set dummy gcc; word=$2 |
---|
543 | echo checking for $word |
---|
544 | IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" |
---|
545 | for dir in $PATH; do |
---|
546 | test -z "$dir" && dir=. |
---|
547 | if test -f $dir/$word; then |
---|
548 | CC="gcc" |
---|
549 | break |
---|
550 | fi |
---|
551 | done |
---|
552 | IFS="$saveifs" |
---|
553 | fi |
---|
554 | test -z "$CC" && CC="cc" |
---|
555 | test -n "$CC" && test -n "$verbose" && echo " setting CC to $CC" |
---|
556 | |
---|
557 | # Find out if we are using GNU C, under whatever name. |
---|
558 | cat > conftest.c <<EOF |
---|
559 | #ifdef __GNUC__ |
---|
560 | yes |
---|
561 | #endif |
---|
562 | EOF |
---|
563 | ${CC-cc} -E conftest.c > conftest.out 2>&1 |
---|
564 | if egrep yes conftest.out >/dev/null 2>&1; then |
---|
565 | GCC=1 # For later tests. |
---|
566 | fi |
---|
567 | rm -f conftest* |
---|
568 | |
---|
569 | fi |
---|
570 | |
---|
571 | # Check for each program in the whitespace-separated list |
---|
572 | # PROGS-TO-CHECK-FOR exists in `PATH'. If it is found, set VARIABLE |
---|
573 | # to the name of that program. Otherwise, continue checking the |
---|
574 | # next program in the list. If none of the programs in the list are |
---|
575 | # found, set VARIABLE to VALUE-IF-NOT-FOUND; if VALUE-IF-NOT-FOUND |
---|
576 | # is not specified, the value of VARIABLE is not changed. |
---|
577 | if test -n "$USR_FC" |
---|
578 | then |
---|
579 | FC=$USR_FC |
---|
580 | else |
---|
581 | for p in f77 fortran xlf gf77 mpxlf if77 |
---|
582 | do |
---|
583 | if test -z "$FC"; then |
---|
584 | # Extract the first word of `$p', so it can be a program name with args. |
---|
585 | set dummy $p; word=$2 |
---|
586 | echo checking for $word |
---|
587 | IFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:" |
---|
588 | for dir in $PATH; do |
---|
589 | test -z "$dir" && dir=. |
---|
590 | if test -f $dir/$word; then |
---|
591 | FC="$p" |
---|
592 | break |
---|
593 | fi |
---|
594 | done |
---|
595 | IFS="$saveifs" |
---|
596 | fi |
---|
597 | |
---|
598 | test -n "$FC" && test -n "$verbose" && echo " setting FC to $FC" |
---|
599 | |
---|
600 | test -n "$FC" && break |
---|
601 | done |
---|
602 | |
---|
603 | fi |
---|
604 | |
---|
605 | # Originally had |
---|
606 | # OBJS="$OBJS $(PGA_LIB_DIR)/f2c.o" |
---|
607 | # However, freebsd bourne shell equates $(var) and `var`. Hence, I had |
---|
608 | # to break the assignment up into two parts. $FORTWRAP is a Makefile |
---|
609 | # dependency line defining how to compile f2c.c |
---|
610 | if test -n "$FC" |
---|
611 | then |
---|
612 | TEMP='$(PGA_LIB_DIR)/f2c.o' |
---|
613 | OBJS="$OBJS $TEMP" |
---|
614 | FORTWRAP='$(PGA_LIB_DIR)/f2c.o: f2c.c $(HEADERS)\ |
---|
615 | $(COMPILE.c) f2c.c' |
---|
616 | fi |
---|
617 | |
---|
618 | if test ! -d lib |
---|
619 | then |
---|
620 | mkdir lib |
---|
621 | fi |
---|
622 | |
---|
623 | if test ! -d lib/$ARCH |
---|
624 | then |
---|
625 | mkdir lib/$ARCH |
---|
626 | fi |
---|
627 | |
---|
628 | # Set up symlinks for pgapackf.h to any directories with Fortran source |
---|
629 | rm -f ./examples/fortran/pgapackf.h ./examples/mgh/pgapackf.h ./test/pgapackf.h |
---|
630 | ln -s ../../include/pgapackf.h ./examples/fortran/pgapackf.h |
---|
631 | ln -s ../../include/pgapackf.h ./examples/mgh/pgapackf.h |
---|
632 | ln -s ../include/pgapackf.h ./test/pgapackf.h |
---|
633 | |
---|
634 | # Use the stub library. |
---|
635 | if test $PARALLEL -eq 0 |
---|
636 | then |
---|
637 | rm -f ./include/mpi.h ./include/mpif.h ./examples/fortran/mpif.h ./examples/mgh/mpif.h ./test/mpif.h |
---|
638 | ln -s fakempi_h include/mpi.h |
---|
639 | ln -s fakempif_h include/mpif.h |
---|
640 | ln -s ../../include/mpif.h ./examples/fortran/mpif.h |
---|
641 | ln -s ../../include/mpif.h ./examples/mgh/mpif.h |
---|
642 | ln -s ../include/mpif.h ./test/mpif.h |
---|
643 | TEMP='$(PGA_LIB_DIR)/mpi_stub.o' |
---|
644 | OBJS="$OBJS $TEMP" |
---|
645 | MPICOMP='$(PGA_LIB_DIR)/mpi_stub.o: mpi_stub.c $(HEADERS)\ |
---|
646 | $(COMPILE.c) mpi_stub.c' |
---|
647 | # The tab above is IMPORTANT! Needed for make! |
---|
648 | else |
---|
649 | rm -f ./include/mpi.h ./include/mpif.h ./examples/fortran/mpif.h ./examples/mgh/mpif.h ./test/mpif.h |
---|
650 | ln -s $MPI_INC_DIR/mpif.h ./examples/fortran/mpif.h |
---|
651 | ln -s $MPI_INC_DIR/mpif.h ./examples/mgh/mpif.h |
---|
652 | ln -s $MPI_INC_DIR/mpif.h ./test/mpif.h |
---|
653 | LIBS="$LIBS $MPI_LIB" |
---|
654 | INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
---|
655 | fi |
---|
656 | |
---|
657 | LIBS="$LIBS -lm" |
---|
658 | CPPFLAGS="$INCLUDES $CPPFLAGS" |
---|
659 | LDFLAGS="$LDFLAGS $LIB_DIRS $LIBS" |
---|
660 | ############################################################################### |
---|
661 | # This section exports the variables that have previously been set. |
---|
662 | # Configure creates the Makefiles listed on the last line from the |
---|
663 | # Makefile.in in each directory. It does this by substituting the value |
---|
664 | # of $VAR for every occurent of @VAR@ in the Makefile.in. For |
---|
665 | # example, if the characters @CC@ occur any place in a Makefile.in, they |
---|
666 | # will be replaced with the value that $CC has when ac_subst(CC) is |
---|
667 | # called. |
---|
668 | ############################################################################### |
---|
669 | |
---|
670 | |
---|
671 | |
---|
672 | |
---|
673 | |
---|
674 | |
---|
675 | |
---|
676 | |
---|
677 | |
---|
678 | |
---|
679 | |
---|
680 | |
---|
681 | |
---|
682 | |
---|
683 | |
---|
684 | |
---|
685 | # Set default prefixes. |
---|
686 | if test -n "$prefix"; then |
---|
687 | test -z "$exec_prefix" && exec_prefix='${prefix}' |
---|
688 | prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%" |
---|
689 | fi |
---|
690 | if test -n "$exec_prefix"; then |
---|
691 | prsub="$prsub |
---|
692 | s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%" |
---|
693 | fi |
---|
694 | # Quote sed substitution magic chars in DEFS. |
---|
695 | cat >conftest.def <<EOF |
---|
696 | $DEFS |
---|
697 | EOF |
---|
698 | escape_ampersand_and_backslash='s%[&\\]%\\&%g' |
---|
699 | DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def` |
---|
700 | rm -f conftest.def |
---|
701 | # Substitute for predefined variables. |
---|
702 | |
---|
703 | trap 'rm -f config.status; exit 1' 1 3 15 |
---|
704 | echo creating config.status |
---|
705 | rm -f config.status |
---|
706 | cat > config.status <<EOF |
---|
707 | #!/bin/sh |
---|
708 | # Generated automatically by configure. |
---|
709 | # Run this file to recreate the current configuration. |
---|
710 | # This directory was configured as follows, |
---|
711 | # on host `(hostname || uname -n) 2>/dev/null | sed 1q`: |
---|
712 | # |
---|
713 | # $0 $configure_args |
---|
714 | |
---|
715 | for arg |
---|
716 | do |
---|
717 | case "\$arg" in |
---|
718 | -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) |
---|
719 | echo running \${CONFIG_SHELL-/bin/sh} $0 $configure_args |
---|
720 | exec \${CONFIG_SHELL-/bin/sh} $0 $configure_args ;; |
---|
721 | *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;; |
---|
722 | esac |
---|
723 | done |
---|
724 | |
---|
725 | trap 'rm -f Makefile source/Makefile test/Makefile test/Makefile \ |
---|
726 | examples/Makefile examples/c/Makefile examples/fortran/Makefile \ |
---|
727 | examples/mgh/Makefile; exit 1' 1 3 15 |
---|
728 | RANLIB='$RANLIB' |
---|
729 | CC='$CC' |
---|
730 | FC='$FC' |
---|
731 | CFLAGS='$CFLAGS' |
---|
732 | FFLAGS='$FFLAGS' |
---|
733 | CPPFLAGS='$CPPFLAGS' |
---|
734 | FORTWRAP='$FORTWRAP' |
---|
735 | HEADERS='$HEADERS' |
---|
736 | LDFLAGS='$LDFLAGS' |
---|
737 | PARALLEL='$PARALLEL' |
---|
738 | PGA_LIB_DIR='$PGA_LIB_DIR' |
---|
739 | PGA_LIB='$PGA_LIB' |
---|
740 | OBJS='$OBJS' |
---|
741 | MPICOMP='$MPICOMP' |
---|
742 | RM='$RM' |
---|
743 | SHELL='$SHELL' |
---|
744 | LIBS='$LIBS' |
---|
745 | srcdir='$srcdir' |
---|
746 | DEFS='$DEFS' |
---|
747 | prefix='$prefix' |
---|
748 | exec_prefix='$exec_prefix' |
---|
749 | prsub='$prsub' |
---|
750 | extrasub='$extrasub' |
---|
751 | EOF |
---|
752 | cat >> config.status <<\EOF |
---|
753 | |
---|
754 | top_srcdir=$srcdir |
---|
755 | |
---|
756 | CONFIG_FILES=${CONFIG_FILES-"Makefile source/Makefile test/Makefile test/Makefile \ |
---|
757 | examples/Makefile examples/c/Makefile examples/fortran/Makefile \ |
---|
758 | examples/mgh/Makefile"} |
---|
759 | for file in .. ${CONFIG_FILES}; do if test "x$file" != x..; then |
---|
760 | srcdir=$top_srcdir |
---|
761 | # Remove last slash and all that follows it. Not all systems have dirname. |
---|
762 | dir=`echo $file|sed 's%/[^/][^/]*$%%'` |
---|
763 | if test "$dir" != "$file"; then |
---|
764 | test "$top_srcdir" != . && srcdir=$top_srcdir/$dir |
---|
765 | test ! -d $dir && mkdir $dir |
---|
766 | fi |
---|
767 | echo creating $file |
---|
768 | rm -f $file |
---|
769 | echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file |
---|
770 | sed -e " |
---|
771 | $prsub |
---|
772 | $extrasub |
---|
773 | s%@RANLIB@%$RANLIB%g |
---|
774 | s%@CC@%$CC%g |
---|
775 | s%@FC@%$FC%g |
---|
776 | s%@CFLAGS@%$CFLAGS%g |
---|
777 | s%@FFLAGS@%$FFLAGS%g |
---|
778 | s%@CPPFLAGS@%$CPPFLAGS%g |
---|
779 | s%@FORTWRAP@%$FORTWRAP%g |
---|
780 | s%@HEADERS@%$HEADERS%g |
---|
781 | s%@LDFLAGS@%$LDFLAGS%g |
---|
782 | s%@PARALLEL@%$PARALLEL%g |
---|
783 | s%@PGA_LIB_DIR@%$PGA_LIB_DIR%g |
---|
784 | s%@PGA_LIB@%$PGA_LIB%g |
---|
785 | s%@OBJS@%$OBJS%g |
---|
786 | s%@MPICOMP@%$MPICOMP%g |
---|
787 | s%@RM@%$RM%g |
---|
788 | s%@SHELL@%$SHELL%g |
---|
789 | s%@LIBS@%$LIBS%g |
---|
790 | s%@srcdir@%$srcdir%g |
---|
791 | s%@DEFS@%$DEFS% |
---|
792 | " $top_srcdir/${file}.in >> $file |
---|
793 | fi; done |
---|
794 | |
---|
795 | |
---|
796 | exit 0 |
---|
797 | EOF |
---|
798 | chmod +x config.status |
---|
799 | ${CONFIG_SHELL-/bin/sh} config.status |
---|
800 | |
---|
801 | |
---|
802 | if test ! -f ".pgapack" ; then |
---|
803 | if test $PARALLEL -eq 1 ; then |
---|
804 | OPERATION="parallel" |
---|
805 | ECHO_LIBS="$MPI_LIB" |
---|
806 | else |
---|
807 | OPERATION="sequential" |
---|
808 | ECHO_LIBS="stub routines in mpi_stub.c" |
---|
809 | fi |
---|
810 | if test $OPTIMIZE -eq 1 ; then |
---|
811 | OPERATION="optimized $OPERATION" |
---|
812 | else |
---|
813 | OPERATION="debug $OPERATION" |
---|
814 | fi |
---|
815 | echo " " |
---|
816 | echo "PGAPack has been configured for $OPERATION operation on" |
---|
817 | echo "the $ARCH architecture, using $ECHO_LIBS." |
---|
818 | echo " " |
---|
819 | echo "**********************************************************************" |
---|
820 | echo "* Please register your copy of PGAPack by sending a mail message *" |
---|
821 | echo "* to pgapack@mcs.anl.gov. This will allow us to notify you of bug *" |
---|
822 | echo "* fixes, enhancements, and new releases. The PGAPack homepage is at *" |
---|
823 | echo "* http://www.mcs.anl.gov/pgapack.html. *" |
---|
824 | echo "**********************************************************************" |
---|
825 | echo " " |
---|
826 | echo "Type \"make install\" to install PGAPack." |
---|
827 | echo " " |
---|
828 | fi |
---|
829 | |
---|
830 | |
---|