ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/ac-tools/aclocal.m4
Revision: 2733
Committed: Tue Apr 25 02:09:01 2006 UTC (19 years, 3 months ago) by gezelter
File size: 36031 byte(s)
Log Message:
Adding spherical boundary conditions to LD integrator

File Contents

# Content
1 dnl We need a function similar to AC_CHECK_LIB to check for C++ libraries.
2 dnl AC_CHECK_CXX_LIB provides a similar interface like AC_CHECK_LIB
3 dnl and uses AC_TRY_LINK.
4 dnl
5 dnl $1 library name (without "-l")
6 dnl $2 object name to check for
7 dnl $3 neccessary include directive(s)
8 dnl $4 command to create object $2
9 dnl $5 yes-action
10 dnl $6 no-action
11 dnl $7 include dir for $3 (with -I)
12 dnl $8 additional libraries to link with
13
14 AC_DEFUN(AC_CHECK_CXX_LIB, AC_MSG_CHECKING([for $2 in -l$1])
15 save_CXXFLAGS_CHECK_CXX_LIB="$CXXFLAGS"
16 CXXFLAGS="$CXXFLAGS $7"
17 save_LIBS_CHECK_CXX_LIB="$LIBS"
18 LIBS="-l$1 $8 $LIBS"
19 [AC_TRY_LINK([$3], [$4], [AC_MSG_RESULT([yes])
20 $5], [AC_MSG_RESULT([no])
21 $6])]
22 CXXFLAGS="$save_CXXFLAGS_CHECK_CXX_LIB"
23 LIBS="$save_LIBS_CHECK_CXX_LIB")dnl
24
25 dnl
26 dnl AC_CHECK_MODSUFFIX
27 dnl
28 AC_DEFUN([AC_CHECK_MODSUFFIX],[
29
30 AC_MSG_CHECKING(for module suffix)
31 rm -f conftest*
32 # Intel ifc compiler generates files by the name of work.pc and work.pcl (!)
33 rm -f work*
34 cat >conftest.$ac_ext <<EOF
35 module conftest
36 integer n
37 parameter (n=1)
38 end module conftest
39 EOF
40 # SGI and absoft compilers generates module name in upper case!
41 testname="conftest"
42 modcase="lower"
43 if (eval $ac_compile) 2>/dev/null ; then
44 MOD=`ls conftest* | grep -v conftest.$ac_ext | grep -v conftest.o`
45 MOD=`echo "$MOD" | sed -e 's/conftest\.//g'`
46 if test -z "$MOD" ; then
47 MOD=`ls CONFTEST* 2>/dev/null \
48 | grep -v CONFTEST.$ac_ext | grep -v CONFTEST.o`
49 MOD=`echo "$MOD" | sed -e 's/CONFTEST\.//g'`
50 if test -n "$MOD" ; then
51 testname="CONFTEST"
52 modcase="upper"
53 fi
54 fi
55 if test -z "$MOD" ; then
56 AC_MSG_RESULT(unknown)
57 # Use mod if we can't figure it out
58 MOD="mod"
59 else
60 AC_MSG_RESULT($MOD)
61 fi
62 if test -s work.pcl ; then
63 AC_MSG_WARN([Compiler generates auxillery files!])
64 fi
65 else
66 AC_MSG_RESULT(unknown)
67 fi
68 AC_SUBST(MOD)
69
70 ])
71
72
73 dnl
74 dnl AC_CHECK_MODDIRFLAG
75 dnl
76 AC_DEFUN([AC_CHECK_MODDIRFLAG],[
77
78 # Check for module include path (some use -I, some (Solaris) use -M, some
79 # (absoft) use -p).
80 # Intel compilers use a wierd system: -cl,filename.pcl . If no file is
81 # specified, work.pcl and work.pc are created. However, if you specify
82 # a file, it must contain a the name of a file ending in .pc . Ugh!
83 # Use the module made above
84 AC_MSG_CHECKING(for module directory path flag)
85 rm -f conftest*
86 # Intel ifc compiler generates files by the name of work.pc and work.pcl (!)
87 rm -f work*
88 cat >conftest.$ac_ext <<EOF
89 module conftest
90 integer n
91 parameter (n=1)
92 end module conftest
93 EOF
94 # SGI and absoft compilers generates module name in upper case!
95 testname="conftest"
96 if (eval $ac_compile) 2>/dev/null ; then
97 mod=`ls CONFTEST* 2>/dev/null | grep -v CONFTEST.$ac_ext | grep -v CONFTEST.o`
98 mod=`echo "$mod" | sed -e 's/CONFTEST\.//g'`
99 if test -n "$mod" ; then
100 testname="CONFTEST"
101 fi
102 madedir=0
103 if test ! -d conf ; then mkdir conf ; madedir=1; fi
104 cp $testname.$MOD conf
105 rm -f conftest* CONFTEST*
106 cat >conftest1.$ac_ext <<EOF
107 program main
108 use conftest
109 print *, n
110 end
111 EOF
112 F90_WORK_FILES_ARG=""
113 F90MODINCSPEC=""
114 if $FC -c -Iconf $FCFLAGS $FCFLAGS_SRCEXT conftest1.$ac_ext > conftest.out 2>&1 ; then
115 MODDIRFLAG="-I"
116 F90MODINCSPEC="-I<dir>"
117 AC_MSG_RESULT(-I)
118 elif $FC -c -Mconf $FCFLAGS $FCFLAGS_SRCEXT conftest1.$ac_ext >> conftest.out 2>&1 ; then
119 MODDIRFLAG="-M"
120 F90MODINCSPEC="-M<dir>"
121 AC_MSG_RESULT(-M)
122 elif $FC -c -pconf $FCFLAGS $FCFLAGS_SRCEXT conftest1.$ac_ext >> conftest.out 2>&1 ; then
123 MODDIRFLAG="-p"
124 F90MODINCSPEC="-p<dir>"
125 AC_MSG_RESULT(-p)
126 elif test -s work.pc ; then
127 cp work.pc conf/mpimod.pc
128 echo "mpimod.pc" > conf/mpimod.pcl
129 echo "`pwd`/conf/mpimod.pc" >> conf/mpimod.pcl
130 if $FC -c -cl,conf/mpimod.pcl $FCFLAGS $FCFLAGS_SRCEXT conftest1.$ac_ext >>conftest.out 2>&1 ; then
131 MODDIRFLAG='-cl,mpimod.pcl'
132 AC_MSG_RESULT([-cl,filename where filename contains a list of files and directories])
133 F90_WORK_FILES_ARG="-cl,mpimod.pcl"
134 F90MODINCSPEC="-cl,<dir>/<file>mod.pcl"
135 AC_SUBST(F90_WORK_FILES_ARG)
136 else
137 # The version of the Intel compiler that I have refuses to let
138 # you put the "work catalog" list anywhere but the current
139 # directory. For example, you cannot in
140 :
141 fi
142 fi
143 if test -z "MODDIRFLAG" ; then
144 AC_MSG_RESULT(unknown)
145 fi
146 AC_SUBST(MODDIRFLAG)
147 AC_SUBST(F90MODINCSPEC)
148 rm -f conftest* conf/conftest* conf/CONFTEST* CONFTEST* conf/mpimod*
149 if test $madedir = 1 ; then rmdir conf ; fi
150 fi
151
152 ])
153
154 AC_DEFUN(ACX_CHECK_CC_FLAGS,
155 [
156 AC_REQUIRE([AC_PROG_CC])
157 AC_CACHE_CHECK(whether ${CC} accepts $1, ac_$2,
158 [echo 'void f(){}' > conftest.c
159 if test -z "`${CC} $1 -c conftest.c 2>&1`"; then
160 ac_$2=yes
161 else
162 ac_$2=no
163 fi
164 rm -f conftest*
165 ])
166 if test "$ac_$2" = yes; then
167 :
168 $3
169 else
170 :
171 $4
172 fi
173 ])
174
175 AC_DEFUN(ACX_CHECK_CXX_FLAGS,
176 [
177 AC_REQUIRE([AC_PROG_CXX])
178 AC_CACHE_CHECK(whether ${CXX} accepts $1, ac_$2,
179 [echo 'void f(){}' > conftest.cpp
180 if test -z "`${CXX} $1 -c conftest.cpp 2>&1`"; then
181 ac_$2=yes
182 else
183 ac_$2=no
184 fi
185 rm -f conftest*
186 ])
187 if test "$ac_$2" = yes; then
188 :
189 $3
190 else
191 :
192 $4
193 fi
194 ])
195
196 dnl -------------------------------------------------------------------------
197 dnl ACX_CHECK_FC_FLAGS()
198 dnl
199 dnl Check for optimizer flags the Fortran compiler can use.
200 dnl
201 AC_DEFUN(ACX_CHECK_FC_FLAGS,
202 [
203 AC_CACHE_CHECK(whether ${FC} accepts $1, ac_$2,
204 [
205 AC_LANG_SAVE
206 AC_LANG(Fortran)
207 echo 'program main' > conftest.$ac_ext
208 echo 'end program main' >> conftest.$ac_ext
209 ac_compile='${FC} -c $1 $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext 1>&AC_FD_CC'
210 if AC_TRY_EVAL(ac_compile); then
211 ac_$2=yes
212 else
213 ac_$2=no
214 fi
215 rm -f conftest*
216 AC_LANG_RESTORE()
217 ])
218 if test "$ac_$2" = yes; then
219 :
220 $3
221 else
222 :
223 $4
224 fi
225 ])
226
227 AC_DEFUN(ACX_PROG_GCC_VERSION,
228 [
229 AC_REQUIRE([AC_PROG_CC])
230 AC_CACHE_CHECK(whether we are using gcc $1.$2 or later, ac_cv_prog_gcc_$1_$2,
231 [
232 dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp.
233 cat > conftest.c <<EOF
234 #ifdef __GNUC__ && !defined (__INTEL_COMPILER)
235 # if (__GNUC__ > $1) || (__GNUC__ == $1 && __GNUC_MINOR__ >= $2)
236 yes;
237 # endif
238 #endif
239 EOF
240 if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
241 ac_cv_prog_gcc_$1_$2=yes
242 else
243 ac_cv_prog_gcc_$1_$2=no
244 fi
245 ])
246 if test "$ac_cv_prog_gcc_$1_$2" = yes; then
247 :
248 $3
249 else
250 :
251 $4
252 fi
253 ])
254
255 AC_DEFUN(ACX_PROG_GXX_VERSION,
256 [
257 AC_REQUIRE([AC_PROG_CXX])
258 AC_CACHE_CHECK(whether we are using g++ $1.$2 or later, ac_cv_prog_gxx_$1_$2,
259 [
260 dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp.
261 cat > conftest.cpp <<EOF
262 #ifdef __GNUC__ && !defined (__INTEL_COMPILER)
263 # if (__GNUC__ > $1) || (__GNUC__ == $1 && __GNUC_MINOR__ >= $2)
264 yes;
265 # endif
266 #endif
267 EOF
268 if AC_TRY_COMMAND(${CXX-c++} -E conftest.cpp) | egrep yes >/dev/null 2>&1; then
269 ac_cv_prog_gxx_$1_$2=yes
270 else
271 ac_cv_prog_gxx_$1_$2=no
272 fi
273 ])
274 if test "$ac_cv_prog_gxx_$1_$2" = yes; then
275 :
276 $3
277 else
278 :
279 $4
280 fi
281 ])
282
283 AC_DEFUN(ACX_PROG_REALLY_GCC,
284 [
285 AC_REQUIRE([AC_PROG_CC])
286 AC_CACHE_CHECK(whether we are *really* using GNU cc, ac_cv_prog_really_gcc,
287 [
288 dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp.
289 cat > conftest.c <<EOF
290 #ifdef __GNUC__
291 #if defined(__INTEL_COMPILER) || defined(__PATHCC__)
292 no;
293 #else
294 yes;
295 #endif
296 #endif
297 EOF
298 if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
299 ac_cv_prog_really_gcc=yes
300 else
301 ac_cv_prog_really_gcc=no
302 fi
303 ])
304 if test "$ac_cv_prog_really_gcc" = yes; then
305 :
306 $1
307 else
308 :
309 $2
310 fi
311 ])
312
313 AC_DEFUN(ACX_PROG_REALLY_GXX,
314 [
315 AC_REQUIRE([AC_PROG_CXX])
316 AC_CACHE_CHECK(whether we are *really* using GNU c++, ac_cv_prog_really_gxx,
317 [
318 dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp.
319 cat > conftest.cpp <<EOF
320 #ifdef __GNUC__
321 #if defined(__INTEL_COMPILER) || defined(__PATHCC__)
322 no;
323 #else
324 yes;
325 #endif
326 #endif
327 EOF
328 if AC_TRY_COMMAND(${CXX-c++} -E conftest.cpp) | egrep yes >/dev/null 2>&1; then
329 ac_cv_prog_really_gxx=yes
330 else
331 ac_cv_prog_really_gxx=no
332 fi
333 ])
334 if test "$ac_cv_prog_really_gxx" = yes; then
335 :
336 $1
337 else
338 :
339 $2
340 fi
341 ])
342
343
344 AC_DEFUN(ACX_PROG_CC_MAXOPT,
345 [
346 AC_REQUIRE([AC_PROG_CC])
347 AC_REQUIRE([AC_CANONICAL_HOST])
348
349 ACX_PROG_REALLY_GCC
350
351 # Try to determine "good" native compiler flags if none specified on command
352 # line
353 if test "$ac_test_CFLAGS" != "set"; then
354 CFLAGS=""
355 case "${host_cpu}-${host_os}" in
356
357 *linux*) if test "$CC" = icc; then
358 CFLAGS="-O"
359 fi;;
360 sparc-solaris2*) if test "$CC" = cc; then
361 CFLAGS="-O -dalign"
362 fi;;
363
364 alpha*-osf*) if test "$CC" = cc; then
365 CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host -arch host -std1"
366 fi;;
367
368 hppa*-hpux*) if test "$CC" = cc; then
369 CFLAGS="-Ae +O3 +Oall"
370 fi;;
371
372 rs6000*-aix*) if test "$CC" = cc -o "$CC" = xlc; then
373 CFLAGS="-O3 -qtune=auto -qansialias -w"
374 fi;;
375 powerpc*-aix*)
376 if test "$CC" = cc -o "$CC" = xlc; then
377 CFLAGS="-O3 -qtune=auto -qansialias -w"
378 echo "*******************************************************"
379 echo "* You have AIX on an unknown powerpc system. It is *"
380 echo "* recommended that you use *"
381 echo "* *"
382 echo "* CFLAGS=-O3 -qarch=ppc -qtune=xxx -qansialias -w *"
383 echo "* ^^^ *"
384 echo "* where xxx is 601, 603, 604, or whatever kind of *"
385 echo "* PowerPC CPU you have. For more info, man cc. *"
386 echo "*******************************************************"
387 fi;;
388 *darwin*)
389 if test "$CC" = xlc -o "$CC" = cc; then
390 CFLAGS="-qthreaded -O -qtune=auto -qarch=auto -qunroll=auto -qaltivec"
391 fi
392 if test "$CC" = icc; then
393 CFLAGS="-O3 -ip -no-prec-div -mdynamic-no-pic"
394 fi;;
395 esac
396
397 # use default flags for gcc on all systems
398 if test $ac_cv_prog_really_gcc = yes; then
399 CFLAGS="-O6 -fomit-frame-pointer -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic"
400 fi
401
402 # test for gcc-specific flags:
403 if test $ac_cv_prog_really_gcc = yes; then
404 # -malign-double for x86 systems
405 ACX_CHECK_CC_FLAGS(-malign-double,align_double, CFLAGS="$CFLAGS -malign-double")
406 # -fstrict-aliasing for gcc-2.95+
407 ACX_CHECK_CC_FLAGS(-fstrict-aliasing,fstrict_aliasing, CFLAGS="$CFLAGS -fstrict-aliasing")
408 fi
409
410 CPU_FLAGS=""
411 if test $ac_cv_prog_really_gcc = yes; then
412 dnl try to guess correct CPU flags, at least for linux
413 case "${host_cpu}" in
414 i586*) ACX_CHECK_CC_FLAGS(-mcpu=pentium,cpu_pentium,
415 [CPU_FLAGS=-mcpu=pentium],
416 [ACX_CHECK_CC_FLAGS(-mpentium,pentium,
417 [CPU_FLAGS=-mpentium])])
418 ;;
419 i686*) ACX_CHECK_CC_FLAGS(-mcpu=pentiumpro,cpu_pentiumpro,
420 [CPU_FLAGS=-mcpu=pentiumpro],
421 [ACX_CHECK_CC_FLAGS(-mpentiumpro,pentiumpro,
422 [CPU_FLAGS=-mpentiumpro])])
423 ;;
424 powerpc*)
425 cputype=`(grep cpu /proc/cpuinfo | head -1 | cut -d: -f2 | sed 's/ //g') 2> /dev/null`
426 is60x=`echo $cputype | egrep "^60[0-9]e?$"`
427 if test -n "$is60x"; then
428 ACX_CHECK_CC_FLAGS(-mcpu=$cputype,m_cpu_60x,
429 CPU_FLAGS=-mcpu=$cputype)
430 elif test "$cputype" = 750; then
431 ACX_PROG_GCC_VERSION(2,95,
432 ACX_CHECK_CC_FLAGS(-mcpu=750,m_cpu_750,
433 CPU_FLAGS=-mcpu=750))
434 fi
435 if test -z "$CPU_FLAGS"; then
436 ACX_CHECK_CC_FLAGS(-mcpu=powerpc,m_cpu_powerpc,
437 CPU_FLAGS=-mcpu=powerpc)
438 fi
439 if test -z "$CPU_FLAGS"; then
440 ACX_CHECK_CC_FLAGS(-mpowerpc,m_powerpc,
441 CPU_FLAGS=-mpowerpc)
442 fi
443 esac
444 fi
445
446 if test -n "$CPU_FLAGS"; then
447 CFLAGS="$CFLAGS $CPU_FLAGS"
448 fi
449
450 if test -z "$CFLAGS"; then
451 echo ""
452 echo "********************************************************"
453 echo "* WARNING: Don't know the best CFLAGS for this system *"
454 echo "* Use make CFLAGS=..., or edit the top level Makefile *"
455 echo "* (otherwise, a default of CFLAGS=-O3 will be used) *"
456 echo "********************************************************"
457 echo ""
458 CFLAGS="-O3"
459 fi
460
461 ACX_CHECK_CC_FLAGS(${CFLAGS}, guessed_cflags, , [
462 echo ""
463 echo "********************************************************"
464 echo "* WARNING: The guessed CFLAGS don't seem to work with *"
465 echo "* your compiler. *"
466 echo "* Use make CFLAGS=..., or edit the top level Makefile *"
467 echo "********************************************************"
468 echo ""
469 CFLAGS=""
470 ])
471
472 fi
473 ])
474
475 AC_DEFUN(ACX_PROG_CXX_MAXOPT,
476 [
477 AC_REQUIRE([AC_PROG_CXX])
478 AC_REQUIRE([AC_CANONICAL_HOST])
479
480 ACX_PROG_REALLY_GXX
481
482 # Try to determine "good" native compiler flags if none specified on command
483 # line
484 if test "$ac_test_CXXFLAGS" != "set"; then
485 CXXFLAGS=""
486 case "${host_cpu}-${host_os}" in
487
488 *linux*) if test "$CXX" = icc -o "$CXX" = icpc; then
489 CXXFLAGS="-O"
490 fi;;
491 sparc-solaris2*) if test "$CXX" = CC; then
492 CXXFLAGS="-features=extensions -O -dalign"
493 fi;;
494 rs6000*-aix*) if test "$CXX" = xlC; then
495 CXXFLAGS="-O3 -qarch=pwrx -qtune=pwrx -qansialias -w"
496 fi;;
497 powerpc*-aix*)
498 if test "$CXX" = xlC; then
499 CXXFLAGS="-O3 -qarch=ppc -qansialias -w"
500 echo "*******************************************************"
501 echo "* You have AIX on an unknown powerpc system. It is *"
502 echo "* recommended that you use *"
503 echo "* *"
504 echo "* CXXFLAGS=-O3 -qarch=ppc -qtune=xxx -qansialias -w *"
505 echo "* ^^^ *"
506 echo "* where xxx is 601, 603, 604, or whatever kind of *"
507 echo "* PowerPC CPU you have. For more info, man cc. *"
508 echo "*******************************************************"
509 fi;;
510 *darwin*)
511 if test "$CXX" = xlc++ -o "$CXX" = xlC ; then
512 CXXFLAGS="-qthreaded -O -qtune=auto -qarch=auto -qunroll=auto -qaltivec"
513 fi
514 if test "$CXX" = icpc; then
515 CXXFLAGS="-O3 -ip -no-prec-div -mdynamic-no-pic"
516 fi;;
517 esac
518
519 # use default flags for gcc on all systems
520 if test $ac_cv_prog_really_gxx = yes; then
521 CXXFLAGS="-O6 -fomit-frame-pointer -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic"
522 fi
523
524 # test for gcc-specific flags:
525 if test $ac_cv_prog_really_gxx = yes; then
526 # -malign-double for x86 systems
527 ACX_CHECK_CXX_FLAGS(-malign-double,align_double, CXXFLAGS="$CXXFLAGS -malign-double")
528 # -fstrict-aliasing for gcc-2.95+
529 ACX_CHECK_CXX_FLAGS(-fstrict-aliasing,fstrict_aliasing, CXXFLAGS="$CXXFLAGS -fstrict-aliasing")
530 fi
531
532 CPU_FLAGS=""
533 if test $ac_cv_prog_really_gxx = yes; then
534 dnl try to guess correct CPU flags, at least for linux
535 case "${host_cpu}" in
536 i586*) ACX_CHECK_CXX_FLAGS(-mcpu=pentium,cpu_pentium,
537 [CPU_FLAGS=-mcpu=pentium],
538 [ACX_CHECK_CXX_FLAGS(-mpentium,pentium,
539 [CPU_FLAGS=-mpentium])])
540 ;;
541 i686*) ACX_CHECK_CXX_FLAGS(-mcpu=pentiumpro,cpu_pentiumpro,
542 [CPU_FLAGS=-mcpu=pentiumpro],
543 [ACX_CHECK_CXX_FLAGS(-mpentiumpro,pentiumpro,
544 [CPU_FLAGS=-mpentiumpro])])
545 ;;
546 powerpc*)
547 cputype=`(grep cpu /proc/cpuinfo | head -1 | cut -d: -f2 | sed 's/ //g') 2> /dev/null`
548 is60x=`echo $cputype | egrep "^60[0-9]e?$"`
549 if test -n "$is60x"; then
550 ACX_CHECK_CXX_FLAGS(-mcpu=$cputype,m_cpu_60x,
551 CPU_FLAGS=-mcpu=$cputype)
552 elif test "$cputype" = 750; then
553 ACX_PROG_GXX_VERSION(2,95,
554 ACX_CHECK_CXX_FLAGS(-mcpu=750,m_cpu_750,
555 CPU_FLAGS=-mcpu=750))
556 fi
557 if test -z "$CPU_FLAGS"; then
558 ACX_CHECK_CXX_FLAGS(-mcpu=powerpc,m_cpu_powerpc,
559 CPU_FLAGS=-mcpu=powerpc)
560 fi
561 if test -z "$CPU_FLAGS"; then
562 ACX_CHECK_CXX_FLAGS(-mpowerpc,m_powerpc,
563 CPU_FLAGS=-mpowerpc)
564 fi
565 esac
566 fi
567
568 if test -n "$CPU_FLAGS"; then
569 CXXFLAGS="$CXXFLAGS $CPU_FLAGS"
570 fi
571
572 if test -z "$CXXFLAGS"; then
573 echo ""
574 echo "**********************************************************"
575 echo "* WARNING: Don't know the best CXXFLAGS for this system *"
576 echo "* Use make CXXFLAGS=..., or edit the top level Makefile *"
577 echo "* (otherwise, a default of CXXFLAGS=-O3 will be used) *"
578 echo "**********************************************************"
579 echo ""
580 CXXFLAGS="-O3"
581 fi
582
583 ACX_CHECK_CXX_FLAGS(${CXXFLAGS}, guessed_cxxflags, , [
584 echo ""
585 echo "**********************************************************"
586 echo "* WARNING: The guessed CXXFLAGS don't seem to work with *"
587 echo "* your compiler. *"
588 echo "* Use make CXXFLAGS=..., or edit the top level Makefile *"
589 echo "**********************************************************"
590 echo ""
591 CXXFLAGS=""
592 ])
593
594 fi
595 ])
596
597 AC_DEFUN(ACX_PROG_FC_MAXOPT,
598 [
599 AC_REQUIRE([AC_PROG_FC])
600 AC_REQUIRE([AC_CANONICAL_HOST])
601
602 # Try to determine "good" native compiler flags if none specified on command
603 # line
604
605 if test "$ac_test_FFLAGS" != "set"; then
606 FCFLAGS=""
607 case "${host_cpu}-${host_os}" in
608
609 *linux*) if test "$FC" = ifc -o "$FC" = ifort; then
610 FCFLAGS="-fast"
611 fi;;
612 rs6000*-aix*) if test "$FC" = xlf90 -o "$FC" = f90 -o "$FC" = xlf95; then
613 FCFLAGS="-O3 -qarch=pwrx -qtune=pwrx -qansialias -w"
614 fi;;
615 powerpc*-aix*)
616 if test "$FC" = f90 -o "$FC" = xlf90 -o "$FC" = xlf95; then
617 FCFLAGS="-O3 -qarch=ppc -qansialias -w"
618 echo "*******************************************************"
619 echo "* You have AIX on an unknown powerpc system. It is *"
620 echo "* recommended that you use *"
621 echo "* *"
622 echo "* FCFLAGS=-O3 -qarch=ppc -qtune=xxx -qansialias -w *"
623 echo "* ^^^ *"
624 echo "* where xxx is 601, 603, 604, or whatever kind of *"
625 echo "* PowerPC CPU you have. For more info, man xlf. *"
626 echo "*******************************************************"
627 fi;;
628 *darwin*)
629 if test "$FC" = f90 -o "$FC" = xlf90 -o "$FC" = xlf95; then
630 FCFLAGS="-qthreaded -O -qtune=auto -qarch=auto -qunroll=auto"
631 fi
632 if test "$FC" = ifort; then
633 FCFLAGS="-O3 -ip -no-prec-dev -mdynamic-no-pic"
634 fi;;
635 esac
636
637 if test -n "$CPU_FLAGS"; then
638 FCFLAGS="$FCFLAGS $CPU_FLAGS"
639 fi
640
641 if test -z "$FCFLAGS"; then
642 echo ""
643 echo "*********************************************************"
644 echo "* WARNING: Don't know the best FCFLAGS for this system *"
645 echo "* Use make FCFLAGS=..., or edit the top level Makefile *"
646 echo "* (otherwise, a default of FCFLAGS=-O3 will be used) *"
647 echo "*********************************************************"
648 echo ""
649 FCFLAGS="-O3"
650 fi
651
652 ACX_CHECK_FC_FLAGS(${FCFLAGS}, guessed_f90flags, , [
653 echo ""
654 echo "**********************************************************"
655 echo "* WARNING: The guessed FCFLAGS don't seem to work with *"
656 echo "* your compiler. *"
657 echo "* Use make FCFLAGS=..., or edit the top level Makefile *"
658 echo "*********************************************************"
659 echo ""
660 FCFLAGS=""
661 ])
662
663 fi
664 ])
665
666 AC_DEFUN(ACX_PROG_F90_PREPFLAG,
667 [
668 AC_REQUIRE([AC_PROG_FC])
669 AC_REQUIRE([AC_CANONICAL_HOST])
670
671 # Try to determine native compiler flags that allow us to use F90 suffix
672 # for preprocessed f90 source.
673
674 if test "$ac_test_PREPFLAG" != "set"; then
675 PREPFLAG=""
676 case "${host_cpu}-${host_os}" in
677
678 *linux*) if test "$FC" = ifc -o "$FC" = ifort; then
679 PREPFLAG="-fpp1 "
680 fi;;
681 *aix*) if test "$FC" = xlf90 -o "$FC" = f90 -o "$FC" = xlf95; then
682 PREPFLAG="-qsuffix=cpp=F90 "
683 fi;;
684 *darwin*)
685 if test "$FC" = f90 -o "$FC" = xlf90 -o "$FC" = xlf95; then
686 PREPFLAG="-qsuffix=cpp=F90 "
687 fi;;
688 esac
689
690 if test -z "$PREPFLAG"; then
691 AC_MSG_WARN("Using empty PREPFLAG")
692 PREPFLAG=""
693 fi
694
695 AC_MSG_CHECKING(to make sure F90 preprocessor flag works)
696 AC_LANG_SAVE()
697 AC_LANG(Fortran)
698 ac_save_ext=$ac_ext
699 ac_ext=F90
700 ac_save_FCFLAGS_SRCEXT=$FCFLAGS_SRCEXT
701
702 AS_IF([test "$PREPFLAG"], [FCFLAGS_SRCEXT="${PREPFLAG}"])
703 _AC_COMPILE_IFELSE([
704 AC_LANG_SOURCE([
705 program conftest
706 integer :: i
707 i = 1
708 end program conftest
709 ])], [prepflagworks=1], [prepflagworks=0])
710
711 FCFLAGS_SRCEXT=$ac_save_FCFLAGS_SRCEXT
712 ac_ext=$ac_save_ext
713 AC_LANG_RESTORE()
714
715 if test "$prepflagworks" = 1; then
716 AC_MSG_RESULT(yes)
717 FCFLAGS_SRCEXT="${PREPFLAG}"
718 AC_SUBST(FCFLAGS_SRCEXT)
719 else
720 AC_MSG_RESULT(no)
721 AC_MSG_ERROR([Can't figure out working Fortran90 preprocessor flag])
722 fi
723 fi
724 ])
725
726
727 AC_DEFUN(ACX_PROG_F90_PREPDEFFLAG,
728 [
729 AC_REQUIRE([AC_PROG_FC])
730 AC_REQUIRE([AC_CANONICAL_HOST])
731
732 # Try to determine native compiler flags that allow us to use F90 suffix
733 # for preprocessed f90 source with -D type defines
734
735 if test "$ac_test_PREPDEFFLAG" != "set"; then
736 PREPDEFFLAG=""
737 case "${host_cpu}-${host_os}" in
738
739 *linux*) if test "$FC" = ifc -o "$FC" = ifort; then
740 PREPDEFFLAG=" "
741 fi;;
742 *aix*) if test "$FC" = xlf90 -o "$FC" = f90 -o "$FC" = xlf95; then
743 PREPDEFFLAG="-WF,"
744 fi;;
745 *darwin*)
746 if test "$FC" = f90 -o "$FC" = xlf90 -o "$FC" = xlf95; then
747 PREPDEFFLAG="-WF,"
748 fi;;
749 esac
750
751 if test -z "$PREPDEFFLAG"; then
752 AC_MSG_WARN("Using empty PREPDEFFLAG")
753 PREPDEFFLAG=" "
754 fi
755
756 AC_MSG_CHECKING(to make sure F90 preprocessor define flag works)
757 AC_LANG_SAVE()
758 AC_LANG(Fortran)
759 ac_save_ext=$ac_ext
760 ac_ext=F90
761 ac_save_FCFLAGS=$FCFLAGS
762
763 AS_IF([test "$PREPDEFFLAG"], [FCFLAGS="${FCFLAGS} ${PREPDEFFLAG}-DTEST"])
764 _AC_COMPILE_IFELSE([
765 AC_LANG_SOURCE([
766 program conftest
767 integer :: i
768 #ifdef TEST
769 i = 1
770 #else
771 choke me
772 #endif
773 end program conftest
774 ])], [prepdefflagworks=1], [prepdefflagworks=0])
775
776 FCFLAGS=$ac_save_FCFLAGS
777 ac_ext=$ac_save_ext
778 AC_LANG_RESTORE()
779
780 if test "$prepdefflagworks" = 1; then
781 AC_MSG_RESULT(yes)
782 AC_SUBST(PREPDEFFLAG)
783 else
784 AC_MSG_RESULT(no)
785 AC_MSG_ERROR([Can't figure out working Fortran90 preprocessor define flag])
786 fi
787 fi
788 ])
789
790 dnl check for the required MPI library
791 AC_DEFUN([ACX_MPI], [
792
793 # Set variables...
794 MPI_LIB_DIR="$MPI/lib"
795 MPI_INC_DIR="$MPI/include"
796 AC_SUBST([MPI_LIB_DIR])
797 AC_SUBST([MPI_INC_DIR])
798
799 AC_MSG_CHECKING([for mpi.h])
800 have_mpi_h=0
801 rm -f conftest*
802 echo '#include <mpi.h>' > conftest.cc
803 if ${CXX} -I${MPI_INC_DIR} -c conftest.cc 2>&1 ; then
804 AC_MSG_RESULT(yes)
805 have_mpi_h=1
806 else
807 if test -s conftest.out ; then
808 cat conftest.out >> config.log
809 fi
810 AC_MSG_RESULT(no! Check MPI include paths)
811 USE_MPI="no"
812 fi
813 rm -f conftest*
814 if test "$have_mpi_h" = 1; then
815 AC_DEFINE(HAVE_MPI_H, 1, [have mpi.h])
816 fi
817
818 AC_MSG_CHECKING([whether mpif.h is usable])
819 have_mpif_h=0
820 rm -f conftest*
821 cat >conftest.$ac_ext <<EOF
822 program main
823 include 'mpif.h'
824 end
825 EOF
826 if $FC -I$MPI_INC_DIR -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext > conftest.out 2>&1 ; then
827 AC_MSG_RESULT(yes)
828 MPI_F90_INC="$MPI_INC_DIR"
829 have_mpif_h=1
830 else
831 if test -s conftest.out ; then
832 cat conftest.out >> config.log
833 fi
834 AC_MSG_RESULT([no! Check MPI include paths])
835 USE_MPI="no"
836 fi
837 rm -f conftest*
838 AC_SUBST(MPI_F90_INC)
839 if test "$have_mpif_h" = 1; then
840 AC_DEFINE(HAVE_MPIF_H, 1, [have mpif.h])
841 fi
842
843 AC_LANG_PUSH(C)
844 ac_save_LDFLAGS=$LDFLAGS
845 LDFLAGS="${LDFLAGS} -L${MPI_LIB_DIR} "
846
847 if test x = x"$MPI_LIB"; then
848 AC_CHECK_LIB(mpich, MPI_Init, [MPI_LIB="-lmpich"])
849 fi
850 if test x = x"$MPI_LIB"; then
851 AC_CHECK_LIB(mpi, MPI_Init, [MPI_LIB="-lmpi"])
852 fi
853 $as_unset ac_cv_lib_mpi_MPI_Init
854 if test x = x"$MPI_LIB"; then
855 AC_CHECK_LIB(mpi, MPI_Init, [MPI_LIB="-lmpi -llam"], [],
856 "-llam")
857 fi
858 $as_unset ac_cv_lib_mpich_MPI_Init
859 if test x = x"$MPI_LIB"; then
860 AC_CHECK_LIB(mpich, MPI_Init, [MPI_LIB="-lpmpich -lmpich"], [],
861 "-lpmpich")
862 fi
863
864 $as_unset ac_cv_lib_mpi_MPI_Init
865 if test x = x"$MPI_LIB"; then
866 AC_CHECK_LIB(mpi, MPI_Init, [MPI_LIB="-lmpi -llam -lpthread"],[
867 AC_MSG_ERROR([Didn't find liblam, libmpi, or libmpich; check path for MPI package first...])
868 USE_MPI="no"
869 ],
870 [-llam -lpthread])
871 fi
872
873 AC_SUBST(MPI_LIB)
874
875 AC_MSG_CHECKING([for MPI Fortran library])
876 MPI_F90_LIB=""
877 if test -f "$MPI_LIB_DIR/libfmpich.a" ; then
878 MPI_F90_LIB="-lfmpich"
879 elif test -f "$MPI_LIB_DIR/liblamf77mpi.a" ; then
880 MPI_F90_LIB="-llamf77mpi"
881 else
882 dnl nothing special found, we'll assume that the C
883 dnl library is all we need
884 MPI_F90_LIB=" "
885 fi
886 AC_MSG_RESULT([found $MPI_F90_LIB])
887 AC_SUBST(MPI_F90_LIB)
888 ])dnl ACX_MPI
889
890 AC_DEFUN([adl_FUNC_GETOPT_LONG],
891 [AC_PREREQ(2.49)dnl
892 # clean out junk possibly left behind by a previous configuration
893 rm -f src/getopt.h
894 # Check for getopt_long support
895 AC_CHECK_HEADERS([getopt.h])
896 AC_CHECK_FUNCS([getopt_long],,
897 [# FreeBSD has a gnugetopt library for this
898 AC_CHECK_LIB([gnugetopt],[getopt_long],[AC_DEFINE([HAVE_GETOPT_LONG])],
899 [# use the GNU replacement
900 AC_LIBOBJ(getopt)
901 AC_LIBOBJ(getopt1)
902 AC_CONFIG_LINKS([src/getopt.h:src/utils/gnugetopt.h])])])])
903
904
905 AC_DEFUN([ACX_CONFIG_HOME], [
906 myDir=${0%/*}
907 if [ "$myDir" = "$0" ]; then
908 # Ran from local directory
909 myDir=$PWD
910 fi
911 # Resolve symlinks.
912 myProgram="$0"
913 while [ -L "$myProgram" ]; do
914 ls=`/bin/ls -ld "$myProgram"`
915 link=`/usr/bin/expr "$ls" : '.*-> \(.*\)$'`
916 if /usr/bin/expr "$link" : '.*/.*' > /dev/null; then
917 myProgram="$link"
918 else
919 myProgram="`AS_DIRNAME([$myProgram])`/$link"
920 fi
921 done
922 myDir=`AS_DIRNAME([$myProgram])`
923 fi
924 CONFIG_HOME=$myDir
925 ])
926
927 AC_DEFUN(BB_ENABLE_DOXYGEN,
928 [
929 AC_ARG_ENABLE(doxygen, [ --enable-doxygen enable documentation generation with doxygen (auto)])
930 AC_ARG_ENABLE(dot, [ --enable-dot use 'dot' to generate graphs in doxygen (auto)])
931 AC_ARG_ENABLE(html-docs, [ --enable-html-docs enable HTML generation with doxygen (yes)], [], [ enable_html_docs=yes])
932 AC_ARG_ENABLE(latex-docs, [ --enable-latex-docs enable LaTeX documentation generation with doxygen (no)], [], [ enable_latex_docs=no])
933 if test "x$enable_doxygen" = xno; then
934 enable_doc=no
935 else
936 AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
937 if test "x$DOXYGEN" = x; then
938 if test "x$enable_doxygen" = xyes; then
939 AC_MSG_ERROR([could not find doxygen])
940 fi
941 enable_doc=no
942 else
943 enable_doc=yes
944 AC_PATH_PROG(DOT, dot, , $PATH)
945 fi
946 fi
947
948 if test "x$enable_doc" = xyes; then
949 DOC=1
950 else
951 DOC=0
952 fi
953 AC_SUBST(DOC)
954
955 if test x$DOT = x; then
956 if test "x$enable_dot" = xyes; then
957 AC_MSG_ERROR([could not find dot])
958 fi
959 enable_dot=no
960 else
961 enable_dot=yes
962 fi
963 AC_SUBST(enable_dot)
964 AC_SUBST(enable_html_docs)
965 AC_SUBST(enable_latex_docs)
966 ])
967 #
968 #
969 #
970 AC_DEFUN([AX_SYS_PERLSHARPBANG],[dnl
971
972 AC_PATH_PROG(PERLINTERP,perl,perl)
973 ac_cv_path_perlinterp="$PERLINTERP"
974 _sHpB='#!'
975
976 AC_ARG_WITH(perl-shebang,
977 AC_HELP_STRING([--with-perl-shebang],
978 [override what perl thinks is the way for the kernel to start it (seldom needed)]dnl
979 ),
980 [opt_perl_shebang="$withval"]dnl
981 ,dnl
982 [opt_perl_shebang="not_set"]dnl
983 )dnl
984
985 AC_CACHE_CHECK([whether explicit instead of detected sharpbang is to be used],
986 ax_cv_opt_perl_shebang,
987 [ case "$opt_perl_shebang" in
988 not_set ) ax_cv_opt_perl_shebang=''
989 ;;
990 * )
991 ax_cv_opt_perl_shebang=`echo "$opt_perl_shebang" | sed -e's|^#!\s*\(.*\)$|\1|'`
992 esac
993 ]dnl
994 )dnl
995
996 if test "A$ax_cv_opt_perl_shebang" != "A"
997 then
998 ac_cv_sys_kernshrpbang_perl="$ax_cv_opt_perl_shebang"
999 PERL_SHEBANG="$ac_cv_sys_kernshrpbang_perl"
1000 AC_SUBST(PERL_SHEBANG)dnl
1001 AC_MSG_NOTICE([OK - PERL_SHEBANG is $_sHpB$PERL_SHEBANG.])
1002
1003 # Automatic detection of sharpbang formula starts here
1004 else dnl
1005
1006 _somian_shbangperl=`$PERLINTERP -V:startperl`
1007 negclass="[[^']]"; dnl
1008 # must leave this comment: m4 will remove the outer brackets for us, heheh
1009 AC_CACHE_CHECK([for kernel sharpbang invocation to start perl],
1010 ac_cv_sys_kernshrpbang_perl,
1011 [_somian_kspb_perl=`echo "$_somian_shbangperl" | sed -ne"s|.*='\($negclass*\)';$|\1|p"`
1012 if test "x$_somian_kspb_perl" == x
1013 then _somian_ksbp_warn_empty='durnit'
1014 else
1015 case "A$_somian_kspb_perl" in
1016 A#!*perl* )
1017 ac_cv_sys_kernshrpbang_perl=`echo "$_somian_kspb_perl" | sed -e's|#!\(.*\)$|\1|'`
1018 ;;
1019 A* ) _somian_ksbp_warn_defau='trouble'
1020 ac_cv_sys_kernshrpbang_perl="$PERLINTERP"
1021 esac
1022 fi
1023 ])dnl Done with testing sharpbang
1024
1025 # The above prints Checking ... result message to user.
1026 PERL_SHEBANG="$ac_cv_sys_kernshrpbang_perl"
1027 AC_SUBST(PERL_SHEBANG)
1028 if test A${_somian_ksbp_warn_empty+set} == Aset
1029 then AC_MSG_WARN([dnl
1030 In last check, doing $PERLINTERP -V:startperl yielded empty result! That should not happen.])
1031 fi
1032 # Inform user after printing result value
1033 if test A${_somian_ksbp_warn_defau+set} == Aset
1034 then AC_MSG_NOTICE([Maybe Not good -])
1035 AC_MSG_WARN([dnl
1036 In last check perl's Config query did not work so we bunted: $_sHpB$PERLINTERP])
1037 else AC_MSG_NOTICE([OK Good result - ])
1038 AC_MSG_NOTICE([dnl
1039 In last check we got a proper-looking answer from perl's Config: $_somian_shbangperl])
1040 dnl Done with user info messages
1041 fi
1042 dnl Outer loop checked for user override term here
1043 fi dnl
1044
1045 ])dnl EOMACRO DEF
1046
1047 AC_DEFUN([ACX_CHECK_ZLIB],
1048 #
1049 # Handle user hints
1050 #
1051 [AC_MSG_CHECKING(if zlib is wanted)
1052 AC_ARG_WITH(zlib,
1053 [ --with-zlib=DIR root directory path of zlib installation [defaults to
1054 /usr/local or /usr if not found in /usr/local]
1055 --without-zlib to disable zlib usage completely],
1056 [if test "$withval" != no ; then
1057 AC_MSG_RESULT(yes)
1058 if test -d "$withval"
1059 then
1060 ZLIB_HOME="$withval"
1061 else
1062 AC_MSG_WARN([Sorry, $withval does not exist, checking usual places])
1063 fi
1064 else
1065 AC_MSG_RESULT(no)
1066 fi])
1067
1068 ZLIB_HOME=/usr/local
1069 if test ! -f "${ZLIB_HOME}/include/zlib.h"
1070 then
1071 ZLIB_HOME=/usr
1072 fi
1073
1074 #
1075 # Locate zlib, if wanted
1076 #
1077 if test -n "${ZLIB_HOME}"
1078 then
1079 ZLIB_OLD_LDFLAGS=$LDFLAGS
1080 ZLIB_OLD_CPPFLAGS=$LDFLAGS
1081 LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
1082 CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
1083 AC_LANG_SAVE
1084 AC_LANG_C
1085 AC_CHECK_LIB(z, inflateEnd, [zlib_cv_libz=yes], [zlib_cv_libz=no])
1086 AC_CHECK_HEADER(zlib.h, [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no])
1087 AC_LANG_RESTORE
1088 if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes"
1089 then
1090 #
1091 # If both library and header were found, use them
1092 #
1093 AC_CHECK_LIB(z, inflateEnd)
1094 AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
1095 AC_MSG_RESULT(ok)
1096 else
1097 #
1098 # If either header or library was not found, revert and bomb
1099 #
1100 AC_MSG_CHECKING(zlib in ${ZLIB_HOME})
1101 LDFLAGS="$ZLIB_OLD_LDFLAGS"
1102 CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
1103 AC_MSG_RESULT(failed)
1104 AC_MSG_ERROR(either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib)
1105 fi
1106 fi
1107
1108 ])
1109 # AC_F90_MODULE_NAMES
1110 # -------------------
1111 #
1112 # Figure out how the Fortran 90 compiler constructs module file names
1113 #
1114 AC_DEFUN([AC_F90_MODULE_NAMES],
1115 [AC_REQUIRE([AC_PROG_FC])dnl
1116 AC_CACHE_CHECK([for Fortran 90 module file names],
1117 ac_cv_f90_module_names,
1118 [AC_LANG_PUSH(Fortran)
1119 # carry out the test in a new directory, so that we don't miss anything
1120 mkdir conftest
1121 cd conftest
1122 AC_COMPILE_IFELSE(
1123 [MODULE Bar
1124 END MODULE Bar],
1125 ac_cv_f90_module_names=
1126 [ac_file_list=*
1127 for ac_file in $ac_file_list; do
1128 case $ac_file in
1129 # don't care for original source and object files
1130 conftest.$ac_ext | conftest.$ac_objext | conftest.err )
1131 :
1132 ;;
1133 # look for new files derived from the file name
1134 *conftest*)
1135 ac_pat=`echo $ac_file | sed s/conftest/%FILE%/`
1136 _AC_LIST_MEMBER_IF($ac_pat, $ac_cv_f90_module_names,,
1137 ac_cv_f90_module_names="$ac_cv_f90_module_names $ac_pat")
1138 ;;
1139 # look for new files derived from the module name,
1140 # with different case translation schemes
1141 *Bar*)
1142 ac_pat=`echo $ac_file | sed s/Bar/%Module%/`
1143 _AC_LIST_MEMBER_IF($ac_pat, $ac_cv_f90_module_names,,
1144 ac_cv_f90_module_names="$ac_cv_f90_module_names $ac_pat")
1145 ;;
1146 *bar*)
1147 ac_pat=`echo $ac_file | sed s/bar/%module%/`
1148 _AC_LIST_MEMBER_IF($ac_pat, $ac_cv_f90_module_names,,
1149 ac_cv_f90_module_names="$ac_cv_f90_module_names $ac_pat")
1150 ;;
1151 *BAR*)
1152 ac_pat=`echo $ac_file | sed s/BAR/%MODULE%/`
1153 _AC_LIST_MEMBER_IF($ac_pat, $ac_cv_f90_module_names,,
1154 ac_cv_f90_module_names="$ac_cv_f90_module_names $ac_pat")
1155 ;;
1156 # Other files - we have no idea how they are generated
1157 *)
1158 AC_MSG_WARN([Bogus file found: $ac_file])
1159 ;;
1160 esac
1161 done
1162 if test "x$ac_cv_f90_module_names" = "x"; then
1163 AC_MSG_WARN([Couldn't determine module file names])
1164 fi
1165 ],
1166 [ac_cv_f90_module_names=
1167 AC_MSG_WARN([Couldn't determine module file names])])
1168 cd ..
1169 # cleanup
1170 rm -rf conftest
1171 AC_LANG_POP()dnl
1172 ]) # AC_CACHE_CHECK
1173
1174 # We now generate a shell script that will help us to figure out the correct
1175 # module file names, using the value of ac_cv_f90_module_names
1176
1177 echo "Generating shell script modnam"
1178
1179 cat > scripts/modnam << EOF
1180 #! /bin/sh
1181 # This script is auto-generated by configure
1182 #
1183 usage="\\
1184 Usage: \$[0] [[FILES]]
1185
1186 [[FILES]] are Fortran 90 source files.
1187 The output is a list of module file names that the Fortran 90 compiler
1188 generates when compiling [[FILES]]."
1189
1190 list=
1191 empty=
1192
1193 if test \$[@%:@] -eq 0; then
1194 echo "\$usage"; exit 0
1195 fi
1196
1197 while test \$[@%:@] != 0; do
1198
1199 file=\$[1]
1200 shift
1201
1202 # strip suffix
1203 base=\`echo \$file | sed 's/[[.]][[^.]]*$//'\`
1204
1205 test ! -f \$file && continue
1206
1207 # Look for module definitions and transform them to upper / lower case
1208 mods=\`cat \$file | sed '/^ *[[mM][oO][dD][uU][lL][eE]]/!d;s/^ *[[mM][oO][dD][uU][lL][eE]] *\([[A-Za-z_][A-Za-z0-9_]]*\).*\$/\1/'\`
1209 upper=\`echo \$mods | tr a-z A-Z\`
1210 lower=\`echo \$mods | tr A-Z a-z\`
1211
1212 # Here, the patterns for generating module file names were inserted by configure
1213 for trans in $ac_cv_f90_module_names; do
1214
1215 pat=\`echo \$trans | sed 's/.*\(%.*%\).*/\1/'\`
1216 var=empty
1217 case \$pat in
1218 %MODULE%)
1219 var=upper ;;
1220 %Module%)
1221 var=mods ;;
1222 %module%)
1223 var=lower ;;
1224 %FILE%)
1225 test -n "\$mods" && var=base ;;
1226 esac
1227 new=\`eval '(for i in \$'\$var '; do echo \$trans | sed s/\$pat/\$i/; done)'\`
1228 list="\$list \$new"
1229 done
1230 done
1231
1232 echo \$list
1233 # end of configure-generated script
1234 EOF
1235 chmod 755 scripts/modnam
1236 ]) # AC_F90_MODULE_NAMES