]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
New macro AC_FC_MODULE_EXTENSION: Fortran 90 module extension.
authorLuc Maisonobe <luc@spaceroots.org>
Sat, 2 Apr 2011 12:15:14 +0000 (14:15 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 2 Apr 2011 12:15:14 +0000 (14:15 +0200)
* lib/autoconf/fortran.m4 (AC_FC_MODULE_EXTENSION): New macro,
rewritten from the AX_F90_MODULE_EXTENSION macro from the
Autoconf Macro Archive by Luc Maisonobe and Alexander Pletzer.
* doc/autoconf.texi (Fortran Compiler): Document it.
* tests/local.at (_AT_CHECK_ENV): Do not complain about
FC_MODEXT setting.
* NEWS, THANKS: Update.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
THANKS
doc/autoconf.texi
lib/autoconf/fortran.m4
tests/local.at

index e7412760ed1b993dfd134d68a051b3f73f0d605c..5e6f54d5cd83237f053abafeb0354d10dadb0dff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-04-02  Luc Maisonobe  <luc@spaceroots.org>
+           Alexander Pletzer  <pletzer@txcorp.com>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       New macro AC_FC_MODULE_EXTENSION: Fortran 90 module extension.
+       * lib/autoconf/fortran.m4 (AC_FC_MODULE_EXTENSION): New macro,
+       rewritten from the AX_F90_MODULE_EXTENSION macro from the
+       Autoconf Macro Archive by Luc Maisonobe and Alexander Pletzer.
+       * doc/autoconf.texi (Fortran Compiler): Document it.
+       * tests/local.at (_AT_CHECK_ENV): Do not complain about
+       FC_MODEXT setting.
+       * NEWS, THANKS: Update.
+
 2011-03-26  Jim Meyering  <meyering@redhat.com>
 
        README-hacking: fix typo
diff --git a/NEWS b/NEWS
index 6a1771d05861378ca3d74febc5f782900b56c49d..78539773ce3a16885c4ad114de40111a0450fb78 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ GNU Autoconf NEWS - User visible changes.
 
     AC_FC_CHECK_BOUNDS to enable array bounds checking
     AC_F77_IMPLICIT_NONE and AC_FC_IMPLICIT_NONE to disable implicit integer
+    AC_FC_MODULE_EXTENSION to compute the Fortran 90 module name extension
 
 * Noteworthy changes in release 2.68 (2010-09-22) [stable]
   Released by Eric Blake, based on git versions 2.67.*.
diff --git a/THANKS b/THANKS
index 887405fa8fc4debf260d24a43bb18e211c21d658..def09c8b9801229384d555db702193b88b71ddab 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -21,6 +21,7 @@ Alec Wolman                 wolman@cs.washington.edu
 Alex Unleashed              unledev@gmail.com
 Alexander Kurz              alexander.kurz@qsc.de
 Alexander Mai               ?
+Alexander Pletzer           pletzer@txcorp.com
 Alexandre Duret-Lutz        duret_g@epita.fr
 Alexandre Julliard          ?
 Alexandre Oliva             oliva@lsd.ic.unicamp.br
@@ -242,6 +243,7 @@ Lars J. Aas                 larsa@sim.no
 Laurence Darbe              ldarby@tuffmail.com
 Leo Moisio                  leo.moisio@gmail.com
 Loulou Pouchet              loulou@lrde.epita.fr
+Luc Maisonobe               luc@spaceroots.org
 Ludovic Courtes             ?
 Luke Dalessandro            luked@cs.rochester.edu
 Magnus Therning             therning@gforge.natlab.research.philips.com
index ea9e560510632c16787c6e06852f74aab1f318af..9f68a61e06e0ef534f9da484d2e2092ffe97b00d 100644 (file)
@@ -8350,6 +8350,39 @@ The result of these macros are cached in the
 variables, respectively.
 @end defmac
 
+@defmac AC_FC_MODULE_EXTENSION
+@acindex{FC_MODULE_EXTENSION}
+@caindex fc_module_ext
+@ovindex FC_MODEXT
+
+Find the Fortran 90 module file name extension.  Most Fortran 90
+compilers store module information in files separate from the object
+files.  The module files are usually named after the name of the module
+rather than the source file name, with characters possibly turned to
+upper case, plus an extension, often @file{.mod}.
+
+Not all compilers use module files at all, or by default.  The Cray
+Fortran compiler requires @option{-e m} in order to store and search
+module information in @file{.mod} files rather than in object files.
+Likewise, the Fujitsu Fortran compilers uses the @option{-Am} option to
+indicate how module information is stored.
+
+The @code{AC_FC_MODULE_EXTENSION} macro computes the module extension
+without the leading dot, and stores that in the @code{FC_MODEXT}
+variable.  If the compiler does not produce module files, or the
+extension cannot be determined, @code{FC_MODEXT} is empty.  Typically,
+the result of this macro may be used in cleanup @command{make} rules as
+follows:
+
+@example
+clean-modules:
+        -test -z "$(FC_MODEXT)" || rm -f *.$(FC_MODEXT)
+@end example
+
+The extension, or @samp{unknown}, is cached in the
+@code{ac_cv_fc_module_ext} variable.
+@end defmac
+
 
 @node Go Compiler
 @subsection Go Compiler Characteristics
index 84f3162631be0b5391863ea5d11e9c1c246b27e2..864fcaa590831ca5a4b055568fac09ef4589bb27 100644 (file)
@@ -1524,3 +1524,38 @@ AC_DEFUN([AC_FC_IMPLICIT_NONE],
 _AC_FC_IMPLICIT_NONE($@)
 AC_LANG_POP([Fortran])dnl
 ])# AC_FC_IMPLICIT_NONE
