summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Maisonobe <luc@spaceroots.org>2011-04-02 14:15:14 +0200
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>2011-04-02 14:15:14 +0200
commitbf140a4c8c457d9fc5876076c69c6e34598c39fe (patch)
treedd5c5ae9a15ccfe0672f2ce74508bc350b674419
parentbc9e46833ee0aaf3dc47880494c2695b651a07f8 (diff)
downloadautoconf-bf140a4c8c457d9fc5876076c69c6e34598c39fe.tar.gz
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. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
-rw-r--r--ChangeLog13
-rw-r--r--NEWS1
-rw-r--r--THANKS2
-rw-r--r--doc/autoconf.texi33
-rw-r--r--lib/autoconf/fortran.m435
-rw-r--r--tests/local.at3
6 files changed, 86 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e7412760..5e6f54d5 100644
--- 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 6a1771d0..78539773 100644
--- 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 887405fa..def09c8b 100644
--- 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
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index ea9e5605..9f68a61e 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -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
diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4
index 84f31626..864fcaa5 100644
--- a/lib/autoconf/fortran.m4
+++ b/lib/autoconf/fortran.m4
@@ -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
+])
diff --git a/tests/local.at b/tests/local.at
index bfd124f3..e08d8b19 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -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