2011-03-05 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ 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.
# Also, for Intel's ifc compiler (which does not accept .f95 by default in
# some versions), the $FCFLAGS_<EXT> 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],
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