[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

OK to push?


    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
+** 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}, 
+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
+# -----------------------------------------------------------------------
+# 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_CACHE_CHECK([for flag to disallow Fortran implicit declarations],
+               [ac_cv_fc_implicit_none],
+for ac_flag in none -fimplicit-none -u -Wimplicit -implicitnone +implicit_none 
+               -qundef "-warn declarations" --in
+  test "x$ac_flag" != xnone && FCFLAGS="$ac_fc_implicit_none_FCFLAGS_save 
+      i = 0]])],
+    [],
+    [ac_cv_fc_implicit_none=$ac_flag; break])
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+if test "x$ac_cv_fc_implicit_none" = xunknown; then
+  m4_default([$3],
+    [AC_MSG_ERROR([no Fortran flag to disallow implicit declarations found], 
+  if test "x$ac_cv_fc_implicit_none" != xnone; then
+    FCFLAGS="$FCFLAGS $ac_cv_fc_implicit_none"
+  fi
+  $2

reply via email to

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