From ec8b2c47a9927ec64240948bdb1ee33d19d8b2ee Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 1 Dec 2018 11:58:35 -0800 Subject: [PATCH] ompi_ext.m4: ensure ext name <= 26 characters Ensure that MPI extensions with mpif.h bindings have names that are <=26 characters long. 26 is the magic number that still allows us to have an "include ..." line in the user-facing mpif-ext.h header file that includes this extension's header file without going over 72 characters. Signed-off-by: Jeff Squyres Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@c0faf34855d0e8c7a263872a115d8ec64e9147e8) --- config/ompi_ext.m4 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/config/ompi_ext.m4 b/config/ompi_ext.m4 index 1ba7ac1679..827658e6db 100644 --- a/config/ompi_ext.m4 +++ b/config/ompi_ext.m4 @@ -513,6 +513,33 @@ EOF EXT_MPIFH_HEADERS="$EXT_MPIFH_HEADERS mpiext/mpiext_${component}_mpifh.h" $4="$$4 $component" + # Per https://github.com/open-mpi/ompi/pull/6030, we will end + # up putting a user-visible Fortran "include" statement in the + # installed mpif-ext.h file, and we therefore have to ensure + # that the total length of the line is <=72 characters. Doing + # a little math here: + # + # leading indent spaces: 6 chars + # "include '": 9 chars + # "openmpi/mpiext/mpiext_NAME_mpifh.h": without NAME, 30 chars + # trailing "'": 1 char + # + # 6+9+30+1 = 46 chars overhead. + # 72-46 = 26 characters left for NAME. + # + # It would be exceedingly unusual to have an MPI extension + # name > 26 characters. But just in case, put a check here + # to make sure: error out if the MPI extension name is > 26 + # characters (because otherwise it'll just be a really weird / + # hard to diagnose compile error when a user tries to compile + # a Fortran MPI application that includes `mpif-ext.h`). + len=`echo $component | wc -c` + result=`expr $len \> 26` + AS_IF([test $result -eq 1], + [AC_MSG_WARN([MPI extension name too long: $component]) + AC_MSG_WARN([For esoteric reasons, MPI Extensions with mpif.h bindings must have a name that is <= 26 characters]) + AC_MSG_ERROR([Cannot continue])]) + component_header="mpiext_${component}_mpifh.h" cat >> $mpif_ext_h <