From 4c79761f40980100834f19147f1d1d4ec03742b0 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Sat, 5 Mar 2011 07:56:21 +0100 Subject: [PATCH] AC_FC_SRCEXT: allow gfortran to compile .f77 files. * lib/autoconf/fortran.m4 (AC_FC_SRCEXT): Try '-x f77' for .f77 files, '-x f95' for others, for gfortran. Signed-off-by: Ralf Wildenhues --- ChangeLog | 4 ++++ lib/autoconf/fortran.m4 | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 82d20395..ff84c509 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-03-05 Ralf Wildenhues + AC_FC_SRCEXT: allow gfortran to compile .f77 files. + * lib/autoconf/fortran.m4 (AC_FC_SRCEXT): Try '-x f77' for .f77 + files, '-x f95' for others, for gfortran. + New macros AC_{F77,FC}_IMPLICIT_NONE to disable Fortran implicit int. * lib/autoconf/fortran.m4 (_AC_FC_IMPLICIT_NONE): New internal macro. diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index 14e1c9c9..237cdd9c 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -1137,6 +1137,8 @@ AC_LANG_POP(Fortran)dnl # Also, for Intel's ifc compiler (which does not accept .f95 by default in # some versions), the $FCFLAGS_ variable *must* go immediately before # the source file on the command line, unlike other $FCFLAGS. Ugh. +# +# gfortran requires '-x f77' in order to recognize .f77 files. AC_DEFUN([AC_FC_SRCEXT], [AC_LANG_PUSH(Fortran)dnl AC_CACHE_CHECK([for Fortran flag to compile .$1 files], @@ -1145,7 +1147,11 @@ AC_CACHE_CHECK([for Fortran flag to compile .$1 files], ac_fcflags_srcext_save=$ac_fcflags_srcext ac_fcflags_srcext= ac_cv_fc_srcext_$1=unknown -for ac_flag in none -qsuffix=f=$1 -Tf; do +case $ac_ext in #( + [[fF]]77) ac_try=f77;; #( + *) ac_try=f95;; +esac +for ac_flag in none -qsuffix=f=$1 -Tf "-x $ac_try"; do test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag" AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_fc_srcext_$1=$ac_flag; break]) done -- 2.47.2