Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 40 additions & 41 deletions ac/deps/m4/ax_fc_real8.m4
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ dnl avoiding any flags with affect integers, but this should still be used with
dnl some care.
dnl
dnl GCC -fdefault-real-8, -fdefault-double-8
dnl AMD (flang) -fdefault-real-8
dnl [Common alias] -r8
dnl Intel Fortran -real-kind 64
dnl PGI Fortran -Mr8
dnl Cray Fortran -s real64
dnl Intel -real-kind 64
dnl PGI/Nvidia -Mr8
dnl Cray -s real64
dnl NAG -double
dnl
dnl
dnl NOTE:
dnl - Many compilers accept -r8 for real and double precision sizes, but
dnl several compiler-specific options are also provided.
Expand All @@ -34,53 +36,50 @@ dnl
dnl Neither flag describes what we actually want, but we include it here
dnl as a last resort.
dnl
AC_DEFUN([AX_FC_REAL8],
[
AC_DEFUN([AX_FC_REAL8], [
REAL8_FCFLAGS=
AC_ARG_ENABLE([real8],
[AS_HELP_STRING([--disable-real-8], [do not force 8-byte reals])])
AC_ARG_ENABLE([real8], [
AS_HELP_STRING([--disable-real-8], [do not force 8-byte reals])
])
if test "$enable_real8" != no; then
AC_CACHE_CHECK([for $FC option to force 8-byte reals],
[ac_cv_prog_fc_real8],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [
real :: x(4)
double precision :: y(4)
integer, parameter :: &
m = merge(1, 0, kind(x(1)) == selected_real_kind(15, 307)), &
n = merge(1, 0, kind(y(1)) == selected_real_kind(15, 307))
print *, x(::m)
print *, y(::n)
])],
[ac_cv_prog_fc_real8='none needed'],
[ac_cv_prog_fc_real8='unsupported'
for ac_option in "-fdefault-real-8 -fdefault-double-8" -r8 "-real-kind 64" -Mr8 "-s real64" -double; do
ac_save_FCFLAGS=$FCFLAGS
FCFLAGS="$FCFLAGS $ac_option"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([], [
[ac_cv_prog_fc_real8], [
ac_cv_prog_fc_real8='unsupported'
ac_fc_real8_FCFLAGS_save=$FCFLAGS
for ac_flag in none \
-fdefault-real-8 \
"-fdefault-real-8 -fdefault-double-8" \
-r8 \
"-real-kind 64" \
-Mr8 \
"-s real64" \
-double
do
test "$ac_flag" != none && FCFLAGS="$ac_fc_real8_FCFLAGS_save $ac_flag"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([], [
real :: x(4)
double precision :: y(4)
integer, parameter :: &
m = merge(1, 0, kind(x(1)) == selected_real_kind(15, 307)), &
n = merge(1, 0, kind(y(1)) == selected_real_kind(15, 307))
print *, x(::m)
print *, y(::n)
])],
[ac_cv_prog_fc_real8=$ac_option]
)
FCFLAGS=$ac_save_FCFLAGS
if test "$ac_cv_prog_fc_real8" != unsupported; then
break
fi
done])
])
case $ac_cv_prog_fc_real8 in #(
"none needed" | unsupported)
;; #(
*)
REAL8_FCFLAGS=$ac_cv_prog_fc_real8 ;;
esac
])
], [ac_cv_prog_fc_real8=$ac_flag ; break])
done
FCFLAGS=$ac_fc_real8_FCFLAGS_save
])
case $ac_cv_prog_fc_real8 in #(
"none")
ac_cv_prog_fc_real8='none needed'
;; #(
unsupported)
;; #(
*)
REAL8_FCFLAGS=$ac_cv_prog_fc_real8
;;
esac
fi
AC_SUBST(REAL8_FCFLAGS)
AC_SUBST([REAL8_FCFLAGS])
])
81 changes: 40 additions & 41 deletions ac/m4/ax_fc_real8.m4
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ dnl avoiding any flags with affect integers, but this should still be used with
dnl some care.
dnl
dnl GCC -fdefault-real-8, -fdefault-double-8
dnl AMD (flang) -fdefault-real-8
dnl [Common alias] -r8
dnl Intel Fortran -real-kind 64
dnl PGI Fortran -Mr8
dnl Cray Fortran -s real64
dnl Intel -real-kind 64
dnl PGI/Nvidia -Mr8
dnl Cray -s real64
dnl NAG -double
dnl
dnl
dnl NOTE:
dnl - Many compilers accept -r8 for real and double precision sizes, but
dnl several compiler-specific options are also provided.
Expand All @@ -34,53 +36,50 @@ dnl
dnl Neither flag describes what we actually want, but we include it here
dnl as a last resort.
dnl
AC_DEFUN([AX_FC_REAL8],
[
AC_DEFUN([AX_FC_REAL8], [
REAL8_FCFLAGS=
AC_ARG_ENABLE([real8],
[AS_HELP_STRING([--disable-real-8], [do not force 8-byte reals])])
AC_ARG_ENABLE([real8], [
AS_HELP_STRING([--disable-real-8], [do not force 8-byte reals])
])
if test "$enable_real8" != no; then
AC_CACHE_CHECK([for $FC option to force 8-byte reals],
[ac_cv_prog_fc_real8],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [
real :: x(4)
double precision :: y(4)
integer, parameter :: &
m = merge(1, 0, kind(x(1)) == selected_real_kind(15, 307)), &
n = merge(1, 0, kind(y(1)) == selected_real_kind(15, 307))
print *, x(::m)
print *, y(::n)
])],
[ac_cv_prog_fc_real8='none needed'],
[ac_cv_prog_fc_real8='unsupported'
for ac_option in "-fdefault-real-8 -fdefault-double-8" -r8 "-real-kind 64" -Mr8 "-s real64" -double; do
ac_save_FCFLAGS=$FCFLAGS
FCFLAGS="$FCFLAGS $ac_option"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([], [
[ac_cv_prog_fc_real8], [
ac_cv_prog_fc_real8='unsupported'
ac_fc_real8_FCFLAGS_save=$FCFLAGS
for ac_flag in none \
-fdefault-real-8 \
"-fdefault-real-8 -fdefault-double-8" \
-r8 \
"-real-kind 64" \
-Mr8 \
"-s real64" \
-double
do
test "$ac_flag" != none && FCFLAGS="$ac_fc_real8_FCFLAGS_save $ac_flag"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([], [
real :: x(4)
double precision :: y(4)
integer, parameter :: &
m = merge(1, 0, kind(x(1)) == selected_real_kind(15, 307)), &
n = merge(1, 0, kind(y(1)) == selected_real_kind(15, 307))
print *, x(::m)
print *, y(::n)
])],
[ac_cv_prog_fc_real8=$ac_option]
)
FCFLAGS=$ac_save_FCFLAGS
if test "$ac_cv_prog_fc_real8" != unsupported; then
break
fi
done])
])
case $ac_cv_prog_fc_real8 in #(
"none needed" | unsupported)
;; #(
*)
REAL8_FCFLAGS=$ac_cv_prog_fc_real8 ;;
esac
])
], [ac_cv_prog_fc_real8=$ac_flag ; break])
done
FCFLAGS=$ac_fc_real8_FCFLAGS_save
])
case $ac_cv_prog_fc_real8 in #(
"none")
ac_cv_prog_fc_real8='none needed'
;; #(
unsupported)
;; #(
*)
REAL8_FCFLAGS=$ac_cv_prog_fc_real8
;;
esac
fi
AC_SUBST(REAL8_FCFLAGS)
AC_SUBST([REAL8_FCFLAGS])
])
Loading