autoconf-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Autoconf source repository branch, master, updated. v2.68-52-g


From: Ralf Wildenhues
Subject: [SCM] GNU Autoconf source repository branch, master, updated. v2.68-52-g4c79761
Date: Sat, 05 Mar 2011 08:47:24 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Autoconf source repository".

http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=4c79761f40980100834f19147f1d1d4ec03742b0

The branch, master has been updated
       via  4c79761f40980100834f19147f1d1d4ec03742b0 (commit)
       via  5f11bce4563d94fd2a675f83909066d12f6243ef (commit)
       via  8476731b831de939182261f9f67fd656cd1242ba (commit)
      from  1ab552e4a8d418c3b92dc31c079454e227586dcf (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4c79761f40980100834f19147f1d1d4ec03742b0
Author: Ralf Wildenhues <address@hidden>
Date:   Sat Mar 5 07:56:21 2011 +0100

    AC_FC_SRCEXT: allow gfortran to compile .f77 files.
    
    * lib/autoconf/fortran.m4 (AC_FC_SRCEXT): Try '-x f77' for .f77
    files, '-x f95' for others, for gfortran.
    
    Signed-off-by: Ralf Wildenhues <address@hidden>

commit 5f11bce4563d94fd2a675f83909066d12f6243ef
Author: Ralf Wildenhues <address@hidden>
Date:   Sat Mar 5 07:55:51 2011 +0100

    New macros AC_{F77,FC}_IMPLICIT_NONE to disable Fortran implicit int.
    
    * lib/autoconf/fortran.m4 (_AC_FC_IMPLICIT_NONE): New internal
    macro.
    (AC_F77_IMPLICIT_NONE, AC_FC_IMPLICIT_NONE): New macros.
    * doc/autoconf.texi (Fortran Compiler): Document them.
    * NEWS: Update.
    
    Signed-off-by: Ralf Wildenhues <address@hidden>

commit 8476731b831de939182261f9f67fd656cd1242ba
Author: Ralf Wildenhues <address@hidden>
Date:   Sat Mar 5 07:55:14 2011 +0100

    New macro AC_FC_CHECK_BOUNDS to enable Fortran array bounds checking.
    
    * lib/autoconf/fortran.m4 (AC_FC_CHECK_BOUNDS): New macro.
    * doc/autoconf.texi (Fortran Compiler): Document it.
    * tests/fortran.at (AC_FC_CHECK_BOUNDS): New test.
    * NEWS: Update.
    Prompted by report from Eve-Marie Devaliere.
    
    Signed-off-by: Ralf Wildenhues <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog               |   20 ++++++
 NEWS                    |    5 ++
 doc/autoconf.texi       |   31 +++++++++
 lib/autoconf/fortran.m4 |  159 ++++++++++++++++++++++++++++++++++++++++++++++-
 tests/fortran.at        |   59 +++++++++++++++++
 5 files changed, 273 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fa0b5f7..ff84c50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2011-03-05  Ralf Wildenhues  <address@hidden>
+
+       AC_FC_SRCEXT: allow gfortran to compile .f77 files.
+       * lib/autoconf/fortran.m4 (AC_FC_SRCEXT): Try '-x f77' for .f77
+       files, '-x f95' for others, for gfortran.
+
+       New macros AC_{F77,FC}_IMPLICIT_NONE to disable Fortran implicit int.
+       * lib/autoconf/fortran.m4 (_AC_FC_IMPLICIT_NONE): New internal
+       macro.
+       (AC_F77_IMPLICIT_NONE, AC_FC_IMPLICIT_NONE): New macros.
+       * doc/autoconf.texi (Fortran Compiler): Document them.
+       * NEWS: Update.
+
+       New macro AC_FC_CHECK_BOUNDS to enable Fortran array bounds checking.
+       * lib/autoconf/fortran.m4 (AC_FC_CHECK_BOUNDS): New macro.
+       * doc/autoconf.texi (Fortran Compiler): Document it.
+       * tests/fortran.at (AC_FC_CHECK_BOUNDS): New test.
+       * NEWS: Update.
+       Prompted by report from Eve-Marie Devaliere.
+
 2011-03-04  Ralf Wildenhues  <address@hidden>
 
        Update known compiler switches for Fortran and OpenMP macros.
diff --git a/NEWS b/NEWS
index 3edebd8..6a1771d 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,11 @@ GNU Autoconf NEWS - User visible changes.
 
 - New macro AC_HEADER_CHECK_STDBOOL.
 
+- New and updated macros for Fortran support:
+
+    AC_FC_CHECK_BOUNDS to enable array bounds checking
+    AC_F77_IMPLICIT_NONE and AC_FC_IMPLICIT_NONE to disable implicit integer
+
 * Noteworthy changes in release 2.68 (2010-09-22) [stable]
   Released by Eric Blake, based on git versions 2.67.*.
 
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 5fc9ffe..29c6d2c 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -8248,6 +8248,37 @@ calls @var{action-if-failure} (defaults to exiting with 
an error
 message).
 @end defmac
 
address@hidden AC_FC_CHECK_BOUNDS (@ovar{action-if-success}, @
+  @dvar{action-if-failure, AC_MSG_FAILURE})
address@hidden
+
+The @code{AC_FC_CHECK_BOUNDS} macro tries to enable array bounds checking
+in the Fortran compiler.  If successful, the @var{action-if-success}
+is called and any needed flags are added to @code{FCFLAGS}.  Otherwise,
address@hidden is called, which defaults to failing with an error
+message.  The macro currently requires Fortran 90 or a newer dialect.
+
+The result of the macro is cached in the @code{ac_cv_fc_check_bounds}
+variable.
address@hidden defmac
+
address@hidden AC_F77_IMPLICIT_NONE (@ovar{action-if-success}, @
+  @dvar{action-if-failure, AC_MSG_FAILURE})
address@hidden AC_FC_IMPLICIT_NONE (@ovar{action-if-success}, @
+  @dvar{action-if-failure, AC_MSG_FAILURE})
address@hidden
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.
+
+The result of these macros are cached in the
address@hidden and @code{ac_cv_fc_implicit_none}
+variables, respectively.
address@hidden defmac
+
 
 @node Go Compiler
 @subsection Go Compiler Characteristics
diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4
index 30544c4..237cdd9 100644
--- a/lib/autoconf/fortran.m4
+++ b/lib/autoconf/fortran.m4
@@ -1137,6 +1137,8 @@ AC_LANG_POP(Fortran)dnl
 # Also, for Intel's ifc compiler (which does not accept .f95 by default in
 # some versions), the $FCFLAGS_<EXT> variable *must* go immediately before
 # the source file on the command line, unlike other $FCFLAGS.  Ugh.
+#
+# gfortran requires '-x f77' in order to recognize .f77 files.
 AC_DEFUN([AC_FC_SRCEXT],
 [AC_LANG_PUSH(Fortran)dnl
 AC_CACHE_CHECK([for Fortran flag to compile .$1 files],
@@ -1145,7 +1147,11 @@ AC_CACHE_CHECK([for Fortran flag to compile .$1 files],
 ac_fcflags_srcext_save=$ac_fcflags_srcext
 ac_fcflags_srcext=
 ac_cv_fc_srcext_$1=unknown
-for ac_flag in none -qsuffix=f=$1 -Tf; do
+case $ac_ext in #(
+  [[fF]]77) ac_try=f77;; #(
+  *) ac_try=f95;;
+esac
+for ac_flag in none -qsuffix=f=$1 -Tf "-x $ac_try"; do
   test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag"
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_fc_srcext_$1=$ac_flag; break])
 done
@@ -1367,3 +1373,154 @@ else
 fi
 AC_LANG_POP([Fortran])dnl
 ])# AC_FC_LINE_LENGTH
