* 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. * THANKS: Update. --- ChangeLog | 13 +++++++++++++ doc/autoconf.texi | 33 +++++++++++++++++++++++++++++++++ lib/autoconf/fortran.m4 | 35 +++++++++++++++++++++++++++++++++++ tests/local.at | 3 ++- 4 files changed, 83 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog index ed4c467..9570ce7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2011-03-06 Luc Maisonobe <...> + Alexander Pletzer <...> + Ralf Wildenhues <...> + + 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. + * THANKS: Update. + 2011-03-05 Ralf Wildenhues <[email protected]> Fix Cray Fortran flag for AC_FC_IMPLICIT_NONE. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index b552883..f3a87d1 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -8345,6 +8345,39 @@ Fortran Compiler 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 84f3162..864fcaa 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 bfd124f..e08d8b1 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 -- 1.7.4.1.203.g07873
