1 |
|
dnl |
2 |
+ |
dnl AC_CHECK_MODSUFFIX |
3 |
+ |
dnl |
4 |
+ |
AC_DEFUN([AC_CHECK_MODSUFFIX],[ |
5 |
+ |
|
6 |
+ |
AC_MSG_CHECKING(for module suffix) |
7 |
+ |
rm -f conftest* |
8 |
+ |
# Intel ifc compiler generates files by the name of work.pc and work.pcl (!) |
9 |
+ |
rm -f work* |
10 |
+ |
cat >conftest.f <<EOF |
11 |
+ |
module conftest |
12 |
+ |
integer n |
13 |
+ |
parameter (n=1) |
14 |
+ |
end module conftest |
15 |
+ |
EOF |
16 |
+ |
# SGI and absoft compilers generates module name in upper case! |
17 |
+ |
testname="conftest" |
18 |
+ |
modcase="lower" |
19 |
+ |
if $F90 -c conftest.f > conftest.out 2>&1 ; then |
20 |
+ |
MOD=`ls conftest* | grep -v conftest.f | grep -v conftest.o` |
21 |
+ |
MOD=`echo "$MOD" | sed -e 's/conftest\.//g'` |
22 |
+ |
if test -z "$MOD" ; then |
23 |
+ |
MOD=`ls CONFTEST* 2>/dev/null \ |
24 |
+ |
| grep -v CONFTEST.f | grep -v CONFTEST.o` |
25 |
+ |
MOD=`echo "$MOD" | sed -e 's/CONFTEST\.//g'` |
26 |
+ |
if test -n "$MOD" ; then |
27 |
+ |
testname="CONFTEST" |
28 |
+ |
modcase="upper" |
29 |
+ |
fi |
30 |
+ |
fi |
31 |
+ |
if test -z "$MOD" ; then |
32 |
+ |
AC_MSG_RESULT(unknown) |
33 |
+ |
# Use mod if we can't figure it out |
34 |
+ |
MOD="mod" |
35 |
+ |
else |
36 |
+ |
AC_MSG_RESULT($MOD) |
37 |
+ |
fi |
38 |
+ |
if test -s work.pcl ; then |
39 |
+ |
AC_MSG_WARN([Compiler generates auxillery files!]) |
40 |
+ |
fi |
41 |
+ |
else |
42 |
+ |
AC_MSG_RESULT(unknown) |
43 |
+ |
fi |
44 |
+ |
AC_SUBST(MOD) |
45 |
+ |
|
46 |
+ |
]) |
47 |
+ |
|
48 |
+ |
|
49 |
+ |
dnl |
50 |
+ |
dnl AC_CHECK_MODDIRFLAG |
51 |
+ |
dnl |
52 |
+ |
AC_DEFUN([AC_CHECK_MODDIRFLAG],[ |
53 |
+ |
|
54 |
+ |
# Check for module include path (some use -I, some (Solaris) use -M, some |
55 |
+ |
# (absoft) use -p). |
56 |
+ |
# Intel compilers use a wierd system: -cl,filename.pcl . If no file is |
57 |
+ |
# specified, work.pcl and work.pc are created. However, if you specify |
58 |
+ |
# a file, it must contain a the name of a file ending in .pc . Ugh! |
59 |
+ |
# Use the module made above |
60 |
+ |
AC_MSG_CHECKING(for module directory path flag) |
61 |
+ |
madedir=0 |
62 |
+ |
if test ! -d conf ; then mkdir conf ; madedir=1; fi |
63 |
+ |
cp $testname.$MOD conf |
64 |
+ |
rm -f conftest* CONFTEST* |
65 |
+ |
cat >conftest1.f <<EOF |
66 |
+ |
program main |
67 |
+ |
use conftest |
68 |
+ |
print *, n |
69 |
+ |
end |
70 |
+ |
EOF |
71 |
+ |
F90_WORK_FILES_ARG="" |
72 |
+ |
F90MODINCSPEC="" |
73 |
+ |
if $F90 -c -Iconf conftest1.f > conftest.out 2>&1 ; then |
74 |
+ |
MODDIRFLAG="-I" |
75 |
+ |
F90MODINCSPEC="-I<dir>" |
76 |
+ |
AC_MSG_RESULT(-I) |
77 |
+ |
elif $F90 -c -Mconf conftest1.f >> conftest.out 2>&1 ; then |
78 |
+ |
MODDIRFLAG="-M" |
79 |
+ |
F90MODINCSPEC="-M<dir>" |
80 |
+ |
AC_MSG_RESULT(-M) |
81 |
+ |
elif $F90 -c -pconf conftest1.f >> conftest.out 2>&1 ; then |
82 |
+ |
MODDIRFLAG="-p" |
83 |
+ |
F90MODINCSPEC="-p<dir>" |
84 |
+ |
AC_MSG_RESULT(-p) |
85 |
+ |
elif test -s work.pc ; then |
86 |
+ |
cp work.pc conf/mpimod.pc |
87 |
+ |
echo "mpimod.pc" > conf/mpimod.pcl |
88 |
+ |
echo "`pwd`/conf/mpimod.pc" >> conf/mpimod.pcl |
89 |
+ |
if $F90 -c -cl,conf/mpimod.pcl conftest1.f >>conftest.out 2>&1 ; then |
90 |
+ |
MODDIRFLAG='-cl,mpimod.pcl' |
91 |
+ |
AC_MSG_RESULT([-cl,filename where filename contains a list of files and |
92 |
+ |
directories]) |
93 |
+ |
F90_WORK_FILES_ARG="-cl,mpimod.pcl" |
94 |
+ |
F90MODINCSPEC="-cl,<dir>/<file>mod.pcl" |
95 |
+ |
AC_SUBST(F90_WORK_FILES_ARG) |
96 |
+ |
else |
97 |
+ |
# The version of the Intel compiler that I have refuses to let |
98 |
+ |
# you put the "work catalog" list anywhere but the current directory. |
99 |
+ |
# For example, you cannot in |
100 |
+ |
: |
101 |
+ |
fi |
102 |
+ |
fi |
103 |
+ |
if test -z "MODDIRFLAG" ; then |
104 |
+ |
AC_MSG_RESULT(unknown) |
105 |
+ |
fi |
106 |
+ |
AC_SUBST(MODDIRFLAG) |
107 |
+ |
AC_SUBST(F90MODINCSPEC) |
108 |
+ |
rm -f conftest* conf/conftest* conf/CONFTEST* CONFTEST* conf/mpimod* |
109 |
+ |
if test $madedir = 1 ; then rmdir conf ; fi |
110 |
+ |
|
111 |
+ |
]) |
112 |
+ |
|
113 |
+ |
|
114 |
+ |
dnl |
115 |
|
dnl AC_CHECK_MPI_F90MOD |
116 |
|
dnl |
117 |
|
AC_DEFUN([AC_CHECK_MPI_F90MOD],[ |
125 |
|
AC_LANG_SAVE() |
126 |
|
AC_LANG([Fortran 90]) |
127 |
|
ac_save_F90FLAGS=$F90FLAGS |
128 |
< |
AS_IF([test "$mpi_f90_mods"], [F90FLAGS="${F90FLAGS} -I${mpi_f90_mods}"]) |
128 |
> |
|
129 |
> |
AS_IF([test "$mpi_f90_mods"], [F90FLAGS="${F90FLAGS} ${MODDIRFLAG}${mpi_f90_mods}"]) |
130 |
|
_AC_COMPILE_IFELSE([ |
131 |
|
AC_LANG_PROGRAM([ |
132 |
|
use mpi |
140 |
|
if test "$HAVE_MPI_MOD" = 1; then |
141 |
|
AC_MSG_RESULT(yes) |
142 |
|
AC_DEFINE(MPI_MOD, 1, [have mpi module]) |
143 |
< |
MPI_F90_MODS="-I${mpi_f90_mods}" |
143 |
> |
MPI_F90_MODS="${mpi_f90_mods}" |
144 |
|
AC_SUBST(MPI_F90_MODS) |
145 |
+ |
# The library name: |
146 |
+ |
if test -z "$MPI_LIB" ; then |
147 |
+ |
MPI_LIBNAME=-lmpich |
148 |
+ |
else |
149 |
+ |
MPI_LIBNAME="$MPI_LIB" |
150 |
+ |
fi |
151 |
+ |
if test -z "$MPIMODLIBNAME" ; then |
152 |
+ |
MPIMODLIBNAME="${MPI_LIBNAME}f90" |
153 |
+ |
fi |
154 |
+ |
AC_SUBST(MPIMODLIBNAME) |
155 |
|
else |
156 |
|
AC_MSG_RESULT(no) |
157 |
|
AC_MSG_ERROR([Couldn't locate MPI F90 Modules]) |
165 |
|
dnl |
166 |
|
AC_DEFUN([AM_PATH_SPRNG],[ |
167 |
|
|
168 |
< |
AC_ARG_WITH(sprng-prefix, [ --with-sprng-prefix=PREFIX |
168 |
> |
AC_ARG_WITH(sprng_prefix, [ --with-sprng_prefix=PREFIX |
169 |
|
Prefix where SPRNG is installed ], |
170 |
|
sprng_prefix="$withval", |
171 |
|
sprng_prefix="/usr/local") |
172 |
< |
AC_ARG_WITH(sprng-lib-prefix, [ --with-sprng-lib=PREFIX SPRNG library directory], |
173 |
< |
sprng_lib_prefix="$withval", |
174 |
< |
sprng_lib_prefix="/usr/local/lib") |
175 |
< |
AC_ARG_WITH(sprng-include-prefix, [ --with-sprng-include=PREFIX |
172 |
> |
AC_ARG_WITH(sprng-libdir, [ --with-sprng-libdir=PREFIX SPRNG library directory], |
173 |
> |
sprng_libdir="$withval", |
174 |
> |
sprng_libdir="/usr/local/lib") |
175 |
> |
AC_ARG_WITH(sprng-include, [ --with-sprng-include=PREFIX |
176 |
|
SPRNG include directory], |
177 |
< |
sprng_include_prefix="$withval", |
178 |
< |
sprng_include_prefix="/usr/local/include/sprng") |
177 |
> |
sprng_include="$withval", |
178 |
> |
sprng_include="/usr/local/include/sprng") |
179 |
|
|
180 |
< |
if test x$sprng_lib_prefix = x ; then |
181 |
< |
sprng_lib_prefix=${sprng_prefix}/lib |
180 |
> |
if test x$sprng_libdir = x ; then |
181 |
> |
sprng_libdir=${sprng_prefix}/lib |
182 |
|
fi |
183 |
|
|
184 |
< |
if test x$sprng_include_prefix = x ; then |
185 |
< |
sprng_include_prefix=${sprng_prefix}/include |
184 |
> |
if test x$sprng_include = x ; then |
185 |
> |
sprng_include=${sprng_prefix}/include |
186 |
|
fi |
187 |
|
|
188 |
< |
AC_MSG_CHECKING(for SPRNG include files in $sprng_include_prefix) |
189 |
< |
if test -f ${sprng_include_prefix}/sprng.h; then |
188 |
> |
AC_MSG_CHECKING(for SPRNG include files in $sprng_include) |
189 |
> |
if test -f ${sprng_include}/sprng.h; then |
190 |
|
have_sprngincl=yes |
191 |
|
AC_MSG_RESULT(yes) |
192 |
|
else |
195 |
|
AC_MSG_ERROR(Could not locate the SPRNG include files) |
196 |
|
fi |
197 |
|
|
198 |
< |
AC_MSG_CHECKING(for SPRNG libraries in $sprng_lib_prefix) |
199 |
< |
if test -f ${sprng_lib_prefix}/libsprng.a; then |
198 |
> |
AC_MSG_CHECKING(for SPRNG libraries in $sprng_libdir) |
199 |
> |
if test -f ${sprng_libdir}/libsprng.a; then |
200 |
|
have_sprnglib=yes |
201 |
|
AC_MSG_RESULT(yes) |
202 |
|
else |
208 |
|
AC_LANG_SAVE() |
209 |
|
AC_LANG([C]) |
210 |
|
ac_save_CPPFLAGS=$CPPFLAGS |
211 |
< |
CPPFLAGS="${CPPFLAGS} -I${sprng_include_prefix}" |
211 |
> |
CPPFLAGS="${CPPFLAGS} -I${sprng_include}" |
212 |
|
ac_save_LDFLAGS=$LDFLAGS |
213 |
< |
LDFLAGS="${LDFLAGS} -L${sprng_lib_prefix} -lsprng" |
213 |
> |
LDFLAGS="${LDFLAGS} -L${sprng_libdir} -lsprng" |
214 |
|
AC_CHECK_HEADER(sprng.h, [ |
215 |
|
AC_CHECK_LIB(sprng, |
216 |
|
init_rng, |
217 |
< |
[SPRNG_LIBDIR="${sprng_lib_prefix}" |
218 |
< |
SPRNG_LIB="-lsprng" SPRNG_INC="-I${sprng_include_prefix}" |
217 |
> |
[SPRNG_LIBDIR="${sprng_libdir}" |
218 |
> |
SPRNG_LIB="-lsprng" SPRNG_INC="-I${sprng_include}" |
219 |
|
HAVE_SPRNG="yes"])]) |
220 |
|
CPPFLAGS=$ac_save_CPPFLAGS |
221 |
|
LDFLAGS=$ac_save_LDFLAGS |
652 |
|
|
653 |
|
# Try to determine "good" native compiler flags if none specified on command |
654 |
|
# line |
655 |
< |
if test "$ac_test_F90FLAGS" != "set"; then |
655 |
> |
|
656 |
> |
if test x"$F90FLAGS" == x ; then |
657 |
|
F90FLAGS="" |
658 |
|
case "${host_cpu}-${host_os}" in |
659 |
|
|