1dnl -*- shell-script -*-
2dnl
3dnl Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
4dnl                         University Research and Technology
5dnl                         Corporation.  All rights reserved.
6dnl Copyright (c) 2004-2005 The University of Tennessee and The University
7dnl                         of Tennessee Research Foundation.  All rights
8dnl                         reserved.
9dnl Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
10dnl                         University of Stuttgart.  All rights reserved.
11dnl Copyright (c) 2004-2005 The Regents of the University of California.
12dnl                         All rights reserved.
13dnl Copyright (c) 2006-2017 Cisco Systems, Inc.  All rights reserved
14dnl Copyright (c) 2006-2008 Sun Microsystems, Inc.  All rights reserved.
15dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC.  All rights
16dnl                         reserved.
17dnl Copyright (c) 2009      Oak Ridge National Labs.  All rights reserved.
18dnl Copyright (c) 2014-2017 Research Organization for Information Science
19dnl                         and Technology (RIST). All rights reserved.
20dnl Copyright (c) 2016      IBM Corporation.  All rights reserved.
21dnl $COPYRIGHT$
22dnl
23dnl Additional copyrights may follow
24dnl
25dnl $HEADER$
26dnl
27
28AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[
29    # Default to building nothing
30    OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_NO_BINDINGS
31
32    OMPI_FORTRAN_BUILD_SIZEOF=0
33
34    OMPI_FORTRAN_USEMPI_DIR=
35    OMPI_FORTRAN_USEMPI_LIB=
36
37    OMPI_FORTRAN_USEMPIF08_LIB=
38
39    OMPI_FORTRAN_MAX_ARRAY_RANK=0
40
41    OMPI_FORTRAN_HAVE_INTERFACE=0
42    OMPI_FORTRAN_HAVE_IGNORE_TKR=0
43    OMPI_FORTRAN_HAVE_OPTIONAL_ARGS=0
44    OMPI_FORTRAN_HAVE_BIND_C=0
45    OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV=0
46    OMPI_FORTRAN_HAVE_STORAGE_SIZE=0
47    OMPI_FORTRAN_HAVE_ISO_C_BINDING=0
48    OMPI_FORTRAN_HAVE_BIND_C_SUB=0
49    OMPI_FORTRAN_HAVE_BIND_C_TYPE=0
50    OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME=0
51    OMPI_FORTRAN_HAVE_F08_ASSUMED_RANK=0
52    OMPI_FORTRAN_HAVE_PRIVATE=0
53
54    # These macros control symbol names for Fortran/C interoperability
55    #
56    OMPI_F08_SUFFIX="_f08"
57    OMPI_F_SUFFIX="_f"
58
59    OMPI_MPI_PREFIX="MPI_"
60    OMPI_MPI_BIND_PREFIX="mpi_"
61
62    # Open MPI now treats $F77 and $FC the same, meaning that we
63    # expect them to be the same back-end compiler.  If they're not,
64    # results are undefined.  We do a cursory check to see that FC and
65    # F77 are the same string value (if they're defined).  If they're
66    # not, we'll issue a warning, but keep going on the assumption
67    # that they're the same back-end compiler (e.g., pgf77 and pgf90).
68    # Open MPI only uses $FC and $FCFLAGS -- $F77 and $FFLAGS are now
69    # ignored.
70    AS_IF([test "$F77" != "" || test "$FFLAGS" != ""],
71          [AC_MSG_WARN([Open MPI now ignores the F77 and FFLAGS environment variables; only the FC and FCFLAGS environment variables are used.])
72           sleep 5])
73
74    #-----------------------------------------------------------------------
75    # If we want any of the Fortran MPI bindings, setup the Fortran compiler
76    #-----------------------------------------------------------------------
77    ompi_fortran_happy=0
78    # $LN_S is used below
79    AC_PROG_LN_S
80
81    ompi_fortran_double_underscore=0
82    ompi_fortran_single_underscore=0
83    ompi_fortran_caps=0
84    ompi_fortran_plain=0
85
86    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_MPIFH_BINDINGS],
87        [$OMPI_FORTRAN_MPIFH_BINDINGS],
88        [Whether we are building support for the mpif.h bindings or not])
89    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_USEMPI_BINDINGS],
90        [$OMPI_FORTRAN_USEMPI_BINDINGS],
91        [Whether we are building support for the "use mpi" bindings or not])
92    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_USEMPIF08_BINDINGS],
93        [$OMPI_FORTRAN_USEMPIF08_BINDINGS],
94        [Whether we are building support for the "use mpif08" bindings or not])
95
96    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS],
97          [OMPI_SETUP_FC([ompi_fortran_happy=1])])
98
99    # These values will be determined by SETUP_FC.  We must always
100    # AC_DEFINE these results, even in the --disable-mpi-fortran case,
101    # for ompi_info.
102    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_DOUBLE_UNDERSCORE],
103        [$ompi_fortran_double_underscore],
104        [Whether fortran symbols have a trailing double underscore or not])
105    OMPI_FORTRAN_DOUBLE_UNDERSCORE=$ompi_fortran_double_underscore
106    AC_SUBST(OMPI_FORTRAN_DOUBLE_UNDERSCORE)
107    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_SINGLE_UNDERSCORE],
108        [$ompi_fortran_single_underscore],
109        [Whether fortran symbols have a trailing underscore or not])
110    OMPI_FORTRAN_SINGLE_UNDERSCORE=$ompi_fortran_single_underscore
111    AC_SUBST(OMPI_FORTRAN_SINGLE_UNDERSCORE)
112    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_CAPS],
113        [$ompi_fortran_caps],
114        [Whether fortran symbols are all caps or not])
115    OMPI_FORTRAN_CAPS=$ompi_fortran_caps
116    AC_SUBST(OMPI_FORTRAN_CAPS)
117    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_PLAIN],
118        [$ompi_fortran_plain],
119        [Whether fortran symbols have no trailing underscore or not])
120    OMPI_FORTRAN_PLAIN=$ompi_fortran_plain
121    AC_SUBST(OMPI_FORTRAN_PLAIN)
122
123    # Check to see if any of the MPI Fortran bindings were
124    # specifically requested.  If so, and we weren't able to setup the
125    # Fortran compiler properly, it's an error.
126    AS_IF([test $ompi_fortran_happy -eq 0 && \
127           test $OMPI_MIN_REQUIRED_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS],
128          [AC_MSG_WARN([MPI Fortran bindings requested, but no suitable Fortran compiler found])
129          AC_MSG_ERROR([Cannot continue])])
130
131    # This allows us to mark bogus types, but still have them be a valid
132    # [sentinel] value
133    AC_DEFINE([ompi_fortran_bogus_type_t], [int],
134              [A bogus type that allows us to have sentinel type values that are still valid])
135
136    # These get filled in as we check for each type
137    OMPI_FORTRAN_IKINDS=
138    OMPI_FORTRAN_RKINDS=
139    OMPI_FORTRAN_CKINDS=
140
141    # We want to set the #define's for all of these, so invoke the macros
142    # regardless of whether we have F77 support or not.
143    OMPI_FORTRAN_CHECK([CHARACTER], [yes],
144                   [char, int32_t, int, int64_t, long long, long], [-1], [yes])
145
146    OMPI_FORTRAN_CHECK([LOGICAL], [yes],
147                   [char, int32_t, int, int64_t, long long, long], [-1], [yes])
148    OMPI_FORTRAN_CHECK([LOGICAL*1], [yes],
149                   [char, int8_t, short, int32_t, int, int64_t, long long, long], [1], [yes])
150    OMPI_FORTRAN_CHECK([LOGICAL*2], [yes],
151                   [short, int16_t, int32_t, int, int64_t, long long, long], [2], [yes])
152    OMPI_FORTRAN_CHECK([LOGICAL*4], [yes],
153                   [int32_t, int, int64_t, long long, long], [4], [yes])
154    OMPI_FORTRAN_CHECK([LOGICAL*8], [yes],
155                   [int, int64_t, long long, long], [8], [yes])
156
157    OMPI_FORTRAN_CHECK([INTEGER], [yes],
158                   [int32_t, int, int64_t, long long, long], [-1], [yes])
159    OMPI_FORTRAN_CHECK([INTEGER*1], [no],
160                   [char, int8_t, short, int, int64_t, long long, long], [1], [yes])
161    OMPI_FORTRAN_CHECK([INTEGER*2], [no],
162                   [short, int16_t, int32_t, int, int64_t, long long, long], [2], [yes])
163    OMPI_FORTRAN_CHECK([INTEGER*4], [no],
164                   [int32_t, int, int64_t, long long, long], [4], [yes])
165    OMPI_FORTRAN_CHECK([INTEGER*8], [no],
166                   [int, int64_t, long long, long], [8], [yes])
167    OMPI_FORTRAN_CHECK([INTEGER*16], [no],
168                   [int, int64_t, long long, long], [16], [yes])
169
170    OMPI_FORTRAN_CHECK([REAL], [yes],
171                   [float, double, long double], [-1], [yes])
172    OMPI_FORTRAN_CHECK([REAL*2], [no],
173                   [float, double, long double], [2], [yes])
174    OMPI_FORTRAN_CHECK([REAL*4], [no],
175                   [float, double, long double], [4], [yes])
176    OMPI_FORTRAN_CHECK([REAL*8], [no],
177                   [float, double, long double], [8], [yes])
178    OMPI_FORTRAN_CHECK([REAL*16], [no],
179                   [float, double, long double], [16], [yes])
180
181    # In some compilers, the bit representation of REAL*16 is not the same
182    # as the C counterpart that we found.  If this is the case, then we
183    # want to disable reduction support for MPI_REAL16 (per ticket #1603).
184    OMPI_FORTRAN_CHECK_REAL16_C_EQUIV
185
186    OMPI_FORTRAN_CHECK([DOUBLE PRECISION], [yes],
187                   [float, double, long double], [-1], [yes])
188
189    OMPI_FORTRAN_CHECK([COMPLEX], [yes], [float _Complex, double _Complex], [-1], [no])
190
191    # The complex*N tests are a bit different (note: the complex tests are
192    # the same as all the rest, because complex is a composite of two
193    # reals, which we *have* to have.  It's only the complex*N tests that
194    # are different).  The fortran complex types are composites of the
195    # real*(N/2) types.  So for us to support complex*N, two conditions
196    # must be true:
197    #
198    # a) we must support real*(N/2) (i.e., compiler supports it and we
199    #    have a back-end C type for it)
200    # b) compiler supports complex*N
201
202    OMPI_FORTRAN_CHECK([COMPLEX*4], [no], [float _Complex], [4], [no])
203    OMPI_FORTRAN_CHECK([COMPLEX*8], [no],
204                   [float _Complex, double _Complex, long double _Complex],
205                   [8], [no])
206    OMPI_FORTRAN_CHECK([COMPLEX*16], [no],
207                   [float _Complex, double _Complex, long double _Complex],
208                   [16], [no])
209    OMPI_FORTRAN_CHECK([COMPLEX*32], [no],
210                   [float _Complex, double _Complex, long double _Complex],
211                   [32], [no])
212    # Double precision complex types are not standard, but many
213    # compilers support it.  Code should be wrapped with #ifdef
214    # OMPI_HAVE_FORTRAN_DOUBLE_COMPLEX
215    OMPI_FORTRAN_CHECK([DOUBLE COMPLEX], [no],
216                   [float _Complex, double _Complex, long double _Complex],
217                   [-1], [no])
218
219    # Regardless of whether we have fortran bindings, or even a
220    # fortran compiler, get the max value for a fortran MPI handle
221    # (this macro handles the case where we don't have a fortran
222    # compiler).
223    OMPI_FORTRAN_GET_HANDLE_MAX
224
225    # Check for Fortran compilers value of TRUE and for the correct
226    # assumption on LOGICAL for conversion into what C considers to be
227    # a true value.
228    OMPI_FORTRAN_GET_VALUE_TRUE
229    OMPI_FORTRAN_CHECK_LOGICAL_ARRAY
230
231    # Find out how many array ranks this compiler supports.
232    OMPI_FORTRAN_CHECK_MAX_ARRAY_RANK
233
234    # How big should MPI_STATUS_SIZE be?  (i.e., the size of
235    # MPI_STATUS, expressed in units of Fortran INTEGERs).  The C
236    # equivalent of MPI_Status contains 4 C ints and a size_t.
237    OMPI_FORTRAN_STATUS_SIZE=0
238    AC_MSG_CHECKING([for the value of MPI_STATUS_SIZE])
239    bytes=`expr 4 \* $ac_cv_sizeof_int + $ac_cv_sizeof_size_t`
240    num_integers=`expr $bytes / $ac_cv_sizeof_int`
241    sanity=`expr $num_integers \* $ac_cv_sizeof_int`
242    AS_IF([test "$sanity" != "$bytes"],
243          [AC_MSG_RESULT([unknown!])
244           AC_MSG_WARN([WARNING: Size of C int: $ac_cv_sizeof_int])
245           AC_MSG_WARN([WARNING: Size of C size_t: $ac_cv_sizeof_size_t])
246           AC_MSG_WARN([WARNING: Size of Fortran INTEGER: $OMPI_SIZEOF_FORTRAN_INTEGER])
247           AC_MSG_WARN([Could not make this work out evenly...!])
248           AC_MSG_ERROR([Cannot continue])])
249    OMPI_FORTRAN_STATUS_SIZE=$num_integers
250    AC_MSG_RESULT([$OMPI_FORTRAN_STATUS_SIZE Fortran INTEGERs])
251    AC_SUBST(OMPI_FORTRAN_STATUS_SIZE)
252
253    # Setup for the compilers that don't support ignore TKR functionality
254    OPAL_UNIQ(OMPI_FORTRAN_IKINDS)
255    AC_SUBST(OMPI_FORTRAN_IKINDS)
256    OPAL_UNIQ(OMPI_FORTRAN_RKINDS)
257    AC_SUBST(OMPI_FORTRAN_RKINDS)
258    OPAL_UNIQ(OMPI_FORTRAN_CKINDS)
259    AC_SUBST(OMPI_FORTRAN_CKINDS)
260
261    # We can't use C_INTxx_T KIND values in mpif.h because many
262    # existing MPI Fortran applications are of the form:
263    #
264    #   program main
265    #   implicit none
266    #   include 'mpif.h'
267    #
268    # ...and you can't have a "use..." statement before that (to get
269    # the Fortran/C interop C_INTxx_T KIND values).  So figure out
270    # those KIND values here and just substitue them in via
271    # AC_DEFINE's.  Kinda gross, but there you are.  :-\
272    OMPI_FORTRAN_GET_KIND_VALUE([C_INT16_T], 4, [OMPI_FORTRAN_C_INT16_T_KIND])
273    OMPI_FORTRAN_GET_KIND_VALUE([C_INT32_T], 9, [OMPI_FORTRAN_C_INT32_T_KIND])
274    OMPI_FORTRAN_GET_KIND_VALUE([C_INT64_T], 18, [OMPI_FORTRAN_C_INT64_T_KIND])
275
276    #--------------------------------------------------------
277    # Fortran mpif.h MPI bindings
278    #--------------------------------------------------------
279
280    AC_MSG_CHECKING([if building Fortran mpif.h bindings])
281    AS_IF([test $ompi_fortran_happy -eq 1],
282          [OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_MPIFH_BINDINGS
283           AC_MSG_RESULT([yes])],
284          [OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_NO_BINDINGS
285           AC_MSG_RESULT([no])])
286
287    # "INTERFACE" is needed for MPI_SIZEOF
288    AS_IF([test $ompi_fortran_happy -eq 1],
289          [OMPI_FORTRAN_CHECK_INTERFACE(
290               [OMPI_FORTRAN_HAVE_INTERFACE=1],
291               [OMPI_FORTRAN_HAVE_INTERFACE=0])])
292    AC_SUBST(OMPI_FORTRAN_HAVE_INTERFACE)
293
294    # The iso_fortran_env module is needed for MPI_SIZEOF
295    AS_IF([test $ompi_fortran_happy -eq 1],
296          [OMPI_FORTRAN_CHECK_ISO_FORTRAN_ENV(
297               [OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV=1],
298               [OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV=0])])
299    AC_SUBST(OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV)
300
301    # Ensure that the fortran compiler supports STORAGE_SIZE for
302    # enough relevant types.
303    AS_IF([test $ompi_fortran_happy -eq 1],
304          [OMPI_FORTRAN_CHECK_STORAGE_SIZE(
305               [OMPI_FORTRAN_HAVE_STORAGE_SIZE=1],
306               [OMPI_FORTRAN_HAVE_STORAGE_SIZE=0])])
307    AC_SUBST(OMPI_FORTRAN_HAVE_STORAGE_SIZE)
308
309    # We need INTERFACE, ISO_FORTRAN_ENV, and STORAGE_SIZE() support
310    # to build MPI_SIZEOF support
311    AS_IF([test $ompi_fortran_happy -eq 1 && \
312           test $OMPI_FORTRAN_HAVE_INTERFACE -eq 1 && \
313           test $OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV -eq 1 && \
314           test $OMPI_FORTRAN_HAVE_STORAGE_SIZE -eq 1],
315          [OMPI_FORTRAN_BUILD_SIZEOF=1],
316          [OMPI_FORTRAN_BUILD_SIZEOF=0])
317    AC_SUBST(OMPI_FORTRAN_BUILD_SIZEOF)
318
319    #--------------------------------------------
320    # Fortran use mpi or use mpi_f08 MPI bindings
321    #--------------------------------------------
322
323    AS_IF([test $ompi_fortran_happy -eq 1 && \
324           test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS],
325          [ # Look for the fortran module compiler flag
326           OMPI_FORTRAN_FIND_MODULE_INCLUDE_FLAG([],
327               [AC_MSG_WARN([*** Could not determine the fortran compiler flag to indicate where modules reside])
328                AC_MSG_ERROR([*** Cannot continue])])
329
330           # Look for ignore TKR syntax
331           OMPI_FORTRAN_CHECK_IGNORE_TKR([OMPI_FORTRAN_HAVE_IGNORE_TKR=1])
332          ])
333
334    # If we got here, we can build the mpi module if it was requested.
335    # Decide whether to build the ignore TKR version or the
336    # non-ignore-TKR/legacy version.
337    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS && \
338           test $ompi_fortran_happy -eq 1],
339          [OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS
340           AS_IF([test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 1],
341                 [OMPI_FORTRAN_USEMPI_DIR=mpi/fortran/use-mpi-ignore-tkr
342                  OMPI_FORTRAN_USEMPI_LIB=-l${with_libmpi_name}_usempi_ignore_tkr],
343                 [OMPI_FORTRAN_USEMPI_DIR=mpi/fortran/use-mpi-tkr
344                  OMPI_FORTRAN_USEMPI_LIB=-l${with_libmpi_name}_usempi])
345          ])
346
347    OMPI_FORTRAN_HAVE_ISO_C_BINDING=0
348    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS && \
349           test $ompi_fortran_happy -eq 1],
350          [OMPI_FORTRAN_CHECK_ISO_C_BINDING(
351               [OMPI_FORTRAN_HAVE_ISO_C_BINDING=1],
352               [OMPI_FORTRAN_HAVE_ISO_C_BINDING=0])])
353
354    AC_MSG_CHECKING([if building Fortran 'use mpi' bindings])
355    AS_IF([test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS],
356          [AC_MSG_RESULT([yes])],
357          [OMPI_TRY_FORTRAN_BINDINGS=$OMPI_FORTRAN_MPIFH_BINDINGS
358           AC_MSG_RESULT([no])])
359
360    #---------------------------------
361    # Fortran use mpi_f08 MPI bindings
362    #---------------------------------
363
364    # If we got all the stuff from above, then also look for the new
365    # F08 syntax that we can use for the use_mpif08 module.
366
367    # We need to have ignore TKR functionality to build the mpi_f08
368    # module
369    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
370           test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 1],
371          [OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPIF08_BINDINGS
372           OMPI_FORTRAN_F08_PREDECL=$OMPI_FORTRAN_IGNORE_TKR_PREDECL
373           OMPI_FORTRAN_F08_TYPE=$OMPI_FORTRAN_IGNORE_TKR_TYPE
374          ])
375
376    # The overall "_BIND_C" variable will be set to 1 if we have all
377    # the necessary forms of BIND(C)
378    OMPI_FORTRAN_HAVE_BIND_C=0
379
380    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
381           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
382          [ # If we don't have ISO C bindings, we won't build mpi_f08 at all
383           AS_IF([test "$OMPI_FORTRAN_HAVE_ISO_C_BINDING" -eq 0],
384                 [OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
385
386    OMPI_FORTRAN_HAVE_BIND_C_SUB=0
387    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
388           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
389          [ # If we don't have SUBROUTINE BIND(C), we won't build mpi_f08 at all
390           OMPI_FORTRAN_CHECK_BIND_C_SUB(
391               [OMPI_FORTRAN_HAVE_BIND_C_SUB=1],
392               [OMPI_FORTRAN_HAVE_BIND_C_SUB=0
393                OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
394
395    OMPI_FORTRAN_HAVE_BIND_C_TYPE=0
396    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
397           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
398          [ # If we don't have TYPE, BIND(C), we won't build mpi_f08 at all
399           OMPI_FORTRAN_CHECK_BIND_C_TYPE(
400               [OMPI_FORTRAN_HAVE_BIND_C_TYPE=1],
401               [OMPI_FORTRAN_HAVE_BIND_C_TYPE=0
402                OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
403
404    # Per discussion on the devel list starting here:
405    # http://www.open-mpi.org/community/lists/devel/2014/01/13799.php
406    # we need a new litmus test to disqualify older Fortran compilers
407    # (e.g., Pathscale 4.0.12) that *seem* to support all the Right
408    # Things, but a) do not support BIND(C, name="super_long_name") or
409    # b) run into an internal error when compiling our mpi_f08 module.
410    # Testing for b) is sketchy at best.  But OMPI has some BIND(C)
411    # names that are >32 characters, and the same compilers that
412    # exhibit b) also seem to not support BIND(C) names that are >32
413    # characters (i.e., a)).  Hence, the following BIND(C) test checks
414    # to ensure that BIND(C, name="foo") works, where "foo" is
415    # actually a name >32 characters.
416    OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME=0
417    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
418           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
419          [ # If we don't have TYPE, BIND(C, name="foo"), we won't build mpi_f08 at all
420           OMPI_FORTRAN_CHECK_BIND_C_TYPE_NAME(
421               [ # If we got here, we have all the required forms of
422                 # BIND(C), so set the top-level _BIND_C variable to 1.
423                OMPI_FORTRAN_HAVE_BIND_C=1
424                OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME=1],
425               [OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME=0
426                OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
427
428    # Per https://svn.open-mpi.org/trac/ompi/ticket/4590, if the
429    # Fortran compiler doesn't support PROCEDURE in the way we
430    # want/need, disable the mpi_f08 module.
431    OMPI_FORTRAN_HAVE_PROCEDURE=0
432    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
433           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
434          [ # Does the compiler support "procedure"
435           OMPI_FORTRAN_CHECK_PROCEDURE(
436               [OMPI_FORTRAN_HAVE_PROCEDURE=1],
437               [OMPI_FORTRAN_HAVE_PROCEDURE=0
438                OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
439
440    # Per https://github.com/open-mpi/ompi/issues/857, if the Fortran
441    # compiler doesn't properly support "USE ... ONLY" notation,
442    # disable the mpi_f08 module.
443    OMPI_FORTRAN_HAVE_USE_ONLY=0
444    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
445           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
446          [ # Does the compiler support "USE ... ONLY"
447           OMPI_FORTRAN_CHECK_USE_ONLY(
448               [OMPI_FORTRAN_HAVE_USE_ONLY=1],
449               [OMPI_FORTRAN_HAVE_USE_ONLY=0
450                OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
451
452    OMPI_FORTRAN_HAVE_OPTIONAL_ARGS=0
453    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
454           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
455          [ # Does the compiler have optional arguments?
456           OMPI_FORTRAN_CHECK_OPTIONAL_ARGS(
457               [OMPI_FORTRAN_HAVE_OPTIONAL_ARGS=1],
458               [OMPI_FORTRAN_HAVE_OPTIONAL_ARGS=0
459                OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
460
461    OMPI_FORTRAN_HAVE_C_FUNLOC=0
462    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
463           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
464          [ # Does the compiler supports c_funloc per
465            # TS 29113 subclause 8.1 ?
466           OMPI_FORTRAN_CHECK_C_FUNLOC(
467               [OMPI_FORTRAN_HAVE_C_FUNLOC=1],
468               [OMPI_FORTRAN_HAVE_C_FUNLOC=0
469                OMPI_BUILD_FORTRAN_BINDINGS=$OMPI_FORTRAN_USEMPI_BINDINGS])])
470
471    OMPI_FORTRAN_HAVE_PRIVATE=0
472    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
473           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
474          [ # Does the compiler support "private"
475           OMPI_FORTRAN_CHECK_PRIVATE(
476               [OMPI_FORTRAN_HAVE_PRIVATE=1],
477               [OMPI_FORTRAN_HAVE_PRIVATE=0])])
478
479    OMPI_FORTRAN_HAVE_PROTECTED=0
480    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
481           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
482          [ # Does the compiler support "protected"
483           OMPI_FORTRAN_CHECK_PROTECTED(
484               [OMPI_FORTRAN_HAVE_PROTECTED=1],
485               [OMPI_FORTRAN_HAVE_PROTECTED=0])])
486
487    OMPI_FORTRAN_HAVE_ABSTRACT=0
488    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
489           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
490          [ # Does the compiler support "abstract"
491           OMPI_FORTRAN_CHECK_ABSTRACT(
492               [OMPI_FORTRAN_HAVE_ABSTRACT=1],
493               [OMPI_FORTRAN_HAVE_ABSTRACT=0])])
494
495    OMPI_FORTRAN_HAVE_ASYNCHRONOUS=0
496    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
497           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
498          [ # Does the compiler support "asynchronous"
499           OMPI_FORTRAN_CHECK_ASYNCHRONOUS(
500               [OMPI_FORTRAN_HAVE_ASYNCHRONOUS=1],
501               [OMPI_FORTRAN_HAVE_ASYNCHRONOUS=0])])
502
503    OMPI_FORTRAN_F08_HANDLE_SIZE=4
504    OMPI_FORTRAN_F08_HANDLE_ALIGNMENT=4
505    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
506           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
507          [ # How big are derived types with a single INTEGER?
508           OMPI_FORTRAN_GET_SIZEOF([type, BIND(C) :: test_mpi_handle
509  integer :: MPI_VAL
510end type test_mpi_handle],
511                                   [type(test_mpi_handle)],
512                                   [OMPI_FORTRAN_F08_HANDLE_SIZE])
513           OMPI_FORTRAN_F08_GET_HANDLE_ALIGNMENT(
514                                   [type(test_mpi_handle)],
515                                   [OMPI_FORTRAN_F08_HANDLE_ALIGNMENT])
516          ])
517
518    OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=1
519    OMPI_FORTRAN_F08_PREDECL='!'
520    OMPI_FORTRAN_F08_TYPE=real
521    OMPI_FORTRAN_HAVE_F08_ASSUMED_RANK=0
522    AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS && \
523           test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
524          [ # Look for Fortran 2008 assumed rank syntax
525           OMPI_FORTRAN_CHECK_F08_ASSUMED_RANK(
526               [ # If we have assumed rank, we can build the use
527                 # mpi_f08 module "better"
528                OMPI_FORTRAN_F08_PREDECL='!'
529                OMPI_FORTRAN_F08_TYPE='type(*), dimension(..)'
530                OMPI_FORTRAN_HAVE_F08_ASSUMED_RANK=1])
531
532               # Which mpi_f08 implementation are we using?
533               # a) compiler supports BIND(C) and optional arguments
534               #    ("good" compilers)
535               # b) compiler that does not support the items listed
536               #    in b) ("bad" compilers)
537
538               AC_MSG_CHECKING([which mpi_f08 implementation to build])
539               AS_IF([test $OMPI_FORTRAN_HAVE_OPTIONAL_ARGS -eq 1],
540                     [ # Case a) "good compiler"
541                         OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=0
542                         AC_MSG_RESULT(["good" compiler, no array subsections])
543                     ],
544                     [ # Case b) "bad compiler"
545                         OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=1
546                         AC_MSG_RESULT(["bad" compiler, no array subsections])
547                     ])
548          ])
549
550    # Note: the current implementation *only* has wrappers;
551    # there is no optimized implementation for a "good"
552    # compiler.  I'm leaving the above logic in place for
553    # if we ever do the optimized/no-wrapper
554    # implementation, but for now, I'm just hard-wiring
555    # OMPI_FORTRAN_NEED_WRAPPER_ROUTINES to 1 when we're
556    # building the F08 wrappers.
557    AS_IF([test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
558          [OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=1],
559          [OMPI_FORTRAN_NEED_WRAPPER_ROUTINES=0])
560
561    AC_MSG_CHECKING([if building Fortran 'use mpi_f08' bindings])
562    AS_IF([test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS],
563          [OMPI_FORTRAN_USEMPIF08_LIB=-l${with_libmpi_name}_usempif08
564           AC_MSG_RESULT([yes])],
565          [OMPI_TRY_FORTRAN_BINDIGS=$OMPI_FORTRAN_USEMPI_BINDINGS
566           AC_MSG_RESULT([no])])
567
568    # If Fortran bindings is requested, make sure at least one can be built
569    AS_IF([test $OMPI_MIN_REQUIRED_FORTRAN_BINDINGS -gt $OMPI_BUILD_FORTRAN_BINDINGS],
570          [AC_MSG_ERROR([Cannot build requested Fortran bindings, aborting])])
571
572    # -------------------
573    # mpif.h final setup
574    # -------------------
575
576    # A preprocessor header file just for Fortran.  We cannot use AC
577    # CONFIG_HEADER because it adds a /* */-style comment at the top,
578    # and this header file must be usable in .F90 files.  :-(
579    AC_CONFIG_FILES([ompi/mpi/fortran/configure-fortran-output.h])
580
581    # Values for wrapper compilers
582    OMPI_FC=$FC
583    set dummy $OMPI_FC
584    OMPI_FC_ARGV0=[$]2
585    AS_IF([test -n "$OMPI_FC_ARGV0"],
586          [BASEFC="`basename $OMPI_FC_ARGV0`"
587           OPAL_WHICH([$OMPI_FC_ARGV0], [OMPI_FC_ABSOLUTE])],
588          [OMPI_FC=none
589           BASEFC=none
590           OMPI_FC_ABSOLUTE=none])
591
592    AC_SUBST(OMPI_FC)
593    AC_SUBST(OMPI_FC_ABSOLUTE)
594    AC_DEFINE_UNQUOTED(OMPI_FC, ["$OMPI_FC"], [Underlying Fortran compiler])
595    AC_DEFINE_UNQUOTED(OMPI_FC_ABSOLUTE, ["$OMPI_FC_ABSOLUTE"],
596                       [Absolutey path to the underlying Fortran compiler found by configure])
597
598    # These go into ompi/info/param.c
599    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_BUILD_SIZEOF],
600                       [$OMPI_FORTRAN_BUILD_SIZEOF],
601                       [Whether the mpif.h interface supports the MPI_SIZEOF interface or not])
602    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_INTERFACE],
603                       [$OMPI_FORTRAN_HAVE_INTERFACE],
604                       [Whether the compiler supports INTERFACE or not])
605    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV],
606                       [$OMPI_FORTRAN_HAVE_ISO_FORTRAN_ENV],
607                       [Whether the compiler supports ISO_FORTRAN_ENV or not])
608    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_STORAGE_SIZE],
609                       [$OMPI_FORTRAN_HAVE_STORAGE_SIZE],
610                       [Whether the compiler supports STORAGE_SIZE on relevant types])
611
612    # This conditional is used to determine whether we compile the
613    # various .f90 files that contain MPI_SIZEOF implementations.
614    AM_CONDITIONAL([BUILD_FORTRAN_SIZEOF],
615        [test $OMPI_FORTRAN_BUILD_SIZEOF -eq 1])
616
617    # There are 2 layers to the MPI mpif.h layer. The only extra thing
618    # that determine mpif.h bindings is that fortran can be disabled
619    # by user. In such cases, we need to not build the target at all.
620    # One layer generates MPI_<foo> bindings. The other layer
621    # generates PMPI_<foo> bindings. The following conditions
622    # determine whether each (or both) these layers are built.
623    #
624    # Superceeding clause:
625    #   - Fortran bindings should be enabled, else everything is
626    #     disabled
627    # 1. MPI_<foo> bindings are needed if:
628    #   - Profiling is not required
629    #   - Profiling is required but weak symbols are not supported
630    # 2. PMPI_<foo> bindings are needed if profiling is required.
631    #
632    # Hence we define 2 conditionals which tell us whether each of
633    # these layers need to be built or NOT
634
635    AM_CONDITIONAL(BUILD_MPI_FORTRAN_MPIFH_BINDINGS_LAYER,
636                   [test $OMPI_PROFILING_COMPILE_SEPARATELY -eq 1 && \
637                    test $OMPI_BUILD_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS])
638    AM_CONDITIONAL(BUILD_PMPI_FORTRAN_MPIFH_BINDINGS_LAYER,
639                   [test $OMPI_BUILD_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS])
640    AM_CONDITIONAL(OMPI_BUILD_FORTRAN_MPIFH_BINDINGS,
641                   [test $OMPI_BUILD_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS])
642
643    # -------------------
644    # use mpi final setup
645    # -------------------
646
647    # This goes into ompi/Makefile.am
648    AC_SUBST(OMPI_FORTRAN_USEMPI_DIR)
649    # This goes into mpifort-wrapper-data.txt
650    AC_SUBST(OMPI_FORTRAN_USEMPI_LIB)
651
652    # These go into mpi-ignore-tkr-interfaces.h / mpi-ignore-tkr-file-interfaces.h
653    AC_SUBST(OMPI_FORTRAN_IGNORE_TKR_PREDECL)
654    AC_SUBST(OMPI_FORTRAN_IGNORE_TKR_TYPE)
655
656    # These go into ompi/info/param.c
657    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_IGNORE_TKR_PREDECL],
658                       ["$OMPI_FORTRAN_IGNORE_TKR_PREDECL"],
659                       [Pre declaration for FORTRAN ignore parameter TKR behavior])
660    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_IGNORE_TKR_TYPE],
661                       [$type],
662                       [Type declaration for FORTRAN ignore parameter TKR behavior])
663    AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_IGNORE_TKR,
664                       [$OMPI_FORTRAN_HAVE_IGNORE_TKR],
665                       [Whether the Fortran compiler supports ignore TKR functionality or not])
666
667    # Somewhat redundant because ompi/Makefile.am won't traverse into
668    # the unused "use mpi" directory, but we might as well have the
669    # ompi/mpi/fortran/use-mpi*/Makefile.ams be safe, too.
670    # True if we're building either "use mpi" bindings
671    AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPI_BINDINGS,
672                   [test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS || \
673                    test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 1])
674    # True if we're building the old TKR-style bindings
675    AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS,
676                   [test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS && \
677                    test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 0])
678    # True if we're building the new ignore-TKR-style bindings
679    AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPI_IGNORE_TKR_BINDINGS,
680                   [test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPI_BINDINGS && \
681                    test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 1])
682
683    # -------------------
684    # use mpi_f08 final setup
685    # -------------------
686
687    # This goes into mpifort-wrapper-data.txt
688    AC_SUBST(OMPI_FORTRAN_USEMPIF08_LIB)
689
690    # These go into interfaces/mpi-f08-interfaces-[no]bind.h (and
691    # mpi-f*-interfaces*.h files)
692    AC_SUBST(OMPI_FORTRAN_F08_PREDECL)
693    AC_SUBST(OMPI_FORTRAN_F08_TYPE)
694
695    AC_SUBST(OMPI_MPI_PREFIX)
696    AC_SUBST(OMPI_MPI_BIND_PREFIX)
697    AC_SUBST(OMPI_F08_SUFFIX)
698    AC_SUBST(OMPI_F_SUFFIX)
699
700    # This is used to generate weak symbols (or not) in
701    # ompi/mpi/fortran/mpif-h/<foo>_f.c, and
702    # ompi/mpi/fortran/configure-fortran-output.h.
703    AC_SUBST(OMPI_FORTRAN_NEED_WRAPPER_ROUTINES)
704    AC_DEFINE_UNQUOTED(OMPI_FORTRAN_NEED_WRAPPER_ROUTINES,
705                       [$OMPI_FORTRAN_NEED_WRAPPER_ROUTINES],
706                       [Whether the mpi_f08 implementation is using wrapper routines ("bad" Fortran compiler) or weak symbols ("good" Fortran compiler) for the F08 interface definition implementations])
707
708    AC_DEFINE_UNQUOTED(OMPI_FORTRAN_F08_HANDLE_SIZE,
709                       $OMPI_FORTRAN_F08_HANDLE_SIZE,
710                       [How many bytes the mpi_f08 TYPE(MPI_<foo>) handles will be])
711
712    AC_DEFINE_UNQUOTED(OMPI_FORTRAN_F08_HANDLE_ALIGNMENT,
713                       $OMPI_FORTRAN_F08_HANDLE_ALIGNMENT,
714                       [How many bytes the mpi_f08 TYPE(MPI_<foo>) handles will be aligned to])
715
716    # These go into ompi/info/param.c
717    AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_F08_ASSUMED_RANK,
718                       [$OMPI_FORTRAN_HAVE_F08_ASSUMED_RANK],
719                       [For ompi_info: Whether the Fortran compiler supports the Fortran 2008 "assumed rank" syntax or not])
720    AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C,
721                       [$OMPI_FORTRAN_HAVE_BIND_C],
722                       [For ompi_info: Whether the compiler supports all forms of BIND(C) that we need])
723    AC_SUBST(OMPI_FORTRAN_HAVE_ISO_C_BINDING)
724    AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_ISO_C_BINDING,
725                       [$OMPI_FORTRAN_HAVE_ISO_C_BINDING],
726                       [For ompi_info: Whether the compiler supports ISO_C_BINDING or not])
727    AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_SUB,
728                       [$OMPI_FORTRAN_HAVE_BIND_C_SUB],
729                       [For ompi_info: Whether the compiler supports SUBROUTINE ... BIND(C) or not])
730    AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_TYPE,
731                       [$OMPI_FORTRAN_HAVE_BIND_C_TYPE],
732                       [For ompi_info: Whether the compiler supports TYPE, BIND(C) or not])
733    AC_DEFINE_UNQUOTED(OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME,
734                       [$OMPI_FORTRAN_HAVE_BIND_C_TYPE_NAME],
735                       [For ompi_info: Whether the compiler supports TYPE, BIND(C, NAME="name") or not])
736    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_OPTIONAL_ARGS],
737                       [$OMPI_FORTRAN_HAVE_OPTIONAL_ARGS],
738                       [For ompi_info: whether the Fortran compiler supports optional arguments or not])
739
740    # For configure-fortran-output.h, mpi-f08-types.F90 (and ompi_info)
741    AC_SUBST([OMPI_FORTRAN_HAVE_PRIVATE])
742    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_PRIVATE],
743                       [$OMPI_FORTRAN_HAVE_PRIVATE],
744                       [For mpi-f08-types.f90 and ompi_info: whether the compiler supports the "private" keyword or not (used in MPI_Status)])
745
746    # For configure-fortran-output.h, mpi-f08-types.F90 (and ompi_info)
747    AC_SUBST([OMPI_FORTRAN_HAVE_PROTECTED])
748    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_PROTECTED],
749                       [$OMPI_FORTRAN_HAVE_PROTECTED],
750                       [For mpi-f08-types.f90 and .F90 and ompi_info: whether the compiler supports the "protected" keyword or not])
751
752    # For configure-fortran-output.h, mpi-f08-interfaces-callbacks.F90
753    # (and ompi_info)
754    AC_SUBST([OMPI_FORTRAN_HAVE_ABSTRACT])
755    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_ABSTRACT],
756                       [$OMPI_FORTRAN_HAVE_ABSTRACT],
757                       [For mpi-f08-interfaces-callbacks.f90 and ompi_info: whether the compiler supports the "abstract" keyword or not])
758
759    # For configure-fortran-output.h, various files in
760    # ompi/mpi/fortran/use-mpi-f08/*.F90 and *.h files (and ompi_info)
761    AC_SUBST([OMPI_FORTRAN_HAVE_ASYNCHRONOUS])
762    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_ASYNCHRONOUS],
763                       [$OMPI_FORTRAN_HAVE_ASYNCHRONOUS],
764                       [For ompi/mpi/fortran/use-mpi-f08/blah.F90 and blah.h and ompi_info: whether the compiler supports the "asynchronous" keyword or not])
765
766    # For configure-fortran-output.h, various files in
767    # ompi/mpi/fortran/use-mpi-f08/*.F90 and *.h files (and ompi_info)
768    AC_SUBST([OMPI_FORTRAN_HAVE_PROCEDURE])
769    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_PROCEDURE],
770                       [$OMPI_FORTRAN_HAVE_PROCEDURE],
771                       [For ompi/mpi/fortran/use-mpi-f08/blah.F90 and blah.h and ompi_info: whether the compiler supports the "procedure" keyword or not])
772
773    # For configure-fortran-output.h, various files in
774    # ompi/mpi/fortran/use-mpi-f08/*.F90 and *.h files (and ompi_info)
775    AC_SUBST([OMPI_FORTRAN_HAVE_USE_ONLY])
776    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_USE_ONLY],
777                       [$OMPI_FORTRAN_HAVE_USE_ONLY],
778                       [For ompi/mpi/fortran/use-mpi-f08/blah.F90 and blah.h and ompi_info: whether the compiler supports "USE ... ONLY" notation properly or not])
779
780    # For configure-fortran-output.h, various files in
781    # ompi/mpi/fortran/use-mpi-f08/*.F90 and *.h files (and ompi_info)
782    AC_SUBST([OMPI_FORTRAN_HAVE_C_FUNLOC])
783    AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_C_FUNLOC],
784                       [$OMPI_FORTRAN_HAVE_C_FUNLOC],
785                       [For ompi/mpi/fortran/use-mpi-f08/blah.F90 and blah.h and ompi_info: whether the compiler supports c_funloc or not])
786
787    # For configure-fortran-output.h
788    AC_SUBST(OMPI_FORTRAN_HAVE_BIND_C)
789
790    # Somewhat redundant because ompi/Makefile.am won't traverse into
791    # ompi/mpi/fortran/use-mpi-f08 if it's not to be built, but we
792    # might as well have ompi/mpi/fortran/use-mpi-f08/Makefile.am be
793    # safe, too.
794    AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS,
795                   [test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS])
796
797    AC_DEFINE_UNQUOTED(OMPI_BUILD_FORTRAN_BINDINGS,
798                       $OMPI_BUILD_FORTRAN_BINDINGS,
799                       [The level of fortran bindings to be built])
800])
801