Skip to content

Commit e70780b

Browse files
ggouaillardetjsquyres
authored andcommitted
configury: allow mpi extensions with no libraries
Do not require an archive when the OMPI_MPIEXT_<ext>_HAVE_OBJECT macro is defined to 0. See `ompi/mpiext/example/configure.m4`. Allow some extensions to be built on OS X since the creation of archives with no files is not permitted. Refs. #6205 Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp> Signed-off-by: KAWASHIMA Takahiro <t-kawashima@jp.fujitsu.com> Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
1 parent 61d6770 commit e70780b

File tree

2 files changed

+48
-17
lines changed

2 files changed

+48
-17
lines changed

config/ompi_ext.m4

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dnl University Research and Technology
55
dnl Corporation. All rights reserved.
66
dnl Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved
77
dnl Copyright (c) 2011-2012 Oak Ridge National Labs. All rights reserved.
8-
dnl Copyright (c) 2015-2018 Research Organization for Information Science
8+
dnl Copyright (c) 2015-2019 Research Organization for Information Science
99
dnl and Technology (RIST). All rights reserved.
1010
dnl Copyright (c) 2017 The University of Tennessee and The University
1111
dnl of Tennessee Research Foundation. All rights
@@ -259,7 +259,8 @@ EOF
259259
[OMPI_MPIEXT_C],
260260
[OMPI_MPIEXT_MPIFH],
261261
[OMPI_MPIEXT_USEMPI],
262-
[OMPI_MPIEXT_USEMPIF08])])])
262+
[OMPI_MPIEXT_USEMPIF08],
263+
[OMPI_MPIEXT_ARCHIVE])])])
263264

264265
###############
265266
# C Bindings
@@ -344,10 +345,10 @@ EOF
344345

345346
OMPI_EXT_MAKE_DIR_LIST(OMPI_MPIEXT_ALL_SUBDIRS, $OMPI_MPIEXT_ALL)
346347

347-
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_C, $OMPI_MPIEXT_C, c, c)
348-
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_MPIFH, $OMPI_MPIEXT_MPIFH, mpif-h, mpifh)
349-
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_USEMPI, $OMPI_MPIEXT_USEMPI, use-mpi, usempi)
350-
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_USEMPIF08, $OMPI_MPIEXT_USEMPIF08, use-mpi-f08, usempif08)
348+
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_C, $OMPI_MPIEXT_C, $OMPI_MPIEXT_ARCHIVE, c, c)
349+
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_MPIFH, $OMPI_MPIEXT_MPIFH, $OMPI_MPIEXT_ARCHIVE, mpif-h, mpifh)
350+
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_USEMPI, $OMPI_MPIEXT_USEMPI, $OMPI_MPIEXT_ARCHIVE, use-mpi, usempi)
351+
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_USEMPIF08, $OMPI_MPIEXT_USEMPIF08, $OMPI_MPIEXT_ARCHIVE, use-mpi-f08, usempif08)
351352

