| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | AC_DEFUN([PAC_LANG_FORTRAN90], |
|---|
| 8 | [AC_REQUIRE([PAC_PROG_F90]) |
|---|
| 9 | define([AC_LANG], [FORTRAN90]) |
|---|
| 10 | ac_ext=$pac_cv_f90_ext |
|---|
| 11 | ac_compile='${F90-f90} -c $F90FLAGS conftest.$ac_ext 1>&AC_FD_CC' |
|---|
| 12 | ac_link='${F90-f90} -o conftest${ac_exeext} $F90FLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | ]) |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | AC_DEFUN([PAC_TRY_F90_COMPILE], |
|---|
| 23 | [AC_REQUIRE([PAC_LANG_FORTRAN90]) |
|---|
| 24 | ifelse(AC_LANG, FORTRAN90,,[AC_LANG_SAVE |
|---|
| 25 | PAC_LANG_FORTRAN90 |
|---|
| 26 | define([NEED_POP],yes)]) |
|---|
| 27 | cat > conftest.$ac_ext <<EOF |
|---|
| 28 | program main |
|---|
| 29 | [$2] |
|---|
| 30 | end |
|---|
| 31 | EOF |
|---|
| 32 | if AC_TRY_EVAL(ac_compile); then |
|---|
| 33 | ifelse([$3], , :, [rm -rf conftest* |
|---|
| 34 | $3]) |
|---|
| 35 | else |
|---|
| 36 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 37 | cat conftest.$ac_ext >&AC_FD_CC |
|---|
| 38 | ifelse([$4], , , [ rm -rf conftest* |
|---|
| 39 | $4 |
|---|
| 40 | ]) |
|---|
| 41 | fi |
|---|
| 42 | rm -f conftest* |
|---|
| 43 | |
|---|
| 44 | rm -f work.pc work.pcl |
|---|
| 45 | ifelse(NEED_POP,yes,[ |
|---|
| 46 | undefine([NEED_POP]) |
|---|
| 47 | AC_LANG_RESTORE]) |
|---|
| 48 | ]) |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | AC_DEFUN([PAC_F90_MODULE_EXT], |
|---|
| 62 | [AC_CACHE_CHECK([for Fortran 90 module extension], |
|---|
| 63 | pac_cv_f90_module_ext,[ |
|---|
| 64 | |
|---|
| 65 | pac_cv_f90_module_case="unknown" |
|---|
| 66 | rm -f conftest* |
|---|
| 67 | |
|---|
| 68 | rm -f work.pc work.pcl |
|---|
| 69 | cat >conftest.$ac_f90ext <<EOF |
|---|
| 70 | module conftest |
|---|
| 71 | integer n |
|---|
| 72 | parameter (n=1) |
|---|
| 73 | end module conftest |
|---|
| 74 | EOF |
|---|
| 75 | if AC_TRY_EVAL(ac_f90compile) ; then |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | for name in conftest CONFTEST ; do |
|---|
| 80 | for ext in mod MOD ; do |
|---|
| 81 | if test -s $name.$ext ; then |
|---|
| 82 | if test $name = conftest ; then |
|---|
| 83 | pac_cv_f90_module_case=lower |
|---|
| 84 | else |
|---|
| 85 | pac_cv_f90_module_case=upper |
|---|
| 86 | fi |
|---|
| 87 | pac_cv_f90_module_ext=$ext |
|---|
| 88 | pac_MOD=$ext |
|---|
| 89 | break |
|---|
| 90 | fi |
|---|
| 91 | done |
|---|
| 92 | if test -n "$pac_cv_f90_module_ext" ; then break ; fi |
|---|
| 93 | done |
|---|
| 94 | if test -z "$pac_MOD" ; then |
|---|
| 95 | |
|---|
| 96 | pac_MOD=`ls conftest.* 2>&1 | grep -v conftest.$ac_f90ext | grep -v conftest.o` |
|---|
| 97 | pac_MOD=`echo $pac_MOD | sed -e 's/conftest\.//g'` |
|---|
| 98 | pac_cv_f90_module_case="lower" |
|---|
| 99 | if test "X$pac_MOD" = "X" ; then |
|---|
| 100 | pac_MOD=`ls CONFTEST* 2>&1 | grep -v CONFTEST.f | grep -v CONFTEST.o` |
|---|
| 101 | pac_MOD=`echo $pac_MOD | sed -e 's/CONFTEST\.//g'` |
|---|
| 102 | if test -n "$pac_MOD" ; then |
|---|
| 103 | testname="CONFTEST" |
|---|
| 104 | pac_cv_f90_module_case="upper" |
|---|
| 105 | fi |
|---|
| 106 | fi |
|---|
| 107 | if test -z "$pac_MOD" ; then |
|---|
| 108 | pac_cv_f90_module_ext="unknown" |
|---|
| 109 | else |
|---|
| 110 | pac_cv_f90_module_ext=$pac_MOD |
|---|
| 111 | fi |
|---|
| 112 | fi |
|---|
| 113 | else |
|---|
| 114 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 115 | cat conftest.$ac_f90ext >&AC_FD_CC |
|---|
| 116 | pac_cv_f90_module_ext="unknown" |
|---|
| 117 | fi |
|---|
| 118 | rm -f conftest* |
|---|
| 119 | |
|---|
| 120 | rm -f work.pc work.pcl |
|---|
| 121 | ]) |
|---|
| 122 | if test -s work.pcl ; then |
|---|
| 123 | AC_MSG_WARN([Compiler generates auxillery files (work.pcl)!]) |
|---|
| 124 | fi |
|---|
| 125 | AC_SUBST(F90MODEXT) |
|---|
| 126 | if test "$pac_cv_f90_module_ext" = "unknown" ; then |
|---|
| 127 | ifelse($2,,:,[$2]) |
|---|
| 128 | else |
|---|
| 129 | ifelse($1,,F90MODEXT=$pac_MOD,[$1]) |
|---|
| 130 | fi |
|---|
| 131 | ]) |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | AC_DEFUN([PAC_F90_MODULE_INCFLAG],[ |
|---|
| 137 | AC_CACHE_CHECK([for Fortran 90 module include flag], |
|---|
| 138 | pac_cv_f90_module_incflag,[ |
|---|
| 139 | AC_REQUIRE([PAC_F90_MODULE_EXT]) |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | rm -f work.pc work.pcl conftest.$ac_f90ext |
|---|
| 144 | cat >conftest.$ac_f90ext <<EOF |
|---|
| 145 | module conftest |
|---|
| 146 | integer n |
|---|
| 147 | parameter (n=1) |
|---|
| 148 | end module conftest |
|---|
| 149 | EOF |
|---|
| 150 | pac_madedir="no" |
|---|
| 151 | if test ! -d conftestdir ; then mkdir conftestdir ; pac_madedir="yes"; fi |
|---|
| 152 | if test "$pac_cv_f90_module_case" = "upper" ; then |
|---|
| 153 | pac_module="CONFTEST.$pac_cv_f90_module_ext" |
|---|
| 154 | else |
|---|
| 155 | pac_module="conftest.$pac_cv_f90_module_ext" |
|---|
| 156 | fi |
|---|
| 157 | if AC_TRY_EVAL(ac_f90compile) ; then |
|---|
| 158 | if test -s "$pac_module" ; then |
|---|
| 159 | mv $pac_module conftestdir |
|---|
| 160 | |
|---|
| 161 | |
|---|
| 162 | if test -f work.pc ; then |
|---|
| 163 | mv -f work.pc conftest.pc |
|---|
| 164 | fi |
|---|
| 165 | rm -f work.pcl |
|---|
| 166 | else |
|---|
| 167 | AC_MSG_WARN([Unable to build a simple F90 module]) |
|---|
| 168 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 169 | cat conftest.$ac_f90ext >&AC_FD_CC |
|---|
| 170 | fi |
|---|
| 171 | else |
|---|
| 172 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 173 | cat conftest.$ac_f90ext >&AC_FD_CC |
|---|
| 174 | fi |
|---|
| 175 | rm -f conftest.$ac_f90ext |
|---|
| 176 | cat >conftest.$ac_f90ext <<EOF |
|---|
| 177 | program main |
|---|
| 178 | use conftest |
|---|
| 179 | end |
|---|
| 180 | EOF |
|---|
| 181 | pac_cv_f90_module_incflag="unknown" |
|---|
| 182 | if ${F90-f90} -c $F90FLAGS -Iconftestdir conftest.$ac_f90ext 1>&AC_FD_CC 2>&1 && \ |
|---|
| 183 | test -s conftest.o ; then |
|---|
| 184 | pac_cv_f90_module_incflag="-I" |
|---|
| 185 | elif ${F90-f90} -c $F90FLAGS -Mconftestdir conftest.$ac_f90ext 1>&AC_FD_CC 2>&1 && \ |
|---|
| 186 | test -s conftest.o ; then |
|---|
| 187 | pac_cv_f90_module_incflag="-M" |
|---|
| 188 | elif ${F90-f90} -c $F90FLAGS -pconftestdir conftest.$ac_f90ext 1>&AC_FD_CC 2>&1 && \ |
|---|
| 189 | test -s conftest.o ; then |
|---|
| 190 | pac_cv_f90_module_incflag="-p" |
|---|
| 191 | elif test -s work.pc ; then |
|---|
| 192 | mv conftest.pc conftestdir/mpimod.pc |
|---|
| 193 | echo "mpimod.pc" > conftestdir/mpimod.pcl |
|---|
| 194 | echo "`pwd`/conftestdir/mpimod.pc" >> conftestdir/mpimod.pcl |
|---|
| 195 | if ${F90-f90} -c $F90FLAGS -cl,conftestdir/mpimod.pcl conftest.$ac_f90ext 1>&AC_FD_CC 2>&1 && test -s conftest.o ; then |
|---|
| 196 | pac_cv_f90_module_incflag='-cl,' |
|---|
| 197 | |
|---|
| 198 | AC_MSG_RESULT([-cl,filename where filename contains a list of files and directories]) |
|---|
| 199 | F90_WORK_FILES_ARG="-cl,mpimod.pcl" |
|---|
| 200 | F90MODINCSPEC="-cl,<dir>/<file>mod.pcl" |
|---|
| 201 | AC_SUBST(F90_WORK_FILES_ARG) |
|---|
| 202 | else |
|---|
| 203 | |
|---|
| 204 | |
|---|
| 205 | pac_cv_f90_module_incflag="Unavailable!" |
|---|
| 206 | fi |
|---|
| 207 | else |
|---|
| 208 | |
|---|
| 209 | |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | |
|---|
| 213 | |
|---|
| 214 | |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | |
|---|
| 218 | |
|---|
| 219 | pac_cv_f90_module_incflag="unknown" |
|---|
| 220 | fi |
|---|
| 221 | if test "$pac_madedir" = "yes" ; then rm -rf conftestdir ; fi |
|---|
| 222 | rm -f conftest* |
|---|
| 223 | |
|---|
| 224 | rm -f work.pc work.pcl |
|---|
| 225 | ]) |
|---|
| 226 | AC_SUBST(F90MODINCFLAG) |
|---|
| 227 | F90MODINCFLAG=$pac_cv_f90_module_incflag |
|---|
| 228 | ]) |
|---|
| 229 | AC_DEFUN([PAC_F90_MODULE],[ |
|---|
| 230 | PAC_F90_MODULE_EXT |
|---|
| 231 | PAC_F90_MODULE_INCFLAG |
|---|
| 232 | ]) |
|---|
| 233 | AC_DEFUN([PAC_F90_EXT],[ |
|---|
| 234 | AC_CACHE_CHECK([whether Fortran 90 accepts f90 suffix], |
|---|
| 235 | pac_cv_f90_ext_f90,[ |
|---|
| 236 | save_ac_f90ext=$ac_f90ext |
|---|
| 237 | ac_f90ext="f90" |
|---|
| 238 | PAC_TRY_F90_COMPILE(,,pac_cv_f90_ext_f90="yes",pac_cv_f90_ext_f90="no") |
|---|
| 239 | ac_f90ext=$save_ac_f90ext |
|---|
| 240 | ]) |
|---|
| 241 | ]) |
|---|
| 242 | |
|---|
| 243 | |
|---|
| 244 | |
|---|
| 245 | |
|---|
| 246 | |
|---|
| 247 | |
|---|
| 248 | |
|---|
| 249 | |
|---|
| 250 | |
|---|
| 251 | AC_DEFUN([PAC_PROG_F90_INT_KIND],[ |
|---|
| 252 | |
|---|
| 253 | $1=-1 |
|---|
| 254 | if test "$pac_cv_prog_f90_cross" = "yes" ; then |
|---|
| 255 | $1="$3" |
|---|
| 256 | else |
|---|
| 257 | if test -n "$ac_f90compile" ; then |
|---|
| 258 | AC_MSG_CHECKING([for Fortran 90 integer kind for $2-byte integers]) |
|---|
| 259 | |
|---|
| 260 | case $2 in |
|---|
| 261 | 1) sellen=2 ;; |
|---|
| 262 | 2) sellen=4 ;; |
|---|
| 263 | 4) sellen=8 ;; |
|---|
| 264 | 8) sellen=16 ;; |
|---|
| 265 | 16) sellen=30 ;; |
|---|
| 266 | *) sellen=8 ;; |
|---|
| 267 | esac |
|---|
| 268 | |
|---|
| 269 | eval testval=\$"pac_cv_prog_f90_int_kind_$sellen" |
|---|
| 270 | if test -n "$testval" ; then |
|---|
| 271 | AC_MSG_RESULT([$testval (cached)]) |
|---|
| 272 | $1=$testval |
|---|
| 273 | else |
|---|
| 274 | |
|---|
| 275 | rm -f conftest* |
|---|
| 276 | cat <<EOF > conftest.$ac_f90ext |
|---|
| 277 | program main |
|---|
| 278 | integer i |
|---|
| 279 | i = selected_int_kind($sellen) |
|---|
| 280 | open(8, file="conftest1.out", form="formatted") |
|---|
| 281 | write (8,*) i |
|---|
| 282 | close(8) |
|---|
| 283 | stop |
|---|
| 284 | end |
|---|
| 285 | EOF |
|---|
| 286 | KINDVAL="unavailable" |
|---|
| 287 | eval "pac_cv_prog_f90_int_kind_$sellen"=-1 |
|---|
| 288 | if AC_TRY_EVAL(ac_f90link) && test -s conftest ; then |
|---|
| 289 | ./conftest 1>&AC_FD_CC 2>&1 |
|---|
| 290 | if test -s conftest1.out ; then |
|---|
| 291 | |
|---|
| 292 | KINDVAL=`cat conftest1.out | sed 's/ //g'` |
|---|
| 293 | eval "pac_cv_prog_f90_int_kind_$sellen"=$KINDVAL |
|---|
| 294 | $1=$KINDVAL |
|---|
| 295 | fi |
|---|
| 296 | fi |
|---|
| 297 | rm -f conftest* |
|---|
| 298 | |
|---|
| 299 | rm -f work.pc work.pcl |
|---|
| 300 | AC_MSG_RESULT($KINDVAL) |
|---|
| 301 | fi |
|---|
| 302 | fi |
|---|
| 303 | fi |
|---|
| 304 | ]) |
|---|
| 305 | |
|---|
| 306 | |
|---|
| 307 | |
|---|
| 308 | |
|---|
| 309 | |
|---|
| 310 | |
|---|
| 311 | |
|---|
| 312 | |
|---|
| 313 | |
|---|
| 314 | |
|---|
| 315 | |
|---|
| 316 | |
|---|
| 317 | |
|---|
| 318 | |
|---|
| 319 | |
|---|
| 320 | |
|---|
| 321 | |
|---|
| 322 | |
|---|
| 323 | |
|---|
| 324 | |
|---|
| 325 | |
|---|
| 326 | |
|---|
| 327 | AC_DEFUN([PAC_PROG_F90],[ |
|---|
| 328 | if test -z "$F90" ; then |
|---|
| 329 | AC_CHECK_PROGS(F90,f90 xlf90 pgf90 ifort epcf90 f95 fort xlf95 lf95 pathf95 pathf90 g95 gfortran ifc efc) |
|---|
| 330 | test -z "$F90" && AC_MSG_WARN([no acceptable Fortran 90 compiler found in \$PATH]) |
|---|
| 331 | fi |
|---|
| 332 | if test -n "$F90" ; then |
|---|
| 333 | PAC_PROG_F90_WORKS |
|---|
| 334 | fi |
|---|
| 335 | |
|---|
| 336 | ac_f90ext=$pac_cv_f90_ext |
|---|
| 337 | ac_f90compile='${F90-f90} -c $F90FLAGS conftest.$ac_f90ext 1>&AC_FD_CC' |
|---|
| 338 | ac_f90link='${F90-f90} -o conftest${ac_exeext} $F90FLAGS $LDFLAGS conftest.$ac_f90ext $LIBS 1>&AC_FD_CC' |
|---|
| 339 | |
|---|
| 340 | if test "$pac_cv_prog_f90_works" = yes ; then |
|---|
| 341 | cat > conftest.$ac_f90ext <<EOF |
|---|
| 342 | program main |
|---|
| 343 | end |
|---|
| 344 | EOF |
|---|
| 345 | pac_msg=`$F90 -o conftest $F90FLAGS $LDFLAGS conftest.$ac_f90ext $LIBS 2>&1 | grep 'bfd assertion fail'` |
|---|
| 346 | if test -n "$pac_msg" ; then |
|---|
| 347 | pac_msg=`$F90 -o conftest $F90FLAGS $LDFLAGS conftest.$ac_f90ext -i_dynamic $LIBS 2>&1 | grep 'bfd assertion fail'` |
|---|
| 348 | if test -z "$pac_msg" ; then LDFLAGS="-i_dynamic" ; fi |
|---|
| 349 | |
|---|
| 350 | fi |
|---|
| 351 | fi |
|---|
| 352 | ]) |
|---|
| 353 | |
|---|
| 354 | |
|---|
| 355 | AC_DEFUN([PAC_PROG_F90_WORKS], |
|---|
| 356 | [AC_MSG_CHECKING([for extension for Fortran 90 programs]) |
|---|
| 357 | pac_cv_f90_ext="f90" |
|---|
| 358 | cat > conftest.$pac_cv_f90_ext <<EOF |
|---|
| 359 | program conftest |
|---|
| 360 | end |
|---|
| 361 | EOF |
|---|
| 362 | ac_compile='${F90-f90} -c $F90FLAGS conftest.$pac_cv_f90_ext 1>&AC_FD_CC' |
|---|
| 363 | if AC_TRY_EVAL(ac_compile) ; then |
|---|
| 364 | AC_MSG_RESULT([f90]) |
|---|
| 365 | else |
|---|
| 366 | rm -f conftest* |
|---|
| 367 | pac_cv_f90_ext="f" |
|---|
| 368 | cat > conftest.$pac_cv_f90_ext <<EOF |
|---|
| 369 | program conftest |
|---|
| 370 | end |
|---|
| 371 | EOF |
|---|
| 372 | if AC_TRY_EVAL(ac_compile) ; then |
|---|
| 373 | AC_MSG_RESULT([f]) |
|---|
| 374 | else |
|---|
| 375 | AC_MSG_RESULT([unknown!]) |
|---|
| 376 | fi |
|---|
| 377 | fi |
|---|
| 378 | AC_MSG_CHECKING([whether the Fortran 90 compiler ($F90 $F90FLAGS $LDFLAGS) works]) |
|---|
| 379 | AC_LANG_SAVE |
|---|
| 380 | |
|---|
| 381 | |
|---|
| 382 | |
|---|
| 383 | |
|---|
| 384 | |
|---|
| 385 | define([AC_LANG], [FORTRAN90]) |
|---|
| 386 | ac_ext=$pac_cv_f90_ext |
|---|
| 387 | ac_compile='${F90-f90} -c $F90FLAGS conftest.$ac_ext 1>&AC_FD_CC' |
|---|
| 388 | ac_link='${F90-f90} -o conftest${ac_exeext} $F90FLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' |
|---|
| 389 | |
|---|
| 390 | |
|---|
| 391 | |
|---|
| 392 | |
|---|
| 393 | |
|---|
| 394 | |
|---|
| 395 | |
|---|
| 396 | cat >conftest.$ac_ext <<EOF |
|---|
| 397 | program conftest |
|---|
| 398 | integer, dimension(10) :: n |
|---|
| 399 | end |
|---|
| 400 | EOF |
|---|
| 401 | if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeect} ; then |
|---|
| 402 | pac_cv_prog_f90_works="yes" |
|---|
| 403 | if (./conftest; exit) 2>/dev/null ; then |
|---|
| 404 | pac_cv_prog_f90_cross="no" |
|---|
| 405 | else |
|---|
| 406 | pac_cv_prog_f90_cross="yes" |
|---|
| 407 | fi |
|---|
| 408 | else |
|---|
| 409 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 410 | cat conftest.$ac_ext >&AC_FD_CC |
|---|
| 411 | pac_cv_prog_f90_works="no" |
|---|
| 412 | fi |
|---|
| 413 | rm -f conftest* |
|---|
| 414 | |
|---|
| 415 | rm -f work.pc work.pcl |
|---|
| 416 | AC_LANG_RESTORE |
|---|
| 417 | AC_MSG_RESULT($pac_cv_prog_f90_works) |
|---|
| 418 | if test $pac_cv_prog_f90_works = no; then |
|---|
| 419 | AC_MSG_WARN([installation or configuration problem: Fortran 90 compiler cannot create executables.]) |
|---|
| 420 | fi |
|---|
| 421 | AC_MSG_CHECKING([whether the Fortran 90 compiler ($F90 $F90FLAGS $LDFLAGS) is a cross-compiler]) |
|---|
| 422 | AC_MSG_RESULT($pac_cv_prog_f90_cross) |
|---|
| 423 | |
|---|
| 424 | |
|---|
| 425 | |
|---|
| 426 | |
|---|
| 427 | |
|---|
| 428 | ]) |
|---|
| 429 | |
|---|
| 430 | |
|---|
| 431 | |
|---|
| 432 | |
|---|
| 433 | |
|---|
| 434 | |
|---|
| 435 | |
|---|
| 436 | AC_DEFUN([PAC_PROG_F90_CHECK_SIZEOF],[ |
|---|
| 437 | changequote(<<,>>) |
|---|
| 438 | |
|---|
| 439 | |
|---|
| 440 | define(<<PAC_TYPE_NAME>>, translit(sizeof_f90_$1, [a-z *], [A-Z__])) |
|---|
| 441 | |
|---|
| 442 | define(<<PAC_CV_NAME>>, translit(pac_cv_f90_sizeof_$1, [ *], [__])) |
|---|
| 443 | changequote([,]) |
|---|
| 444 | AC_CACHE_CHECK([for size of Fortran type $1],PAC_CV_NAME,[ |
|---|
| 445 | AC_REQUIRE([PAC_PROG_F77_NAME_MANGLE]) |
|---|
| 446 | if test "$cross_compiling" = yes ; then |
|---|
| 447 | ifelse([$2],,[AC_MSG_WARN([No value provided for size of $1 when cross-compiling])] |
|---|
| 448 | ,eval PAC_CV_NAME=$2) |
|---|
| 449 | else |
|---|
| 450 | rm -f conftest* |
|---|
| 451 | cat <<EOF > conftestc.c |
|---|
| 452 | |
|---|
| 453 | |
|---|
| 454 | |
|---|
| 455 | |
|---|
| 456 | |
|---|
| 457 | |
|---|
| 458 | |
|---|
| 459 | |
|---|
| 460 | |
|---|
| 461 | int cisize_(char *,char*); |
|---|
| 462 | int cisize_(char *i1p, char *i2p) |
|---|
| 463 | { |
|---|
| 464 | int isize_val=0; |
|---|
| 465 | FILE *f = fopen("conftestval", "w"); |
|---|
| 466 | if (!f) return 1; |
|---|
| 467 | isize_val = (int)(i2p - i1p); |
|---|
| 468 | fprintf(f,"%d\n", isize_val ); |
|---|
| 469 | fclose(f); |
|---|
| 470 | return 0; |
|---|
| 471 | } |
|---|
| 472 | EOF |
|---|
| 473 | pac_tmp_compile='$CC -c $CFLAGS $CPPFLAGS conftestc.c >&5' |
|---|
| 474 | if AC_TRY_EVAL(pac_tmp_compile) && test -s conftestc.o ; then |
|---|
| 475 | AC_LANG_SAVE |
|---|
| 476 | AC_LANG_FORTRAN77 |
|---|
| 477 | saveLIBS=$LIBS |
|---|
| 478 | LIBS="conftestc.o $LIBS" |
|---|
| 479 | |
|---|
| 480 | |
|---|
| 481 | |
|---|
| 482 | cat >conftest.f <<EOF |
|---|
| 483 | program main |
|---|
| 484 | $1 a(2) |
|---|
| 485 | integer irc |
|---|
| 486 | irc = cisize(a(1),a(2)) |
|---|
| 487 | end |
|---|
| 488 | EOF |
|---|
| 489 | rm -f conftest$ac_exeext |
|---|
| 490 | rm -f conftestval |
|---|
| 491 | if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext ; then |
|---|
| 492 | if ./conftest$ac_exeext ; then |
|---|
| 493 | |
|---|
| 494 | : |
|---|
| 495 | else |
|---|
| 496 | |
|---|
| 497 | : |
|---|
| 498 | fi |
|---|
| 499 | else |
|---|
| 500 | |
|---|
| 501 | AC_MSG_WARN([Unable to build program to determine size of $1]) |
|---|
| 502 | fi |
|---|
| 503 | AC_LANG_RESTORE |
|---|
| 504 | if test -s conftestval ; then |
|---|
| 505 | eval PAC_CV_NAME=`cat conftestval` |
|---|
| 506 | else |
|---|
| 507 | eval PAC_CV_NAME=0 |
|---|
| 508 | fi |
|---|
| 509 | rm -f conftest* |
|---|
| 510 | |
|---|
| 511 | rm -f work.pc work.pcl |
|---|
| 512 | LIBS=$saveLIBS |
|---|
| 513 | else |
|---|
| 514 | AC_MSG_WARN([Unable to compile the C routine for finding the size of a $1]) |
|---|
| 515 | fi |
|---|
| 516 | fi |
|---|
| 517 | ]) |
|---|
| 518 | AC_DEFINE_UNQUOTED(PAC_TYPE_NAME,$PAC_CV_NAME,[Define size of PAC_TYPE_NAME]) |
|---|
| 519 | undefine([PAC_TYPE_NAME]) |
|---|
| 520 | undefine([PAC_CV_NAME]) |
|---|
| 521 | ]) |
|---|
| 522 | |
|---|
| 523 | |
|---|
| 524 | |
|---|
| 525 | |
|---|
| 526 | |
|---|
| 527 | |
|---|
| 528 | |
|---|
| 529 | |
|---|
| 530 | |
|---|
| 531 | AC_DEFUN([PAC_F90_AND_F77_COMPATIBLE],[ |
|---|
| 532 | AC_REQUIRE([PAC_PROG_F90_WORKS]) |
|---|
| 533 | AC_CACHE_CHECK([whether Fortran 90 works with Fortran 77], |
|---|
| 534 | pac_cv_f90_and_f77,[ |
|---|
| 535 | pac_cv_f90_and_f77="unknown" |
|---|
| 536 | rm -f conftest* |
|---|
| 537 | if test -z "$ac_ext_f90" ; then ac_ext_f90=$pac_cv_f90_ext ; fi |
|---|
| 538 | |
|---|
| 539 | link_f90='${F90-f90} -o conftest${ac_exeext} $F90FLAGS $LDFLAGS conftest1.$ac_ext_f90 conftest2.o $LIBS 1>&AC_FD_CC' |
|---|
| 540 | compile_f77='${F77-f77} -c $FFLAGS conftest2.f 1>&AC_FD_CC' |
|---|
| 541 | |
|---|
| 542 | pacTestRoutine=t1_2 |
|---|
| 543 | |
|---|
| 544 | ifelse([$3],,,[eval pacTestRoutine=$3]) |
|---|
| 545 | cat > conftest1.$ac_ext_f90 <<EOF |
|---|
| 546 | program main |
|---|
| 547 | integer a |
|---|
| 548 | a = 1 |
|---|
| 549 | call ${pacTestRoutine}(a) |
|---|
| 550 | end |
|---|
| 551 | EOF |
|---|
| 552 | cat > conftest2.f <<EOF |
|---|
| 553 | subroutine ${pacTestRoutine}(b) |
|---|
| 554 | integer b |
|---|
| 555 | b = b + 1 |
|---|
| 556 | end |
|---|
| 557 | EOF |
|---|
| 558 | |
|---|
| 559 | |
|---|
| 560 | |
|---|
| 561 | |
|---|
| 562 | if AC_TRY_EVAL(compile_f77) ; then |
|---|
| 563 | |
|---|
| 564 | rm -f work.pc work.pcl |
|---|
| 565 | if AC_TRY_EVAL(link_f90) && test -x conftest ; then |
|---|
| 566 | pac_cv_f90_and_f77="yes" |
|---|
| 567 | else |
|---|
| 568 | pac_cv_f90_and_f77="no" |
|---|
| 569 | fi |
|---|
| 570 | |
|---|
| 571 | rm -f work.pc work.pcl |
|---|
| 572 | else |
|---|
| 573 | |
|---|
| 574 | |
|---|
| 575 | pac_cv_f90_and_f77="no" |
|---|
| 576 | fi]) |
|---|
| 577 | |
|---|
| 578 | if test "$pac_cv_f90_and_f77" = yes ; then |
|---|
| 579 | ifelse($1,,:,[$1]) |
|---|
| 580 | else |
|---|
| 581 | ifelse($2,,:,[$2]) |
|---|
| 582 | fi |
|---|
| 583 | ]) |
|---|
| 584 | |
|---|
| 585 | |
|---|
| 586 | |
|---|
| 587 | |
|---|
| 588 | |
|---|
| 589 | |
|---|
| 590 | AC_DEFUN([PAC_PROG_F90_HAS_POINTER],[ |
|---|
| 591 | AC_CACHE_CHECK([whether Fortran 90 has Cray-style pointer declaration], |
|---|
| 592 | pac_cv_prog_f90_has_pointer,[ |
|---|
| 593 | AC_LANG_SAVE |
|---|
| 594 | PAC_LANG_FORTRAN90 |
|---|
| 595 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ |
|---|
| 596 | integer M |
|---|
| 597 | pointer (MPTR,M) |
|---|
| 598 | data MPTR/0/ |
|---|
| 599 | ])], |
|---|
| 600 | pac_cv_prog_f90_has_pointer="yes", |
|---|
| 601 | pac_cv_prog_f90_has_pointer="no") |
|---|
| 602 | AC_LANG_RESTORE |
|---|
| 603 | ]) |
|---|
| 604 | if test "$pac_cv_prog_f90_has_pointer" = "yes" ; then |
|---|
| 605 | ifelse([$1],,:,[$1]) |
|---|
| 606 | else |
|---|
| 607 | ifelse([$2],,:,[$2]) |
|---|
| 608 | fi |
|---|
| 609 | ]) |
|---|
| 610 | dnl/*D |
|---|
| 611 | dnl PAC_F90_CHECK_COMPILER_OPTION - Check that a F90 compiler option is |
|---|
| 612 | dnl accepted without warning messages |
|---|
| 613 | dnl |
|---|
| 614 | dnl Synopsis: |
|---|
| 615 | dnl PAC_F90_CHECK_COMPILER_OPTION(optionname,action-if-ok,action-if-fail) |
|---|
| 616 | dnl |
|---|
| 617 | dnl Output Effects: |
|---|
| 618 | dnl |
|---|
| 619 | dnl If no actions are specified, a working value is added to 'F90OPTIONS' |
|---|
| 620 | |
|---|
| 621 | |
|---|
| 622 | |
|---|
| 623 | |
|---|
| 624 | |
|---|
| 625 | |
|---|
| 626 | |
|---|
| 627 | |
|---|
| 628 | |
|---|
| 629 | |
|---|
| 630 | |
|---|
| 631 | AC_DEFUN([PAC_F90_CHECK_COMPILER_OPTION],[ |
|---|
| 632 | AC_MSG_CHECKING([whether Fortran 90 compiler accepts option $1]) |
|---|
| 633 | ac_result="no" |
|---|
| 634 | save_F90FLAGS="$F90FLAGS" |
|---|
| 635 | F90FLAGS="$1 $F90FLAGS" |
|---|
| 636 | rm -f conftest.out |
|---|
| 637 | cat >conftest2.$pac_cv_f90_ext <<EOF |
|---|
| 638 | subroutine try() |
|---|
| 639 | end |
|---|
| 640 | EOF |
|---|
| 641 | cat >conftest.$pac_cv_f90_ext <<EOF |
|---|
| 642 | program main |
|---|
| 643 | end |
|---|
| 644 | EOF |
|---|
| 645 | |
|---|
| 646 | |
|---|
| 647 | |
|---|
| 648 | ac_fscompilelink='${F90-f90} $save_F90FLAGS -o conftest conftest.$pac_cv_f90_ext $LDFLAGS >conftest.bas 2>&1' |
|---|
| 649 | ac_fscompilelink2='${F90-f90} $F90FLAGS -o conftest conftest.$pac_cv_f90_ext $LDFLAGS >conftest.out 2>&1' |
|---|
| 650 | if AC_TRY_EVAL(ac_fscompilelink) && test -x conftest ; then |
|---|
| 651 | if AC_TRY_EVAL(ac_fscompilelink2) && test -x conftest ; then |
|---|
| 652 | if diff -b conftest.out conftest.bas >/dev/null 2>&1 ; then |
|---|
| 653 | AC_MSG_RESULT(yes) |
|---|
| 654 | AC_MSG_CHECKING([whether routines compiled with $1 can be linked with ones compiled without $1]) |
|---|
| 655 | rm -f conftest2.out |
|---|
| 656 | rm -f conftest.bas |
|---|
| 657 | ac_fscompile3='${F90-f90} -c $save_F90FLAGS conftest2.$pac_cv_f90_ext >conftest2.out 2>&1' |
|---|
| 658 | ac_fscompilelink4='${F90-f90} $F90FLAGS -o conftest conftest2.o conftest.$pac_cv_f90_ext $LDFLAGS >conftest.bas 2>&1' |
|---|
| 659 | if AC_TRY_EVAL(ac_fscompile3) && test -s conftest2.o ; then |
|---|
| 660 | if AC_TRY_EVAL(ac_fscompilelink4) && test -x conftest ; then |
|---|
| 661 | if diff -b conftest.out conftest.bas >/dev/null 2>&1 ; then |
|---|
| 662 | ac_result="yes" |
|---|
| 663 | else |
|---|
| 664 | echo "configure: Compiler output differed in two cases" >&AC_FD_CC |
|---|
| 665 | diff -b conftest.out conftest.bas >&AC_FD_CC |
|---|
| 666 | fi |
|---|
| 667 | else |
|---|
| 668 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 669 | cat conftest.$pac_cv_f90_ext >&AC_FD_CC |
|---|
| 670 | fi |
|---|
| 671 | else |
|---|
| 672 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 673 | cat conftest2.$pac_cv_f90_ext >&AC_FD_CC |
|---|
| 674 | fi |
|---|
| 675 | else |
|---|
| 676 | |
|---|
| 677 | echo "configure: Compiler output differed in two cases" >&AC_FD_CC |
|---|
| 678 | diff -b conftest.out conftest.bas >&AC_FD_CC |
|---|
| 679 | fi |
|---|
| 680 | else |
|---|
| 681 | |
|---|
| 682 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 683 | cat conftest.$pac_cv_f90_ext >&AC_FD_CC |
|---|
| 684 | fi |
|---|
| 685 | if test "$ac_result" != "yes" -a -s conftest.out ; then |
|---|
| 686 | cat conftest.out >&AC_FD_CC |
|---|
| 687 | fi |
|---|
| 688 | else |
|---|
| 689 | |
|---|
| 690 | echo "configure: Could not compile program" >&AC_FD_CC |
|---|
| 691 | cat conftest.$pac_cv_f90_ext >&AC_FD_CC |
|---|
| 692 | cat conftest.bas >&AC_FD_CC |
|---|
| 693 | fi |
|---|
| 694 | |
|---|
| 695 | |
|---|
| 696 | F90FLAGS="$save_F90FLAGS" |
|---|
| 697 | if test "$ac_result" = "yes" ; then |
|---|
| 698 | AC_MSG_RESULT(yes) |
|---|
| 699 | ifelse($2,,F90OPTIONS="$F90OPTIONS $1",$2) |
|---|
| 700 | else |
|---|
| 701 | AC_MSG_RESULT(no) |
|---|
| 702 | $3 |
|---|
| 703 | fi |
|---|
| 704 | rm -f conftest* |
|---|
| 705 | ]) |
|---|