autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AC_FC_SRCEXT: allow gfortran to compile .f77 files.


From: Ralf Wildenhues
Subject: AC_FC_SRCEXT: allow gfortran to compile .f77 files.
Date: Sat, 5 Mar 2011 09:46:22 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

While the .f77 extension is not supported by all Fortran compilers,
it is documented by some, we already test it in the "AC_FC_SRCEXT usage"
test, and when we can get more compilers to accept it, that can only be
helpful.

I'm pushing the patch below to get gfortran to accept this extension.

Thanks,
Ralf

    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.

diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4
index 14e1c9c..237cdd9 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_<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],
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]