1 #***********************************************************************
2 #* GNU Lesser General Public License
4 #* This file is part of the GFDL Flexible Modeling System (FMS).
6 #* FMS is free software: you can redistribute it and/or modify it under
7 #* the terms of the GNU Lesser General Public License as published by
8 #* the Free Software Foundation, either version 3 of the License, or (at
9 #* your option) any later version.
11 #* FMS is distributed in the hope that it will be useful, but WITHOUT
12 #* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 #* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 #* You should have received a copy of the GNU Lesser General Public
17 #* License along with FMS. If not, see <http://www.gnu.org/licenses/>.
18 #***********************************************************************
20 # ===========================================================================
24 # GX_FC_08_OPEN_NEWUNIT([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
28 # Set of functions that check if the Fortran compiler supports certain
29 # Fortran 2008 features, or if a specific compiler flag is needed to support
30 # the feature. Full descriptions are avalable below.
34 # Copyright (c) 2020 Seth Underwood <underwoo@underwoo.io>
36 # This program is free software; you can redistribute it and/or modify it
37 # under the terms of the GNU General Public License as published by the
38 # Free Software Foundation; either version 3 of the License, or (at your
39 # option) any later version.
41 # This program is distributed in the hope that it will be useful, but
42 # WITHOUT ANY WARRANTY; without even the implied warranty of
43 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
44 # Public License for more details.
46 # You should have received a copy of the GNU General Public License along
47 # with this program. If not, see <https://www.gnu.org/licenses/>.
49 # As a special exception, the respective Autoconf Macro's copyright owner
50 # gives unlimited permission to copy, distribute and modify the configure
51 # scripts that are the output of Autoconf when processing the Macro. You
52 # need not follow the terms of the GNU General Public License when using
53 # or distributing such scripts, even though portions of the text of the
54 # Macro appear in them. The GNU General Public License (GPL) does govern
55 # all other use of the material that constitutes the Autoconf Macro.
57 # GX_FC_08_OPEN_NEWUNIT([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE])
58 # ----------------------------------------------------------------------
59 # Check if the Fortran compiler supports OPEN(NEWUNIT=iunit,...). The
60 # NEWUNIT option for OPEN will select, automatically, a new free unit
61 # number. If the compiler supports this, the preprocessor macro
62 # HAVE_OPEN_NEWUNIT will be set.
63 AC_DEFUN([GX_FC_08_OPEN_NEWUNIT],[
64 _AC_FORTRAN_ASSERT()dnl
65 AC_CACHE_CHECK([if $[]_AC_FC[] supports OPEN(NEWUNIT=iunit,...)], [gx_cv_fc_08_open_newfile],[dnl
66 gx_cv_fc_08_open_newfile=no
67 AC_COMPILE_IFELSE([[ program test
69 open(NEWUNIT=funit, STATUS='SCRATCH')
72 [gx_cv_fc_08_open_newfile=yes])
74 AS_IF([test "x$gx_cv_fc_08_open_newfile" = xno],[$2],[dnl
75 AC_DEFINE([HAVE_OPEN_NEWUNIT], 1,
76 [Define to 1 if the Fotran compiler supports OPEN(NEWUNIT=iunit,...)])
79 ])# GC_FC_08_OPEN_NEWUNIT