ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/ac-tools/aclocal.m4
Revision: 794
Committed: Tue Sep 30 16:00:15 2003 UTC (20 years, 9 months ago) by mmeineke
File size: 25074 byte(s)
Log Message:
changed f90Flags so they are no longer overwritten by the compiler.

File Contents

# Content
1 dnl
2 dnl AC_CHECK_MPI_F90MOD
3 dnl
4 AC_DEFUN([AC_CHECK_MPI_F90MOD],[
5
6 AC_ARG_WITH(mpi_f90_mods, [ --with-mpi_f90_mods=<dir>
7 Location where MPI f90 modules are installed ],
8 mpi_f90_mods="$withval",
9 mpi_f90_mods="/usr/local/include/f90choice")
10
11 AC_MSG_CHECKING(for MPI F90 modules)
12 AC_LANG_SAVE()
13 AC_LANG([Fortran 90])
14 ac_save_F90FLAGS=$F90FLAGS
15 AS_IF([test "$mpi_f90_mods"], [F90FLAGS="${F90FLAGS} -I${mpi_f90_mods}"])
16 _AC_COMPILE_IFELSE([
17 AC_LANG_PROGRAM([
18 use mpi
19 integer :: ierr
20 call MPI_Init(ierr)
21 ])], [HAVE_MPI_MOD=1], [HAVE_MPI_MOD=0])
22
23 F90FLAGS=$ac_save_F90FLAGS
24 AC_LANG_RESTORE()
25
26 if test "$HAVE_MPI_MOD" = 1; then
27 AC_MSG_RESULT(yes)
28 AC_DEFINE(MPI_MOD, 1, [have mpi module])
29 MPI_F90_MODS="-I${mpi_f90_mods}"
30 AC_SUBST(MPI_F90_MODS)
31 # The library name:
32 if test -z "$MPI_LIB" ; then
33 MPI_LIBNAME=-lmpich
34 else
35 MPI_LIBNAME="$MPI_LIB"
36 fi
37 if test -z "$MPIMODLIBNAME" ; then
38 MPIMODLIBNAME="${MPI_LIBNAME}f90"
39 fi
40 AC_SUBST(MPIMODLIBNAME)
41 else
42 AC_MSG_RESULT(no)
43 AC_MSG_ERROR([Couldn't locate MPI F90 Modules])
44 fi
45
46 ])
47
48
49 dnl
50 dnl AM_PATH_SPRNG
51 dnl
52 AC_DEFUN([AM_PATH_SPRNG],[
53
54 AC_ARG_WITH(sprng_prefix, [ --with-sprng_prefix=PREFIX
55 Prefix where SPRNG is installed ],
56 sprng_prefix="$withval",
57 sprng_prefix="/usr/local")
58 AC_ARG_WITH(sprng_lib_prefix, [ --with-sprng_lib_prefix=PREFIX SPRNG library directory],
59 sprng_lib_prefix="$withval",
60 sprng_lib_prefix="/usr/local/lib")
61 AC_ARG_WITH(sprng_include_prefix, [ --with-sprng_include_prefix=PREFIX
62 SPRNG include directory],
63 sprng_include_prefix="$withval",
64 sprng_include_prefix="/usr/local/include/sprng")
65
66 if test x$sprng_lib_prefix = x ; then
67 sprng_lib_prefix=${sprng_prefix}/lib
68 fi
69
70 if test x$sprng_include_prefix = x ; then
71 sprng_include_prefix=${sprng_prefix}/include
72 fi
73
74 AC_MSG_CHECKING(for SPRNG include files in $sprng_include_prefix)
75 if test -f ${sprng_include_prefix}/sprng.h; then
76 have_sprngincl=yes
77 AC_MSG_RESULT(yes)
78 else
79 have_sprngincl=no
80 AC_MSG_RESULT(no)
81 AC_MSG_ERROR(Could not locate the SPRNG include files)
82 fi
83
84 AC_MSG_CHECKING(for SPRNG libraries in $sprng_lib_prefix)
85 if test -f ${sprng_lib_prefix}/libsprng.a; then
86 have_sprnglib=yes
87 AC_MSG_RESULT(yes)
88 else
89 have_sprnglib=no
90 AC_MSG_RESULT(no)
91 AC_MSG_ERROR(Could not locate the SPRNG libraries)
92 fi
93
94 AC_LANG_SAVE()
95 AC_LANG([C])
96 ac_save_CPPFLAGS=$CPPFLAGS
97 CPPFLAGS="${CPPFLAGS} -I${sprng_include_prefix}"
98 ac_save_LDFLAGS=$LDFLAGS
99 LDFLAGS="${LDFLAGS} -L${sprng_lib_prefix} -lsprng"
100 AC_CHECK_HEADER(sprng.h, [
101 AC_CHECK_LIB(sprng,
102 init_rng,
103 [SPRNG_LIBDIR="${sprng_lib_prefix}"
104 SPRNG_LIB="-lsprng" SPRNG_INC="-I${sprng_include_prefix}"
105 HAVE_SPRNG="yes"])])
106 CPPFLAGS=$ac_save_CPPFLAGS
107 LDFLAGS=$ac_save_LDFLAGS
108 AC_LANG_RESTORE()
109
110 if test x_$HAVE_SPRNG != x_yes; then
111 AC_MSG_ERROR(Can't build with SPRNG)
112 fi
113 AC_SUBST(SPRNG_LIBDIR)
114 AC_SUBST(SPRNG_LIB)
115 AC_SUBST(SPRNG_INC)
116 AC_SUBST(HAVE_SPRNG)
117 ])
118
119 dnl
120 dnl CHECK_MKL
121 dnl
122 AC_DEFUN([CHECK_MKL],
123 [AC_MSG_CHECKING(if MKL is wanted)
124 AC_ARG_WITH(mkl,
125 [ --with-mkl Do we want MKL [will check /usr/local/intel/mkl60 /opt/intel/mkl60]],
126 [ AC_MSG_RESULT(yes)
127 for dir in $withval /usr/local/intel/mkl60 /opt/intel/mkl60; do
128 mkldir="$dir"
129 if test -f "$dir/include/mkl.h"; then
130 found_mkl="yes";
131 break;
132 fi
133 done
134 if test x_$found_mkl != x_yes; then
135 AC_MSG_ERROR(Cannot find MKL includes)
136 else
137 printf "MKL includes found in $mkldir/include\n";
138 fi
139
140 AC_LANG_SAVE()
141 AC_LANG([C])
142 ac_save_CPPFLAGS=$CPPFLAGS
143 CPPFLAGS="${CPPFLAGS} -I${mkldir}/include"
144 ac_save_LDFLAGS=$LDFLAGS
145 LDFLAGS="${LDFLAGS} -L${mkldir}/lib/32 -lmkl -lvml -lguide"
146 AC_CHECK_HEADER(mkl.h, [
147 AC_CHECK_LIB(mkl,
148 vslNewStream,
149 [MKL_LIBDIR="${mkldir}/lib/32",
150 MKL_LIB="-lmkl -lvml -lguide",
151 HAVE_MKL="yes"])
152 ], [MKL_INC="-I${mkldir}/include"])
153 CPPFLAGS=$ac_save_CPPFLAGS
154 LDFLAGS=$ac_save_LDFLAGS
155 AC_LANG_RESTORE()
156
157 if test x_$HAVE_MKL != x_yes; then
158 AC_MSG_ERROR(Can't build with MKL)
159 fi
160 AC_SUBST(MKL_LIBDIR)
161 AC_SUBST(MKL_LIB)
162 AC_SUBST(MKL_INC)
163 AC_SUBST(HAVE_MKL)
164 ],
165 [
166 AC_MSG_RESULT(no)
167 ])
168 ])
169 dnl
170
171 AC_DEFUN(ACX_CHECK_CC_FLAGS,
172 [
173 AC_REQUIRE([AC_PROG_CC])
174 AC_CACHE_CHECK(whether ${CC-cc} accepts $1, ac_$2,
175 [echo 'void f(){}' > conftest.c
176 if test -z "`${CC-cc} $1 -c conftest.c 2>&1`"; then
177 ac_$2=yes
178 else
179 ac_$2=no
180 fi
181 rm -f conftest*
182 ])
183 if test "$ac_$2" = yes; then
184 :
185 $3
186 else
187 :
188 $4
189 fi
190 ])
191
192 AC_DEFUN(ACX_CHECK_CXX_FLAGS,
193 [
194 AC_REQUIRE([AC_PROG_CXX])
195 AC_CACHE_CHECK(whether ${CXX-c++} accepts $1, ac_$2,
196 [echo 'void f(){}' > conftest.cpp
197 if test -z "`${CXX-c++} $1 -c conftest.cpp 2>&1`"; then
198 ac_$2=yes
199 else
200 ac_$2=no
201 fi
202 rm -f conftest*
203 ])
204 if test "$ac_$2" = yes; then
205 :
206 $3
207 else
208 :
209 $4
210 fi
211 ])
212
213 dnl -------------------------------------------------------------------------
214 dnl ACX_CHECK_F90_FLAGS()
215 dnl
216 dnl Check for optimizer flags the Fortran compiler can use.
217 dnl
218 AC_DEFUN(ACX_CHECK_F90_FLAGS,
219 [
220 AC_CACHE_CHECK(whether ${F90-f90} accepts $1, ac_$2,
221 [
222 AC_LANG_SAVE
223 AC_LANG([Fortran 90])
224 echo 'program main' > conftest.$ac_ext
225 echo 'end program main' >> conftest.$ac_ext
226 ac_compile='${F90-f90} -c $1 $F90FLAGS conftest.$ac_ext 1>&AC_FD_CC'
227 if AC_TRY_EVAL(ac_compile); then
228 ac_$2=yes
229 else
230 ac_$2=no
231 fi
232 rm -f conftest*
233 AC_LANG_RESTORE()
234 ])
235 if test "$ac_$2" = yes; then
236 :
237 $3
238 else
239 :
240 $4
241 fi
242 ])
243
244 AC_DEFUN(ACX_PROG_GCC_VERSION,
245 [
246 AC_REQUIRE([AC_PROG_CC])
247 AC_CACHE_CHECK(whether we are using gcc $1.$2 or later, ac_cv_prog_gcc_$1_$2,
248 [
249 dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp.
250 cat > conftest.c <<EOF
251 #ifdef __GNUC__
252 # if (__GNUC__ > $1) || (__GNUC__ == $1 && __GNUC_MINOR__ >= $2)
253 yes;
254 # endif
255 #endif
256 EOF
257 if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
258 ac_cv_prog_gcc_$1_$2=yes
259 else
260 ac_cv_prog_gcc_$1_$2=no
261 fi
262 ])
263 if test "$ac_cv_prog_gcc_$1_$2" = yes; then
264 :
265 $3
266 else
267 :
268 $4
269 fi
270 ])
271
272
273 AC_DEFUN(ACX_PROG_CC_MAXOPT,
274 [
275 AC_REQUIRE([AC_PROG_CC])
276 AC_REQUIRE([AC_CANONICAL_HOST])
277
278 # Try to determine "good" native compiler flags if none specified on command
279 # line
280 if test "$ac_test_CFLAGS" != "set"; then
281 CFLAGS=""
282 case "${host_cpu}-${host_os}" in
283
284 *linux*) if test "$CC" = icc; then
285 CFLAGS="-O"
286 fi;;
287 sparc-solaris2*) if test "$CC" = cc; then
288 CFLAGS="-native -fast -xO5 -dalign"
289 fi;;
290
291 alpha*-osf*) if test "$CC" = cc; then
292 CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host -arch host -std1"
293 fi;;
294
295 hppa*-hpux*) if test "$CC" = cc; then
296 CFLAGS="-Ae +O3 +Oall"
297 fi;;
298
299 rs6000*-aix*) if test "$CC" = cc -o "$CC" = xlc; then
300 CFLAGS="-O3 -qtune=auto -qansialias -w"
301 fi;;
302 powerpc*-aix*)
303 if test "$CC" = cc -o "$CC" = xlc; then
304 CFLAGS="-O3 -qtune=auto -qansialias -w"
305 echo "*******************************************************"
306 echo "* You have AIX on an unknown powerpc system. It is *"
307 echo "* recommended that you use *"
308 echo "* *"
309 echo "* CFLAGS=-O3 -qarch=ppc -qtune=xxx -qansialias -w *"
310 echo "* ^^^ *"
311 echo "* where xxx is 601, 603, 604, or whatever kind of *"
312 echo "* PowerPC CPU you have. For more info, man cc. *"
313 echo "*******************************************************"
314 fi;;
315 *darwin*)
316 if test "$CC" = xlc -o "$CC" = cc; then
317 CFLAGS="-O3 -qtune=auto -w"
318 echo "*******************************************************"
319 echo "* You have Darwin on an unknown powerpc system. *"
320 echo "* It is recommended that you use *"
321 echo "* *"
322 echo "* CFLAGS=-O3 -qarch=ppc -qtune=xxx -qansialias -w *"
323 echo "* ^^^ *"
324 echo "* where xxx is 601, 603, 604, or whatever kind of *"
325 echo "* PowerPC CPU you have. For more info, man cc. *"
326 echo "*******************************************************"
327 fi;;
328 esac
329
330 # use default flags for gcc on all systems
331 if test $ac_cv_prog_gcc = yes; then
332 CFLAGS="-O6 -fomit-frame-pointer -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic"
333 fi
334
335 # test for gcc-specific flags:
336 if test $ac_cv_prog_gcc = yes; then
337 # -malign-double for x86 systems
338 ACX_CHECK_CC_FLAGS(-malign-double,align_double, CFLAGS="$CFLAGS -malign-double")
339 # -fstrict-aliasing for gcc-2.95+
340 ACX_CHECK_CC_FLAGS(-fstrict-aliasing,fstrict_aliasing, CFLAGS="$CFLAGS -fstrict-aliasing")
341 fi
342
343 CPU_FLAGS=""
344 if test "$GCC" = "yes"; then
345 dnl try to guess correct CPU flags, at least for linux
346 case "${host_cpu}" in
347 i586*) ACX_CHECK_CC_FLAGS(-mcpu=pentium,cpu_pentium,
348 [CPU_FLAGS=-mcpu=pentium],
349 [ACX_CHECK_CC_FLAGS(-mpentium,pentium,
350 [CPU_FLAGS=-mpentium])])
351 ;;
352 i686*) ACX_CHECK_CC_FLAGS(-mcpu=pentiumpro,cpu_pentiumpro,
353 [CPU_FLAGS=-mcpu=pentiumpro],
354 [ACX_CHECK_CC_FLAGS(-mpentiumpro,pentiumpro,
355 [CPU_FLAGS=-mpentiumpro])])
356 ;;
357 powerpc*)
358 cputype=`(grep cpu /proc/cpuinfo | head -1 | cut -d: -f2 | sed 's/ //g') 2> /dev/null`
359 is60x=`echo $cputype | egrep "^60[0-9]e?$"`
360 if test -n "$is60x"; then
361 ACX_CHECK_CC_FLAGS(-mcpu=$cputype,m_cpu_60x,
362 CPU_FLAGS=-mcpu=$cputype)
363 elif test "$cputype" = 750; then
364 ACX_PROG_GCC_VERSION(2,95,
365 ACX_CHECK_CC_FLAGS(-mcpu=750,m_cpu_750,
366 CPU_FLAGS=-mcpu=750))
367 fi
368 if test -z "$CPU_FLAGS"; then
369 ACX_CHECK_CC_FLAGS(-mcpu=powerpc,m_cpu_powerpc,
370 CPU_FLAGS=-mcpu=powerpc)
371 fi
372 if test -z "$CPU_FLAGS"; then
373 ACX_CHECK_CC_FLAGS(-mpowerpc,m_powerpc,
374 CPU_FLAGS=-mpowerpc)
375 fi
376 esac
377 fi
378
379 if test -n "$CPU_FLAGS"; then
380 CFLAGS="$CFLAGS $CPU_FLAGS"
381 fi
382
383 if test -z "$CFLAGS"; then
384 echo ""
385 echo "********************************************************"
386 echo "* WARNING: Don't know the best CFLAGS for this system *"
387 echo "* Use make CFLAGS=..., or edit the top level Makefile *"
388 echo "* (otherwise, a default of CFLAGS=-O3 will be used) *"
389 echo "********************************************************"
390 echo ""
391 CFLAGS="-O3"
392 fi
393
394 ACX_CHECK_CC_FLAGS(${CFLAGS}, guessed_cflags, , [
395 echo ""
396 echo "********************************************************"
397 echo "* WARNING: The guessed CFLAGS don't seem to work with *"
398 echo "* your compiler. *"
399 echo "* Use make CFLAGS=..., or edit the top level Makefile *"
400 echo "********************************************************"
401 echo ""
402 CFLAGS=""
403 ])
404
405 fi
406 ])
407
408 AC_DEFUN(ACX_PROG_CXX_MAXOPT,
409 [
410 AC_REQUIRE([AC_PROG_CXX])
411 AC_REQUIRE([AC_CANONICAL_HOST])
412
413 # Try to determine "good" native compiler flags if none specified on command
414 # line
415 if test "$ac_test_CXXFLAGS" != "set"; then
416 CXXFLAGS=""
417 case "${host_cpu}-${host_os}" in
418
419 *linux*) if test "$CXX" = icc -o "$CXX" = icpc; then
420 CXXFLAGS="-O"
421 fi;;
422 sparc-solaris2*) if test "$CXX" = CC; then
423 CXXFLAGS="-native -fast -xO5 -dalign"
424 fi;;
425 rs6000*-aix*) if test "$CXX" = xlC; then
426 CXXFLAGS="-O3 -qarch=pwrx -qtune=pwrx -qansialias -w"
427 fi;;
428 powerpc*-aix*)
429 if test "$CXX" = xlC; then
430 CXXFLAGS="-O3 -qarch=ppc -qansialias -w"
431 echo "*******************************************************"
432 echo "* You have AIX on an unknown powerpc system. It is *"
433 echo "* recommended that you use *"
434 echo "* *"
435 echo "* CXXFLAGS=-O3 -qarch=ppc -qtune=xxx -qansialias -w *"
436 echo "* ^^^ *"
437 echo "* where xxx is 601, 603, 604, or whatever kind of *"
438 echo "* PowerPC CPU you have. For more info, man cc. *"
439 echo "*******************************************************"
440 fi;;
441 *darwin*)
442 if test "$CXX" = xlC; then
443 CXXFLAGS="-O3 -qtune=auto -qansialias -w"
444 echo "*******************************************************"
445 echo "* You have AIX on an unknown powerpc system. It is *"
446 echo "* recommended that you use *"
447 echo "* *"
448 echo "* CXXFLAGS=-O3 -qarch=ppc -qtune=xxx -qansialias -w *"
449 echo "* ^^^ *"
450 echo "* where xxx is 601, 603, 604, or whatever kind of *"
451 echo "* PowerPC CPU you have. For more info, man cc. *"
452 echo "*******************************************************"
453 fi;;
454 esac
455
456 # use default flags for gcc on all systems
457 if test $ac_cv_prog_gcc = yes; then
458 CXXFLAGS="-O6 -fomit-frame-pointer -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic"
459 fi
460
461 # test for gcc-specific flags:
462 if test $ac_cv_prog_gcc = yes; then
463 # -malign-double for x86 systems
464 ACX_CHECK_CXX_FLAGS(-malign-double,align_double, CXXFLAGS="$CXXFLAGS -malign-double")
465 # -fstrict-aliasing for gcc-2.95+
466 ACX_CHECK_CXX_FLAGS(-fstrict-aliasing,fstrict_aliasing, CXXFLAGS="$CXXFLAGS -fstrict-aliasing")
467 fi
468
469 CPU_FLAGS=""
470 if test "$GCC" = "yes"; then
471 dnl try to guess correct CPU flags, at least for linux
472 case "${host_cpu}" in
473 i586*) ACX_CHECK_CC_FLAGS(-mcpu=pentium,cpu_pentium,
474 [CPU_FLAGS=-mcpu=pentium],
475 [ACX_CHECK_CXX_FLAGS(-mpentium,pentium,
476 [CPU_FLAGS=-mpentium])])
477 ;;
478 i686*) ACX_CHECK_CXX_FLAGS(-mcpu=pentiumpro,cpu_pentiumpro,
479 [CPU_FLAGS=-mcpu=pentiumpro],
480 [ACX_CHECK_CXX_FLAGS(-mpentiumpro,pentiumpro,
481 [CPU_FLAGS=-mpentiumpro])])
482 ;;
483 powerpc*)
484 cputype=`(grep cpu /proc/cpuinfo | head -1 | cut -d: -f2 | sed 's/ //g') 2> /dev/null`
485 is60x=`echo $cputype | egrep "^60[0-9]e?$"`
486 if test -n "$is60x"; then
487 ACX_CHECK_CXX_FLAGS(-mcpu=$cputype,m_cpu_60x,
488 CPU_FLAGS=-mcpu=$cputype)
489 elif test "$cputype" = 750; then
490 ACX_PROG_GCC_VERSION(2,95,
491 ACX_CHECK_CXX_FLAGS(-mcpu=750,m_cpu_750,
492 CPU_FLAGS=-mcpu=750))
493 fi
494 if test -z "$CPU_FLAGS"; then
495 ACX_CHECK_CXX_FLAGS(-mcpu=powerpc,m_cpu_powerpc,
496 CPU_FLAGS=-mcpu=powerpc)
497 fi
498 if test -z "$CPU_FLAGS"; then
499 ACX_CHECK_CXX_FLAGS(-mpowerpc,m_powerpc,
500 CPU_FLAGS=-mpowerpc)
501 fi
502 esac
503 fi
504
505 if test -n "$CPU_FLAGS"; then
506 CXXFLAGS="$CXXFLAGS $CPU_FLAGS"
507 fi
508
509 if test -z "$CXXFLAGS"; then
510 echo ""
511 echo "**********************************************************"
512 echo "* WARNING: Don't know the best CXXFLAGS for this system *"
513 echo "* Use make CXXFLAGS=..., or edit the top level Makefile *"
514 echo "* (otherwise, a default of CXXFLAGS=-O3 will be used) *"
515 echo "**********************************************************"
516 echo ""
517 CXXFLAGS="-O3"
518 fi
519
520 ACX_CHECK_CXX_FLAGS(${CXXFLAGS}, guessed_cxxflags, , [
521 echo ""
522 echo "**********************************************************"
523 echo "* WARNING: The guessed CXXFLAGS don't seem to work with *"
524 echo "* your compiler. *"
525 echo "* Use make CXXFLAGS=..., or edit the top level Makefile *"
526 echo "**********************************************************"
527 echo ""
528 CXXFLAGS=""
529 ])
530
531 fi
532 ])
533
534 AC_DEFUN(ACX_PROG_F90_MAXOPT,
535 [
536 AC_REQUIRE([AC_PROG_F90])
537 AC_REQUIRE([AC_CANONICAL_HOST])
538
539 # Try to determine "good" native compiler flags if none specified on command
540 # line
541
542 if test x"$F90FLAGS" == x ; then
543 F90FLAGS=""
544 case "${host_cpu}-${host_os}" in
545
546 *linux*) if test "$F90" = ifc; then
547 F90FLAGS="-O"
548 fi;;
549 rs6000*-aix*) if test "$F90" = xlf90 -o "$F90" = f90; then
550 F90FLAGS="-O3 -qarch=pwrx -qtune=pwrx -qansialias -w"
551 fi;;
552 powerpc*-aix*)
553 if test "$F90" = f90 -o "$F90" = xlf90; then
554 F90FLAGS="-O3 -qarch=ppc -qansialias -w"
555 echo "*******************************************************"
556 echo "* You have AIX on an unknown powerpc system. It is *"
557 echo "* recommended that you use *"
558 echo "* *"
559 echo "* F90FLAGS=-O3 -qarch=ppc -qtune=xxx -qansialias -w *"
560 echo "* ^^^ *"
561 echo "* where xxx is 601, 603, 604, or whatever kind of *"
562 echo "* PowerPC CPU you have. For more info, man xlf. *"
563 echo "*******************************************************"
564 fi;;
565 *darwin*)
566 if test "$F90" = f90 -o "$F90" = xlf90; then
567 F90FLAGS="-O3 -qtune=auto -w"
568 echo "*********************************************************"
569 echo "* You have Darwin on an unknown powerpc system. It is *"
570 echo "* recommended that you use *"
571 echo "* *"
572 echo "* CXXFLAGS=-O3 -qarch=ppc -qtune=xxx -qansialias -w *"
573 echo "* ^^^ *"
574 echo "* where xxx is 601, 603, 604, or whatever kind of *"
575 echo "* PowerPC CPU you have. For more info, man xlf. *"
576 echo "*********************************************************"
577 fi;;
578 esac
579
580 if test -n "$CPU_FLAGS"; then
581 F90FLAGS="$F90FLAGS $CPU_FLAGS"
582 fi
583
584 if test -z "$F90FLAGS"; then
585 echo ""
586 echo "**********************************************************"
587 echo "* WARNING: Don't know the best F90FLAGS for this system *"
588 echo "* Use make F90FLAGS=..., or edit the top level Makefile *"
589 echo "* (otherwise, a default of F90FLAGS=-O3 will be used) *"
590 echo "**********************************************************"
591 echo ""
592 F90FLAGS="-O3"
593 fi
594
595 ACX_CHECK_F90_FLAGS(${F90FLAGS}, guessed_f90flags, , [
596 echo ""
597 echo "**********************************************************"
598 echo "* WARNING: The guessed F90FLAGS don't seem to work with *"
599 echo "* your compiler. *"
600 echo "* Use make F90FLAGS=..., or edit the top level Makefile *"
601 echo "**********************************************************"
602 echo ""
603 F90FLAGS=""
604 ])
605
606 fi
607 ])
608
609 AC_DEFUN(ACX_PROG_F90_PREPFLAG,
610 [
611 AC_REQUIRE([AC_PROG_F90])
612 AC_REQUIRE([AC_CANONICAL_HOST])
613
614 # Try to determine native compiler flags that allow us to use F90 suffix
615 # for preprocessed f90 source.
616
617 if test "$ac_test_PREPFLAG" != "set"; then
618 PREPFLAG=""
619 case "${host_cpu}-${host_os}" in
620
621 *linux*) if test "$F90" = ifc; then
622 PREPFLAG="-fpp1 "
623 fi;;
624 *aix*) if test "$F90" = xlf90 -o "$F90" = f90; then
625 PREPFLAG="-qsuffix=cpp=F90 "
626 fi;;
627 *darwin*)
628 if test "$F90" = f90 -o "$F90" = xlf90; then
629 PREPFLAG="-qsuffix=cpp=F90 "
630 fi;;
631 esac
632
633 if test -z "$PREPFLAG"; then
634 echo ""
635 echo "**********************************************************"
636 echo "* WARNING: Don't know the best PREPFLAG for this system *"
637 echo "* Use make PREPFLAG=..., or edit the top level Makefile *"
638 echo "* (otherwise, an empty PREPFLAG will be used) *"
639 echo "**********************************************************"
640 echo ""
641 PREPFLAG=""
642 fi
643
644 AC_MSG_CHECKING(to make sure F90 preprocessor flag works)
645 AC_LANG_SAVE()
646 AC_LANG([Fortran 90])
647 ac_save_ext=$ac_ext
648 ac_ext=F90
649 ac_save_F90FLAGS=$F90FLAGS
650
651 AS_IF([test "$PREPFLAG"], [F90FLAGS="${F90FLAGS} ${PREPFLAG}-DTEST"])
652 _AC_COMPILE_IFELSE([
653 AC_LANG_PROGRAM([
654 integer :: i
655 i = 1
656 ])], [prepflagworks=1], [prepflagworks=0])
657
658 F90FLAGS=$ac_save_F90FLAGS
659 ac_ext=$ac_save_ext
660 AC_LANG_RESTORE()
661
662
663 if test "$prepflagworks" = 1; then
664 AC_MSG_RESULT(yes)
665 AC_SUBST(PREPFLAG)
666 else
667 AC_MSG_RESULT(no)
668 AC_MSG_ERROR([Can't figure out working Fortran90 preprocessor flag])
669 fi
670 fi
671 ])
672
673
674 AC_DEFUN(ACX_PROG_F90_PREPDEFFLAG,
675 [
676 AC_REQUIRE([AC_PROG_F90])
677 AC_REQUIRE([AC_CANONICAL_HOST])
678
679 # Try to determine native compiler flags that allow us to use F90 suffix
680 # for preprocessed f90 source with -D type defines
681
682 if test "$ac_test_PREPDEFFLAG" != "set"; then
683 PREPDEFFLAG=""
684 case "${host_cpu}-${host_os}" in
685
686 *linux*) if test "$F90" = ifc; then
687 PREPDEFFLAG=" "
688 fi;;
689 *aix*) if test "$F90" = xlf90 -o "$F90" = f90; then
690 PREPDEFFLAG="-WF,"
691 fi;;
692 *darwin*)
693 if test "$F90" = f90 -o "$F90" = xlf90; then
694 PREPDEFFLAG="-WF,"
695 fi;;
696 esac
697
698 if test -z "$PREPDEFFLAG"; then
699 echo ""
700 echo "*************************************************************"
701 echo "* WARNING: Don't know the best PREPDEFFLAG for this system *"
702 echo "* Use make PREPDEFFLAG=..., or edit the top level Makefile *"
703 echo "* (otherwise, an empty PREPDEFFLAG will be used) *"
704 echo "*************************************************************"
705 echo ""
706 PREPDEFFLAG=" "
707 fi
708
709 AC_MSG_CHECKING(to make sure F90 preprocessor define flag works)
710 AC_LANG_SAVE()
711 AC_LANG([Fortran 90])
712 ac_save_ext=$ac_ext
713 ac_ext=F90
714 ac_save_F90FLAGS=$F90FLAGS
715
716 AS_IF([test "$PREPDEFFLAG"], [F90FLAGS="${F90FLAGS} ${PREPFLAG} ${PREPDEFFLAG}-DTEST"])
717 _AC_COMPILE_IFELSE([
718 AC_LANG_PROGRAM([
719 integer :: i
720 #ifdef TEST
721 i = 1
722 #else
723 choke me
724 #endif
725 ])], [prepdefflagworks=1], [prepdefflagworks=0])
726
727 F90FLAGS=$ac_save_F90FLAGS
728 ac_ext=$ac_save_ext
729 AC_LANG_RESTORE()
730
731
732 if test "$prepdefflagworks" = 1; then
733 AC_MSG_RESULT(yes)
734 AC_SUBST(PREPDEFFLAG)
735 else
736 AC_MSG_RESULT(no)
737 AC_MSG_ERROR([Can't figure out working Fortran90 preprocessor define flag])
738 fi
739 fi
740 ])
741
742 AC_DEFUN([ACX_MPI], [
743 AC_PREREQ(2.50) dnl for AC_LANG_CASE
744
745 AC_LANG_CASE([C], [
746 AC_REQUIRE([AC_PROG_CC])
747 AC_ARG_VAR(MPICC,[MPI C compiler command])
748 AC_CHECK_PROGS(MPICC, mpicc hcc mpcc mpcc_r mpxlc, $CC)
749 acx_mpi_save_CC="$CC"
750 CC="$MPICC"
751 AC_SUBST(MPICC)
752 ],
753 [C++], [
754 AC_REQUIRE([AC_PROG_CXX])
755 AC_ARG_VAR(MPICXX,[MPI C++ compiler command])
756 AC_CHECK_PROGS(MPICXX, mpiCC mpCC, $CXX)
757 acx_mpi_save_CXX="$CXX"
758 CXX="$MPICXX"
759 AC_SUBST(MPICXX)
760 ],
761 [Fortran 90], [
762 AC_REQUIRE([AC_PROG_F90])
763 AC_ARG_VAR(MPIF77,[MPI Fortran compiler command])
764 AC_CHECK_PROGS(MPIF90, mpif90 hf90 mpxlf90 mpf90 mpxlf95 mpxlf_r, $F90)
765 acx_mpi_save_F90="$F90"
766 F90="$MPIF90"
767 AC_SUBST(MPIF90)
768 ])
769
770 if test x = x"$MPILIBS"; then
771 AC_LANG_CASE([C], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])],
772 [C++], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])],
773 [Fortran 90], [AC_MSG_CHECKING([for MPI_Init])
774 AC_TRY_LINK([],[ call MPI_Init], [MPILIBS=" "
775 AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])])
776 fi
777 if test x = x"$MPILIBS"; then
778 AC_CHECK_LIB(mpi, MPI_Init, [MPILIBS="-lmpi"])
779 fi
780 if test x = x"$MPILIBS"; then
781 AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"])
782 fi
783
784 dnl We have to use AC_TRY_COMPILE and not AC_CHECK_HEADER because the
785 dnl latter uses $CPP, not $CC (which may be mpicc).
786 AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then
787 AC_MSG_CHECKING([for mpi.h])
788 AC_TRY_COMPILE([#include <mpi.h>],[],[AC_MSG_RESULT(yes)], [MPILIBS=""
789 AC_MSG_RESULT(no)])
790 fi],
791 [C++], [if test x != x"$MPILIBS"; then
792 AC_MSG_CHECKING([for mpi.h])
793 AC_TRY_COMPILE([#include <mpi.h>],[],[AC_MSG_RESULT(yes)], [MPILIBS=""
794 AC_MSG_RESULT(no)])
795 fi])
796
797 AC_LANG_CASE([C], [CC="$acx_mpi_save_CC"],
798 [C++], [CXX="$acx_mpi_save_CXX"],
799 [Fortran 90], [F90="$acx_mpi_save_F90"])
800
801 AC_SUBST(MPILIBS)
802
803 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
804 if test x = x"$MPILIBS"; then
805 $2
806 :
807 else
808 ifelse([$1],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$1])
809 :
810 fi
811 ])dnl ACX_MPI
812