3
# Check whether the function "flush" is available. If not, try various flags
4
# in order to link to it successfully. Otherwise look for the "forflush"
5
# function. Add any appropriate flags to FFLAGS as needed and define
6
# F77_FLUSH to the name of the appropriate function.
7
# If flush routine is available set HAVE_F77_FLUSH to 1, otherwise 0.
8
AC_DEFUN([GA_F77_FLUSH], [
9
AC_CACHE_CHECK([for $F77 flush routine],
11
[AC_LANG_PUSH([Fortran 77])
12
for testflag in none -qextname=flush ; do
13
ga_save_FFLAGS=$FFLAGS
14
AS_IF([test "x$testflag" != xnone], [FFLAGS="$FFLAGS $testflag"])
15
AC_LINK_IFELSE([AC_LANG_SOURCE(
18
[ga_cv_f77_flush_flag=$testflag])
19
FFLAGS=$ga_save_FFLAGS
20
AS_IF([test "x$ga_cv_f77_flush_flag" != x], [break])
22
AS_IF([test "x$ga_cv_f77_flush_flag" != x], [ga_cv_f77_flush=flush],
23
[AC_LINK_IFELSE([AC_LANG_SOURCE(
26
[ga_cv_f77_flush=forflush])])
27
AC_LANG_POP([Fortran 77])])
28
AS_IF([test "x$ga_cv_f77_flush" != x],
29
[AC_DEFINE_UNQUOTED([F77_FLUSH], [$ga_cv_f77_flush],
30
[Name of F77 flush routine])
31
AC_DEFINE([HAVE_F77_FLUSH], [1],
32
[whether F77 flush routine is available])],
33
[AC_MSG_WARN([Could not determine name of $F77 flush routine])
34
AC_DEFINE([HAVE_F77_FLUSH], [0],
35
[whether F77 flush routine is available])])
36
AS_IF([test "x$ga_cv_f77_flush" = xflush],
37
[AS_IF([test "x$ga_cv_f77_flush_flag" != xnone],
38
[FFLAGS="$FFLAGS $ga_cv_f77_flush_flag"])])