[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New macro AC_FC_IMPLICIT_NONE to disable Fortran implicit int.
From: |
Ralf Wildenhues |
Subject: |
New macro AC_FC_IMPLICIT_NONE to disable Fortran implicit int. |
Date: |
Sun, 27 Feb 2011 17:18:14 +0100 |
User-agent: |
Mutt/1.5.20 (2010-08-04) |
Another fairly simple Fortran macro, with data gathered from manuals
and from the overview site which Eve-Marie linked to.
No test so far except for the automatic self-test created by mktests.sh.
OK to push?
Thanks,
Ralf
New macro AC_FC_IMPLICIT_NONE to disable Fortran implicit int.
* lib/autoconf/fortran.m4 (AC_FC_IMPLICIT_NONE): New macro.
* doc/autoconf.texi (Fortran Compiler): Document it.
* NEWS: Update.
diff --git a/NEWS b/NEWS
index 534bb17..2c6478e 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,9 @@ GNU Autoconf NEWS - User visible changes.
** New macro AC_FC_CHECK_BOUNDS to enable array bounds checking in the Fortran
compiler.
+** New macro AC_FC_IMPLICIT_NONE to disable implicit int declarations in
+ Fortran.
+
** Macros
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index a9bd40e..64c3201 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -8282,6 +8282,14 @@ Go Compiler
@code{GOFLAGS} may be set before @code{AC_PROG_GO}.
@end defmac
address@hidden AC_FC_IMPLICIT_NONE (@ovar{action-if-success},
@ovar{action-if-failure})
address@hidden
+
+Try to disallow implicit declarations in the Fortran compiler. If
+successful, the @var{action-if-success} is called and any needed flags
+are added to @code{FCFLAGS}. Otherwise, @var{action-if-failure} is
+called, which defaults to failing with an error message.
address@hidden defmac
@node System Services
@section System Services
diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4
index de56323..416cf56 100644
--- a/lib/autoconf/fortran.m4
+++ b/lib/autoconf/fortran.m4
@@ -1429,3 +1429,50 @@ else
fi
AC_LANG_POP([Fortran])dnl
])# AC_FC_CHECK_BOUNDS
+
+
+# AC_FC_IMPLICIT_NONE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# -----------------------------------------------------------------------
+# Look for a flag to disallow implicit declarations, and add it to FCFLAGS.
+# Call ACTION-IF-SUCCESS (defaults to nothing) if successful and
+# ACTION-IF-FAILURE (defaults to failing with an error message) if not.
+#
+# Known flags:
+# GNU gfortran: -fimplicit-none, g77: -Wimplicit
+# Intel: -u, -implicitnone
+# Sun/Oracle: -u
+# HP: +implicit_none
+# IBM: -u, -qundef
+# SGI: -u
+# Compaq: -u, -warn declarations
+# NAGware: -u
+# Lahey: --in
+AC_DEFUN([AC_FC_IMPLICIT_NONE],
+[AC_LANG_PUSH([Fortran])dnl
+AC_CACHE_CHECK([for flag to disallow Fortran implicit declarations],
+ [ac_cv_fc_implicit_none],
+[ac_cv_fc_implicit_none=unknown
+ac_fc_implicit_none_FCFLAGS_save=$FCFLAGS
+for ac_flag in none -fimplicit-none -u -Wimplicit -implicitnone +implicit_none
\
+ -qundef "-warn declarations" --in
+do
+ test "x$ac_flag" != xnone && FCFLAGS="$ac_fc_implicit_none_FCFLAGS_save
$ac_flag"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
+ i = 0]])],
+ [],
+ [ac_cv_fc_implicit_none=$ac_flag; break])
+done
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+FCFLAGS=$ac_fc_implicit_none_FCFLAGS_save
+])
+if test "x$ac_cv_fc_implicit_none" = xunknown; then
+ m4_default([$3],
+ [AC_MSG_ERROR([no Fortran flag to disallow implicit declarations found],
77)])
+else
+ if test "x$ac_cv_fc_implicit_none" != xnone; then
+ FCFLAGS="$FCFLAGS $ac_cv_fc_implicit_none"
+ fi
+ $2
+fi
+AC_LANG_POP([Fortran])dnl
+])# AC_FC_IMPLICIT_NONE
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- New macro AC_FC_IMPLICIT_NONE to disable Fortran implicit int.,
Ralf Wildenhues <=