autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 2/2] New macro AC_FC_MODULE_FLAG: Fortran 90 module include p


From: Ralf Wildenhues
Subject: Re: [PATCH 2/2] New macro AC_FC_MODULE_FLAG: Fortran 90 module include path.
Date: Sat, 2 Apr 2011 14:39:43 +0200
User-agent: Mutt/1.5.20 (2010-08-04)

* Ralf Wildenhues wrote on Sun, Mar 06, 2011 at 01:54:07PM CET:
> * lib/autoconf/fortran.m4 (AC_FC_MODULE_FLAG): New macro,
> adjusted and rewritten from the AX_F90_MODULE_FLAG macro from
> the Autoconf Macro Archive by Luc Maisonobe, Julian C. Cummings,
> and Alexander Pletzer.
> * doc/autoconf.texi (Fortran Compiler): Document it.
> * tests/fortran.at (AC_FC_MODULE_FLAG): New test.
> * tests/local.at (AT_CHECK_ENV): Do not complain about FC_MODINC
> setting.
> * THANKS: Update.

This patch needed a fixup for gfortran 4.4 so it wouldn't choose -M
as include flag, as below.  (I would like Sun f95 to prefer -M over
-I for module inclusion, as the latter also governs header inclusion.)

Cheers,
Ralf

diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4
index b03af38..25b0540 100644
--- a/lib/autoconf/fortran.m4
+++ b/lib/autoconf/fortran.m4
@@ -1570,12 +1570,13 @@ AC_SUBST([FC_MODEXT])dnl
 # It may contain significant trailing whitespace.
 #
 # Known flags:
-# gfortran: -Idir, -I dir (-M dir (deprecated), -Jdir for writing)
+# gfortran: -Idir, -I dir (-M dir, -Mdir (deprecated), -Jdir for writing)
 # g95: -I dir (-fmod=dir for writing)
 # SUN: -Mdir, -M dir (-moddir=dir for writing;
 #                     -Idir for includes is also searched)
 # HP: -Idir, -I dir (+moddir=dir for writing)
 # IBM: -Idir (-qmoddir=dir for writing)
+# Intel: -Idir -I dir (-mod dir for writing)
 # Absoft: -pdir
 # Lahey: -mod dir
 # Cray: -module dir, -p dir (-J dir for writing)
@@ -1588,7 +1589,8 @@ AC_SUBST([FC_MODEXT])dnl
 #                    (-Am indicates how module information is saved)
 AC_DEFUN([AC_FC_MODULE_FLAG],[
 AC_CACHE_CHECK([Fortran 90 module inclusion flag], [ac_cv_fc_module_flag],
-[AC_LANG_PUSH(Fortran)
+[AC_LANG_PUSH([Fortran])
+ac_cv_fc_module_flag=unknown
 mkdir conftest.dir
 cd conftest.dir
 AC_COMPILE_IFELSE([[
@@ -1599,11 +1601,11 @@ AC_COMPILE_IFELSE([[
       end subroutine
       end module]],
   [cd ..
-   ac_cv_fc_module_flag=unknown
    ac_fc_module_flag_FCFLAGS_save=$FCFLAGS
    # Flag ordering is significant for gfortran and Sun.
    for ac_flag in -M -I '-I ' '-M ' -p '-mod ' '-module ' '-Am -I'; do
-     FCFLAGS="$ac_fc_module_flag_FCFLAGS_save ${ac_flag}conftest.dir"
+     # Add the flag twice to prevent matching an output flag.
+     FCFLAGS="$ac_fc_module_flag_FCFLAGS_save ${ac_flag}conftest.dir 
${ac_flag}conftest.dir"
      AC_COMPILE_IFELSE([[
       program main
       use conftest_module
@@ -1617,7 +1619,7 @@ AC_COMPILE_IFELSE([[
    FCFLAGS=$ac_fc_module_flag_FCFLAGS_save
 ])
 rm -rf conftest.dir
-AC_LANG_POP(Fortran)
+AC_LANG_POP([Fortran])
 ])
 if test "$ac_cv_fc_module_flag" != unknown; then
   FC_MODINC=$ac_cv_fc_module_flag



reply via email to

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