+
+
+# AC_FC_CHECK_BOUNDS([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# ----------------------------------------------------------------------
+# Look for a compiler flag to turn on array bounds checking for the
+# Fortran (FC) compiler, and adds it to FCFLAGS.  Call
+# ACTION-IF-SUCCESS (defaults to nothing) if successful (i.e. can
+# compile code using new extension) and ACTION-IF-FAILURE (defaults to
+# failing with an error message) if not.  (Defined via DEFUN_ONCE to
+# prevent flag from being added to FCFLAGS multiple times.)
+#
+# The known flags are:
+# -fcheck=all, -fbounds-check: gfortran
+#     -fbounds-check: g77, g95
+# -CB, -check bounds: Intel compiler (icc, ecc, ifort)
+#                 -C: Sun/Oracle compiler (f95)
+#        -C, -qcheck: IBM compiler (xlf)
+#           -Mbounds: Portland Group compiler
+#       -C ,-Mbounds: Cray
+#  -C, -check_bounds: SGI compiler
+# -check_bounds, +check=all: HP Fortran
+#        -C, -Rb -Rc: Absoft (-Rb: array boundaries, -Rc: array conformance)
+# --chk e,s -chk (e,s): Lahey
+#          -C -C=all: NAGWare
+# -C, -ffortran-bounds-check: PathScale pathf90
+#                 -C: f2c
+#            -BOunds: Open Watcom
+AC_DEFUN_ONCE([AC_FC_CHECK_BOUNDS],
+[AC_LANG_PUSH([Fortran])dnl
+AC_CACHE_CHECK([for Fortran flag to enable array-bounds checking],
+               [ac_cv_fc_check_bounds],
+[ac_cv_fc_check_bounds=unknown
+ac_fc_check_bounds_FCFLAGS_save=$FCFLAGS
+for ac_flag in -fcheck=bounds -fbounds-check -check_bounds -Mbounds -qcheck \
+               '-check bounds' +check=all --check '-Rb -Rc' -CB -C=all -C \
+               -ffortran-bounds-check "--chk e,s" "-chk e -chk s" -bounds
+do
+  FCFLAGS="$ac_fc_check_bounds_FCFLAGS_save $ac_flag"
+  # We should be able to link a correct program.
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+    [AC_LINK_IFELSE([[
+      subroutine sub(a)
+      integer a(:)
+      a(8) = 0
+      end subroutine
+
+      program main
+      integer a(1:7)
+      interface
+         subroutine sub(a)
+         integer a(:)
+         end subroutine
+      end interface
+
+      call sub(a)
+      end program]],
+       [# If we can run the program, require failure at run time.
+       # In cross-compiling mode, we rely on the compiler not accepting
+       # unknown options.
+       AS_IF([test "$cross_compiling" = yes],
+         [ac_cv_fc_check_bounds=$ac_flag; break],
+         [AS_IF([_AC_DO_TOKENS(./conftest$ac_exeext)],
+            [],
+            [ac_cv_fc_check_bounds=$ac_flag; break])])])])
+done
+rm -f conftest$ac_exeext conftest.err conftest.$ac_objext conftest.$ac_ext
+FCFLAGS=$ac_fc_check_bounds_FCFLAGS_save
+])
+if test "x$ac_cv_fc_check_bounds" = xunknown; then
+  m4_default([$2],
+             [AC_MSG_ERROR([no Fortran flag for bounds checking found], 77)])
+else
+  if test "x$ac_cv_fc_check_bounds" != xnone; then
+    FCFLAGS="$FCFLAGS $ac_cv_fc_check_bounds"
+  fi
+  $1
+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, g95: -fimplicit-none, g77: -Wimplicit
+# Intel: -u, -implicitnone; might also need '-warn errors' to turn into error.
+# Sun/Oracle: -u
+# HP: +implicit_none
+# IBM: -u, -qundef
+# SGI: -u
+# Compaq: -u, -warn declarations
+# NAGWare: -u
+# Lahey: -in, --in, -AT
+# Cray: -Mdclchk -d i
+# PGI: -Mcdlchk
+# f2c: -u
+AC_DEFUN([_AC_FC_IMPLICIT_NONE],
+[_AC_FORTRAN_ASSERT()dnl
+AC_CACHE_CHECK([for flag to disallow _AC_LANG implicit declarations],
+               [ac_cv_[]_AC_LANG_ABBREV[]_implicit_none],
+[ac_cv_[]_AC_LANG_ABBREV[]_implicit_none=unknown
+ac_fc_implicit_none_[]_AC_LANG_PREFIX[]FLAGS_save=$[]_AC_LANG_PREFIX[]FLAGS
+for ac_flag in none -fimplicit-none -u -Wimplicit -implicitnone +implicit_none 
\
+               -qundef "-warn declarations" -in --in -AT "-d i" -Mdclchk \
+               "-u -warn errors"
+do
+  if test "x$ac_flag" != xnone; then
+    _AC_LANG_PREFIX[]FLAGS="$ac_fc_implicit_none_[]_AC_LANG_PREFIX[]FLAGS_save 
$ac_flag"
+  fi
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
+      i = 0
+      print *, i]])],
+       [],
+       [ac_cv_[]_AC_LANG_ABBREV[]_implicit_none=$ac_flag; break])])
+done
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+_AC_LANG_PREFIX[]FLAGS=$ac_fc_implicit_none_[]_AC_LANG_PREFIX[]FLAGS_save
+])
+if test "x$ac_cv_[]_AC_LANG_ABBREV[]_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_[]_AC_LANG_ABBREV[]_implicit_none" != xnone; then
+    _AC_LANG_PREFIX[]FLAGS="$_AC_LANG_PREFIX[]FLAGS 
$ac_cv_[]_AC_LANG_ABBREV[]_implicit_none"
+  fi
+  $2
+fi
+])# _AC_FC_IMPLICIT_NONE
+
+
+# AC_F77_IMPLICIT_NONE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# ------------------------------------------------------------------------
+AC_DEFUN([AC_F77_IMPLICIT_NONE],
+[AC_LANG_PUSH([Fortran 77])dnl
+_AC_FC_IMPLICIT_NONE($@)
+AC_LANG_POP([Fortran 77])dnl
+])# AC_F77_IMPLICIT_NONE
+
+
+# AC_FC_IMPLICIT_NONE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
+# -----------------------------------------------------------------------
+AC_DEFUN([AC_FC_IMPLICIT_NONE],
+[AC_LANG_PUSH([Fortran])dnl
+_AC_FC_IMPLICIT_NONE($@)
+AC_LANG_POP([Fortran])dnl
+])# AC_FC_IMPLICIT_NONE
diff --git a/tests/fortran.at b/tests/fortran.at
index 87403a7..4986ee4 100644
--- a/tests/fortran.at
+++ b/tests/fortran.at
@@ -932,3 +932,62 @@ EOF
 done
 
 AT_CLEANUP