+
+
+# AC_FC_MODULE_EXTENSION
+# ----------------------
+# Find the Fortran 90 module file extension.  The module extension is stored
+# in the variable FC_MODEXT and empty if it cannot be determined.  The result
+# or "unknown" is cached in the cache variable ac_cv_fc_module_ext.
+AC_DEFUN([AC_FC_MODULE_EXTENSION],
+[AC_CACHE_CHECK([Fortran 90 module extension], [ac_cv_fc_module_ext],
+[AC_LANG_PUSH(Fortran)
+mkdir conftest.dir
+cd conftest.dir
+ac_cv_fc_module_ext=unknown
+AC_COMPILE_IFELSE([[
+      module conftest_module
+      contains
+      subroutine conftest_routine
+      write(*,'(a)') 'gotcha!'
+      end subroutine
+      end module]],
+  [ac_cv_fc_module_ext=`ls | sed -n 's,conftest_module\.,,p'`
+   if test x$ac_cv_fc_module_ext = x; then
+dnl Some F90 compilers use upper case characters for the module file name.
+     ac_cv_fc_module_ext=`ls | sed -n 's,CONFTEST_MODULE\.,,p'`
+   fi])
+cd ..
+rm -rf conftest.dir
+AC_LANG_POP(Fortran)
+])
+FC_MODEXT=$ac_cv_fc_module_ext
+if test "$FC_MODEXT" = unknown; then
+  FC_MODEXT=
+fi
+AC_SUBST([FC_MODEXT])dnl
+])
index bfd124f306bed5952518a1c6093af86444b184a7..e08d8b19e44164a4e8c73dcbe2ecbf28a4e99b10 100644 (file)
@@ -317,7 +317,7 @@ if test -f state-env.before && test -f state-env.after; then
       [cross_compiling|U],
       [interpval|PATH_SEPARATOR],
       [F77_DUMMY_MAIN|f77_(case|underscore)],
-      [FC(_DUMMY_MAIN|FLAGS|LIBS|FLAGS_f)?],
+      [FC(_DUMMY_MAIN|FLAGS|LIBS|FLAGS_f|_MODEXT)?],
       [ALLOCA|GETLOADAVG_LIBS|KMEM_GROUP|NEED_SETGID|POW_LIB],
       [AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|MKDIR_P|RANLIB|SET_MAKE|YACC],
       [GREP|[EF]GREP|SED],
@@ -368,6 +368,7 @@ do
        /^m4_defn([m4_re_word])=./ !d
        /^[[^=]]*='\'''\''$/ d
        /^a[[cs]]_/ d
+       /^OLDPWD=/ d
        /^PPID=/ d
        /^RANDOM=/ d
        /^SECONDS=/ d