352353
comps=`echo $OMPI_MPIEXT_C | sed -e 's/^[ \t]*//;s/[ \t]*$//;s/ /, /g'`
353354
AC_DEFINE_UNQUOTED([OMPI_MPIEXT_COMPONENTS], ["$comps"],
@@ -366,7 +367,8 @@ EOF
366367
# (3) c_components_variable,
367368
# (4) mpifh_components_variable,
368369
# (5) usempi_components_variable,
369-
# (6) usempif08_components_variable)
370+
# (6) usempif08_components_variable,
371+
# (7) archive_components_variable)
370372
#
371373
# - component_name is a single, naked string (no prefix)
372374
# - all others are naked component names (e.g., "example"). If an
@@ -386,7 +388,7 @@ AC_DEFUN([EXT_CONFIGURE_M4_CONFIG_COMPONENT],[
386388
OMPI_MPIEXT_$1_CONFIG([should_build=${should_build}], [should_build=0])
387389

388390
AS_IF([test $should_build -eq 1],
389-
[EXT_PROCESS_COMPONENT([$1], [$2], [$3], [$4], [$5], [$6])],
391+
[EXT_PROCESS_COMPONENT([$1], [$2], [$3], [$4], [$5], [$6], [$7])],
390392
[EXT_PROCESS_DEAD_COMPONENT([$1], [$2])])
391393
])
392394

@@ -403,7 +405,8 @@ AC_DEFUN([EXT_CONFIGURE_M4_CONFIG_COMPONENT],[
403405
# (3) c_components_variable,
404406
# (4) mpifh_components_variable,
405407
# (5) usempi_components_variable,
406-
# (6) usempif08_components_variable)
408+
# (6) usempif08_components_variable,
409+
# (7) archive_components_variable)
407410
#
408411
# C bindings are mandatory. Other bindings are optional / built if
409412
# they are found. Here's the files that the m4 expects:
@@ -615,7 +618,7 @@ EOF
615618
m4_ifdef([OMPI_MPIEXT_]$1[_INCLUDE_MPIFH_IN_USEMPI],
616619
[include_mpifh=OMPI_MPIEXT_$1_INCLUDE_MPIFH_IN_USEMPI],
617620
[include_mpifh=1])
618-
if test "$enabled_mpifh" = 1 && test "$include_mpifh" != 0; then
621+
if test $enabled_mpifh -eq 1 && test $include_mpifh -ne 0; then
619622
mpifh_component_header="mpiext_${component}_mpifh.h"
620623
cat >> $mpiusempi_ext_h <<EOF
621624
#include "${mpifh_component_header_path}"
@@ -677,7 +680,7 @@ EOF
677680
m4_ifdef([OMPI_MPIEXT_]$1[_INCLUDE_MPIFH_IN_USEMPIF08],
678681
[include_mpifh=OMPI_MPIEXT_$1_INCLUDE_MPIFH_IN_USEMPIF08],
679682
[include_mpifh=1])
680-
if test "$enabled_mpifh" = 1 && test "$include_mpifh" != 0; then
683+
if test $enabled_mpifh -eq 1 && test $include_mpifh -ne 0; then
681684
mpifh_component_header="mpiext_${component}_mpifh.h"
682685
cat >> $mpiusempif08_ext_h <<EOF
683686
#include "${mpifh_component_header_path}"
@@ -704,6 +707,13 @@ EOF
704707
[echo "extern const ompi_mpiext_component_t ompi_mpiext_${component};" >> $outfile.extern
705708
echo " &ompi_mpiext_${component}, " >> $outfile.struct])
706709

710+
m4_ifdef([OMPI_MPIEXT_]$1[_HAVE_OBJECT],
711+
[have_object=OMPI_MPIEXT_$1_HAVE_OBJECT],
712+
[have_object=1])
713+
if test $have_object -ne 0; then
714+
$7="$$7 $component"
715+
fi
716+
707717
# now add the flags that were set in the environment variables
708718
# framework_component_FOO (for example, the flags set by
709719
# m4_configure components)
@@ -804,7 +814,7 @@ AC_DEFUN([EXT_COMPONENT_BUILD_CHECK],[
804814
fi
805815
fi
806816

807-
AS_IF([test "$want_component" = "1"], [$2], [$3])
817+
AS_IF([test $want_component -eq 1], [$2], [$3])
808818
])
809819

810820

@@ -821,25 +831,31 @@ AC_DEFUN([OMPI_EXT_MAKE_DIR_LIST],[
821831
])
822832

823833
# OMPI_EXT_MAKE_LISTS((1) subst'ed variable prefix,
824-
# (2) shell list,
825-
# (3) bindings dir name,
826-
# (4) bindings suffix)
834+
# (2) shell list of extensions of which the bindings are enabled,
835+
# (3) shell list of extensions which needs libtool archive,
836+
# (4) bindings dir name,
837+
# (5) bindings suffix)
827838
#
828839
# Prefix every extension name with "mpiext/".
829840
# -------------------------------------------------------------------------
830841
AC_DEFUN([OMPI_EXT_MAKE_LISTS],[
831842
# Make the directory list
832843
tmp=
833844
for item in $2 ; do
834-
tmp="$tmp mpiext/$item/$3"
845+
tmp="$tmp mpiext/$item/$4"
835846
done
836847
$1_DIRS=$tmp
837848
AC_SUBST($1_DIRS)
838849

839850
# Make the list of libraries
840851
tmp=
841852
for item in $2 ; do
842-
tmp="$tmp "'$(top_builddir)'"/ompi/mpiext/$item/$3/libmpiext_${item}_$4.la"
853+
for item2 in $3 ; do
854+
if test $item = $item2; then
855+
tmp="$tmp "'$(top_builddir)'"/ompi/mpiext/$item/$4/libmpiext_${item}_$5.la"
856+
break
857+
fi
858+
done
843859
done
844860
$1_LIBS=$tmp
845861
AC_SUBST($1_LIBS)

ompi/mpiext/example/configure.m4

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Copyright (c) 2004-2009 The Trustees of Indiana University.
44
# All rights reserved.
55
# Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved.
6+
# Copyright (c) 2019 FUJITSU LIMITED. All rights reserved.
67
# $COPYRIGHT$
78
#
89
# Additional copyrights may follow
@@ -40,3 +41,17 @@ AC_DEFUN([OMPI_MPIEXT_example_NEED_INIT], [1])
4041
# By default, mpiext_example_mpifh.h is included in the source file
4142
# of the mpi_f08_ext module. To disable it, define this macro as 0.
4243
#AC_DEFUN([OMPI_MPIEXT_example_INCLUDE_MPIFH_IN_USEMPIF08], [0])
44+
45+
# By default, $build_dir/ompi/mpiext/example/c/libmpiext_example_c.la
46+
# (Libtool archive) is added to the dependency list of libmpi.la.
47+
# This rule is the same for mpif-h and use-mpi-f08 bindings.
48+
# However, the ar command of macOS refuses to create an archive file
49+
# which does not contain any object files. If your extension has no
50+
# object files, i.e. only header files, define this macro as 0 so that
51+
# the *.la files are not added to the dependency lists.
52+
53+
# NOTE: This is currently a single macro for the entire MPI extension.
54+
# I.e., your extension either has a library for each binding, or it has *no*
55+
# libraries for any of the bindings. If finer-grained control is needed
56+
# someday, we may need to split this into multiple macros.
57+
#AC_DEFUN([OMPI_MPIEXT_example_HAVE_OBJECT], [0])

0 commit comments

Comments
 (0)