+
+
+## ------------------- ##
+## AC_FC_CHECK_BOUNDS. ##
+## ------------------- ##
+
+AT_SETUP([AC_FC_CHECK_BOUNDS])
+
+AT_DATA([Makefile.in],
address@hidden@: address@hidden@
+       @FC@ @FCFLAGS@ -o $@ address@hidden@ @LIBS@
+
+.SUFFIXES: .f address@hidden@
address@hidden@:
+       @FC@ @FCFLAGS@ -c @FCFLAGS_f@ $<
+
+clean:
+       rm -f address@hidden@ address@hidden@
+]])
+
+cat >configure.ac <<EOF
+AC_INIT
+AC_PROG_FC
+AC_FC_SRCEXT([f])
+AC_FC_CHECK_BOUNDS
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+EOF
+
+AT_DATA([prog.f],
+[[
+      subroutine copy(a,b,n)
+      integer a(:), b(:), n, i
+      do i = 1, n
+         a(i) = b(i)
+      end do
+      end subroutine
+
+      program main
+      integer, parameter :: n = 20
+      integer a(1:n), b(1:n-1), i
+      interface
+         subroutine copy(a,b,n)
+         integer a(:), b(:), i
+         end subroutine
+      end interface
+
+      call copy(a,b,n)
+      end program
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
+: "${MAKE=make}"
+AT_CHECK([$MAKE], [], [ignore], [ignore])
+AT_CHECK([./prog || exit 1], [1], [ignore], [ignore])
+AT_CHECK([$MAKE clean], [], [ignore], [ignore])
+
+AT_CLEANUP


hooks/post-receive
-- 
GNU Autoconf source repository



reply via email to

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