Skip to content

Commit 2220623

Browse files
committed
config/ompi_ext: Don't include mpiext_*_mpifh.h in mpi_f08_ext
Including `mpiext_*_mpifh.h` in the source file of the `mpi_f08_ext` module is not always appropriate. For example, if you want to define a new datatype in an MPI extension, the `include 'mpif-ext.h'` binding defines the datatype as `integer` but the `use mpi_f08_ext` binding defines it as `type(mpi_datatype)`. They conflict. This commit allows each MPI extension to declare whether it wants to include its `mpiext_*_mpifh.h` in `mpi_f08` and `mpi_f08_ext` respectively. The default (no declaration) is 'want'. See `ompi/mpiext/example/configure.m4` for an example. Signed-off-by: KAWASHIMA Takahiro <t-kawashima@jp.fujitsu.com>
1 parent fe5d5c7 commit 2220623

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

config/ompi_ext.m4

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,15 @@ EOF
601601
#
602602
# Include the mpif.h header if it is available. Cannot do
603603
# this from inside the usempi.h since, for VPATH builds, the
604-
# srcdir is needed to find the header.
604+
# srcdir is needed to find the header. Each extension can
605+
# refuse it by defining the OMPI_MPIEXT_$1_INCLUDE_MPIFH_IN_USEMPI
606+
# macro in its ompi/mpiext/*/configure.m4. See
607+
# ompi/mpiext/example/configure.m4 for an example.
605608
#
606-
if test "$enabled_mpifh" = 1; then
609+
m4_ifdef([OMPI_MPIEXT_]$1[_INCLUDE_MPIFH_IN_USEMPI],
610+
[include_mpifh=OMPI_MPIEXT_$1_INCLUDE_MPIFH_IN_USEMPI],
611+
[include_mpifh=1])
612+
if test "$enabled_mpifh" = 1 && test "$include_mpifh" != 0; then
607613
mpifh_component_header="mpiext_${component}_mpifh.h"
608614
cat >> $mpiusempi_ext_h <<EOF
609615
#include "${mpifh_component_header_path}"
@@ -657,9 +663,15 @@ EOF
657663
#
658664
# Include the mpif.h header if it is available. Cannot do
659665
# this from inside the usempif08.h since, for VPATH builds,
660-
# the srcdir is needed to find the header.
666+
# the srcdir is needed to find the header. Each extension can
667+
# refuse it by defining the OMPI_MPIEXT_$1_INCLUDE_MPIFH_IN_USEMPIF08
668+
# macro in its ompi/mpiext/*/configure.m4. See
669+
# ompi/mpiext/example/configure.m4 for an example.
661670
#
662-
if test "$enabled_mpifh" = 1; then
671+
m4_ifdef([OMPI_MPIEXT_]$1[_INCLUDE_MPIFH_IN_USEMPIF08],
672+
[include_mpifh=OMPI_MPIEXT_$1_INCLUDE_MPIFH_IN_USEMPIF08],
673+
[include_mpifh=1])
674+
if test "$enabled_mpifh" = 1 && test "$include_mpifh" != 0; then
663675
mpifh_component_header="mpiext_${component}_mpifh.h"
664676
cat >> $mpiusempif08_ext_h <<EOF
665677
#include "${mpifh_component_header_path}"

ompi/mpiext/example/configure.m4

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,11 @@ AC_DEFUN([OMPI_MPIEXT_example_CONFIG],[
3232

3333
# only need to set this if the component needs init/finalize hooks
3434
AC_DEFUN([OMPI_MPIEXT_example_NEED_INIT], [1])
35+
36+
# By default, mpiext_example_mpifh.h is included in the source file
37+
# of the mpi_ext module. To disable it, define this macro as 0.
38+
#AC_DEFUN([OMPI_MPIEXT_example_INCLUDE_MPIFH_IN_USEMPI], [0])
39+
40+
# By default, mpiext_example_mpifh.h is included in the source file
41+
# of the mpi_f08_ext module. To disable it, define this macro as 0.
42+
#AC_DEFUN([OMPI_MPIEXT_example_INCLUDE_MPIFH_IN_USEMPIF08], [0])

0 commit comments

Comments
 (0)