forked from open-mpi/ompi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathompi_ext.m4
775 lines (661 loc) · 24 KB
/
ompi_ext.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2011-2012 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
######################################################################
#
# OMPI_EXT
#
# configure the Interface Extensions [similar to MCA version]. Works hand in
# hand with Open MPI's autogen.pl, requiring it's specially formatted lists
# of frameworks, components, etc.
#
# USAGE:
# OMPI_EXT()
#
######################################################################
AC_DEFUN([OMPI_EXT],[
dnl for OPAL_CONFIGURE_USER env variable
AC_REQUIRE([OPAL_CONFIGURE_SETUP])
# Note that we do not build DSO's here -- we *only* build convenience
# libraries that get slurped into higher-level libraries
#
# [default -- no option given] = No extensions built
# --enable-mpi-ext=[,]*EXTENSION[,]*
#
AC_ARG_ENABLE(mpi-ext,
AC_HELP_STRING([--enable-mpi-ext[=LIST]],
[Comma-separated list of extensions that should be built. Possible values: ompi_mpiext_list. Example: "--enable-mpi-ext=foo,bar" will enable building the MPI extensions "foo" and "bar". If LIST is empty or the special value "all", then all available MPI extensions will be built (default: none).]))
# print some nice messages about what we're about to do...
AC_MSG_CHECKING([for available MPI Extensions])
AC_MSG_RESULT([ompi_mpiext_list])
AC_MSG_CHECKING([which MPI extension should be enabled])
if test "$enable_mpi_ext" = "yes" || test "$enable_mpi_ext" = "all"; then
msg="All Extensions"
str="`echo ENABLE_EXT_ALL=1`"
eval $str
else
ifs_save="$IFS"
IFS="${IFS}$PATH_SEPARATOR,"
msg=
for item in $enable_mpi_ext; do
type="`echo $item | cut -s -f1 -d-`"
if test -z $type ; then
type=$item
fi
str="`echo ENABLE_${type}=1 | sed s/-/_/g`"
eval $str
msg="$item $msg"
done
IFS="$ifs_save"
fi
AC_MSG_RESULT([$msg])
unset msg
m4_ifdef([ompi_mpiext_list], [],
[m4_fatal([Could not find MPI Extensions list. Aborting.])])
EXT_CONFIGURE
])
######################################################################
#
# EXT_CONFIGURE
#
# USAGE:
# EXT_CONFIGURE()
#
######################################################################
AC_DEFUN([EXT_CONFIGURE],[
outdir=ompi/include
# first create the output include directory
mkdir -p $outdir
###############
# C Bindings
###############
# remove any previously generated #include files
mpi_ext_h=$outdir/mpi-ext.h
rm -f $mpi_ext_h
# Create the final mpi-ext.h file.
cat > $mpi_ext_h <<EOF
/*
* \$HEADER\$
*/
#ifndef OMPI_MPI_EXT_H
#define OMPI_MPI_EXT_H 1
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
#define OMPI_HAVE_MPI_EXT 1
EOF
###############
# mpif.h Bindings
###############
# remove any previously generated #include files
mpif_ext_h=$outdir/mpif-ext.h
rm -f $mpif_ext_h
# Create the final mpif-ext.h file.
cat > $mpif_ext_h <<EOF
! -*- fortran -*-
! \$HEADER\$
!
! *** THIS FILE IS AUTOMATICALLY GENERATED!
! *** Any manual edits will be lost!
!
integer OMPI_HAVE_MPI_EXT
parameter (OMPI_HAVE_MPI_EXT=1)
!
EOF
###############
# "use mpi" Bindings
###############
# Although Fortran module files are essentially compiled header
# files, we don't create them in ompi/include, like we do for
# mpi.h and mpif.h. Instead, we build them down in ompi/fortran,
# when we build the rest of the Fortran modules. Indeed, in the
# "use mpi" case, it needs some of the same internal modules that
# the mpi_f08 module itself needs. So the mpi_f08_ext module has
# to be built *after* the mpi_f08 module (so that all the internal
# modules it needs are already built).
# remove any previously generated #include files
outdir=ompi/mpi/fortran/mpiext
mkdir -p $outdir
mpiusempi_ext_h=$outdir/mpi-ext-module.F90
rm -f $mpiusempi_ext_h
# Create the final mpiusempi-ext.h file.
cat > $mpiusempi_ext_h <<EOF
! -*- fortran -*-
! \$HEADER\$
!
! *** THIS FILE IS AUTOMATICALLY GENERATED!
! *** Any manual edits will be lost!
!
module mpi_ext
! Even though this is not a useful parameter (cannot be used as a
! preprocessor catch) define it to keep the linker from complaining
! during the build.
integer OMPI_HAVE_MPI_EXT
parameter (OMPI_HAVE_MPI_EXT=1)
!
EOF
# Make an AM conditional to see whether we're building the mpi_ext
# module. Note that we only build it if we support the ignore-tkr
# mpi module.
AS_IF([test $OMPI_BUILD_FORTRAN_USEMPI_BINDINGS -eq 1 && \
test $OMPI_FORTRAN_HAVE_IGNORE_TKR -eq 1],
[OMPI_BUILD_FORTRAN_USEMPI_EXT=1],
[OMPI_BUILD_FORTRAN_USEMPI_EXT=0])
AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPI_EXT,
[test $OMPI_BUILD_FORTRAN_USEMPI_EXT -eq 1])
###############
# "use mpi_f08" Bindings
###############
# See note above: we generate the mpi_f08_ext module in
# ompi/mpi/fortran/mpiext
# remove any previously generated #include files
mpiusempif08_ext_h=$outdir/mpi-f08-ext-module.F90
rm -f $mpiusempif08_ext_h
# Create the final mpiusempi-ext.h file.
cat > $mpiusempif08_ext_h <<EOF
! -*- fortran -*-
! \$HEADER\$
!
! *** THIS FILE IS AUTOMATICALLY GENERATED!
! *** Any manual edits will be lost!
!
module mpi_f08_ext
! Even though this is not a useful parameter (cannot be used as a
! preprocessor catch) define it to keep the linker from complaining
! during the build.
integer OMPI_HAVE_MPI_EXT
parameter (OMPI_HAVE_MPI_EXT=1)
!
EOF
# Only build this mpi_f08_ext module if we're building the "use
# mpi_f08" module *and* it's the non-descriptor one.
AS_IF([test $OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS -eq 1 && \
test $OMPI_BUILD_FORTRAN_F08_SUBARRAYS -eq 0],
[OMPI_BUILD_FORTRAN_USEMPIF08_EXT=1],
[OMPI_BUILD_FORTRAN_USEMPIF08_EXT=0])
AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPIF08_EXT,
[test $OMPI_BUILD_FORTRAN_USEMPIF08_EXT -eq 1])
# Make an AM conditional to see whether we're building either the
# mpi_ext or mpi_f08_Ext modules.
AM_CONDITIONAL(OMPI_BUILD_FORTRAN_USEMPI_OR_USEMPIF08_EXT,
[test $OMPI_BUILD_FORTRAN_USEMPI_EXT -eq 1 || \
test $OMPI_BUILD_FORTRAN_USEMPIF08_EXT -eq 1])
#
# Process each component
#
# remove any previously generated #include files
outfile_real=ompi/mpiext/static-components.h
outfile=$outfile_real.new
rm -f $outfile $outfile.struct $outfile.extern
$MKDIR_P ompi/mpiext
touch $outfile.struct $outfile.extern
m4_foreach(extension, [ompi_mpiext_list],
[m4_ifval(extension,
[EXT_CONFIGURE_M4_CONFIG_COMPONENT(extension,
[OMPI_MPIEXT_ALL],
[OMPI_MPIEXT_C],
[OMPI_MPIEXT_MPIFH],
[OMPI_MPIEXT_USEMPI],
[OMPI_MPIEXT_USEMPIF08])])])
###############
# C Bindings
###############
# Create the final mpi-ext.h file.
cat >> $mpi_ext_h <<EOF
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* OMPI_MPI_EXT_H */
EOF
###############
# mpif.h Bindings
###############
# Create the final mpif-ext.h file.
cat >> $mpif_ext_h <<EOF
!
EOF
###############
# "use mpi" Bindings
###############
# Create the final mpiusempi-ext.h file.
cat >> $mpiusempi_ext_h <<EOF
!
end module mpi_ext
EOF
###############
# "use mpi_f08" Bindings
###############
# Create the final mpiusempi-ext.h file.
cat >> $mpiusempif08_ext_h <<EOF
!
end module mpi_f08_ext
EOF
# Create the final .h file that will be included in the type's
# top-level glue. This lists all the static components. We don't
# need to do this for "common".
if test "$2" != "common"; then
cat > $outfile <<EOF
/*
* \$HEADER\$
*/
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
`cat $outfile.extern`
const ompi_mpiext_component_t *ompi_mpiext_components[[]] = {
`cat $outfile.struct`
NULL
};
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
EOF
# Only replace the header file if a) it doesn't previously
# exist, or b) the contents are different. Do this to not
# trigger recompilation of certain .c files just because the
# timestamp changed on $outfile_real (similar to the way AC
# handles AC_CONFIG_HEADER files).
diff $outfile $outfile_real > /dev/null 2>&1
if test "$?" != "0"; then
mv $outfile $outfile_real
else
rm -f $outfile
fi
fi
rm -f $outfile.struct $outfile.extern
# We have all the results we need. Now put them in various
# variables/defines so that others can see the results.
OMPI_EXT_MAKE_DIR_LIST(OMPI_MPIEXT_ALL_SUBDIRS, $OMPI_MPIEXT_ALL)
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_C, $OMPI_MPIEXT_C, c, c)
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_MPIFH, $OMPI_MPIEXT_MPIFH, mpif-h, mpifh)
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_USEMPI, $OMPI_MPIEXT_USEMPI, use-mpi, usempi)
OMPI_EXT_MAKE_LISTS(OMPI_MPIEXT_USEMPIF08, $OMPI_MPIEXT_USEMPIF08, use-mpi-f08, usempif08)
comps=`echo $OMPI_MPIEXT_C | sed -e 's/^[ \t]*//;s/[ \t]*$//;s/ /, /g'`
AC_DEFINE_UNQUOTED([OMPI_MPIEXT_COMPONENTS], ["$comps"],
[MPI Extensions included in libmpi])
])
######################################################################
#
# EXT_CONFIGURE_M4_CONFIG_COMPONENT
#
#
# USAGE:
# EXT_CONFIGURE_M4_CONFIG_COMPONENT((1) component_name,
# (2) all_components_variable,
# (3) c_components_variable,
# (4) mpifh_components_variable,
# (5) usempi_components_variable,
# (6) usempif08_components_variable)
#
# - component_name is a single, naked string (no prefix)
# - all others are naked component names (e.g., "example"). If an
# extension is named in that variable, it means that that extension
# has bindings of that flavor.
#
######################################################################
AC_DEFUN([EXT_CONFIGURE_M4_CONFIG_COMPONENT],[
opal_show_subsubsubtitle "MPI Extension $1"
EXT_COMPONENT_BUILD_CHECK($1, [should_build=1], [should_build=0])
# try to configure the component
m4_ifdef([OMPI_MPIEXT_$1_CONFIG], [],
[m4_fatal([Could not find OMPI_MPIEXT_]$1[_CONFIG macro for ]$1[ component])])
OMPI_MPIEXT_$1_CONFIG([should_build=${should_build}], [should_build=0])
AS_IF([test $should_build -eq 1],
[EXT_PROCESS_COMPONENT([$1], [$2], [$3], [$4], [$5], [$6])],
[EXT_PROCESS_DEAD_COMPONENT([$1], [$2])])
])
######################################################################
#
# EXT_PROCESS_COMPONENT
#
# does all setup work for given component. It should be known before
# calling that this component can build properly (and exists)
#
# USAGE:
# EXT_CONFIGURE_ALL_CONFIG_COMPONENTS((1) component_name
# (2) all_components_variable,
# (3) c_components_variable,
# (4) mpifh_components_variable,
# (5) usempi_components_variable,
# (6) usempif08_components_variable)
#
# C bindings are mandatory. Other bindings are optional / built if
# they are found. Here's the files that the m4 expects:
#
#--------------------
#
# C:
# - c/mpiext_<component>_c.h: is included in mpi_ext.h
# - c/libmpiext_<component>.la: convneience library slurped into libmpi.la
#
# mpi.f.h:
# - mpif-h/mpiext_<component>_mpifh.h: is included mpi mpif_ext.h
# - mpif-h/libmpiext_<component>_mpifh.la: convenience library slurped
# into libmpi_mpifh.la
#
# If the ..._mpifh.h file exists, it is assumed that "make all" will
# build the .la file. And therefore we'll include full support for
# the mpif.h bindings for this extension in OMPI.
#
#--------------------
#
# use mpi:
# - use-mpi/mpiext_<component>_usempi.h: included in the mpi_ext module
#
# Only supported when the ignore-tkr mpi module is built (this
# currently means: when you don't use gfortran).
#
# If the ..._usempi.h file exists, it is assumed that we'll include
# full support for the mpi_ext bindings for this extension in OMPI.
#
# NO LIBRARY IS SUPPORTED FOR THE mpi MODULE BINDINGS! It is assumed
# that all required symbols will be in the
# libmpiext_<component>_mpifh.la library, and all that this set of
# bindings does it give strong type checking to those subroutines.
#
#--------------------
#
# use mpi_f08:
# - use-mpi-f08/mpiext_<component>_usempif08.h: included in the mpi_ext module
# - use-mpi-f08/libmpiext_<component>_usempif08.la: convenience
# library slurped into libmpi_usempif08.la
#
# Only supported when the non-descriptor-based mpi_f08 module is built
# (this currently means: when you don't use gfortran).
#
# If the ..._usempif08.h file exists, it is assumed that "make all"
# will build the .la file. And therefore we'll include full support
# for the mpi_f08 bindings for this extension in OMPI.
#
######################################################################
AC_DEFUN([EXT_PROCESS_COMPONENT],[
component=$1
# Output pretty results
AC_MSG_CHECKING([if MPI Extension $component can compile])
AC_MSG_RESULT([yes])
tmp[=]m4_translit([$1],[a-z],[A-Z])
component_define="OMPI_HAVE_MPI_EXT_${tmp}"
###############
# C Bindings
###############
test_header="${srcdir}/ompi/mpiext/$component/c/mpiext_${component}_c.h"
AC_MSG_CHECKING([if MPI Extension $component has C bindings])
AS_IF([test ! -e "$test_header"],
[ # There *must* be C bindings
AC_MSG_RESULT([no])
AC_MSG_WARN([C bindings for MPI extensions are required])
AC_MSG_ERROR([Cannot continue])])
AC_MSG_RESULT([yes (required)])
# Save the list of headers and convenience libraries that this
# component will output
$2="$$2 $component"
$3="$$3 $component"
# JMS Where is this needed?
EXT_C_HEADERS="$EXT_C_HEADERS mpiext/$component/c/mpiext_${component}_c.h"
component_header="mpiext_${component}_c.h"
cat >> $mpi_ext_h <<EOF
/* Enabled Extension: $component */
#define $component_define 1
#include "openmpi/ompi/mpiext/$component/c/$component_header"
EOF
###############
# mpif.h bindings
###############
#
# Test if this extension has mpif.h bindings
# If not, skip this step.
#
test_header="${srcdir}/ompi/mpiext/$component/mpif-h/mpiext_${component}_mpifh.h"
enabled_mpifh=0
AC_MSG_CHECKING([if MPI Extension $component has mpif.h bindings])
if test -e "$test_header" ; then
AC_MSG_RESULT([yes])
enabled_mpifh=1
# JMS Where is this needed?
EXT_MPIFH_HEADERS="$EXT_MPIFH_HEADERS mpiext/$component/mpif-h/mpiext_${component}_mpifh.h"
$4="$$4 $component"
component_header="mpiext_${component}_mpifh.h"
cat >> $mpif_ext_h <<EOF
!
! Enabled Extension: $component
!
integer $component_define
parameter ($component_define=1)
include 'openmpi/ompi/mpiext/$component/mpif-h/$component_header'
EOF
else
AC_MSG_RESULT([no])
cat >> $mpif_ext_h <<EOF
!
! Enabled Extension: $component
! No mpif.h bindings available
!
integer $component_define
parameter ($component_define=0)
EOF
fi
###############
# "use mpi" bindings
###############
#
# Test if this extension has "use mpi" bindings
# If not, skip this step.
#
test_header="${srcdir}/ompi/mpiext/$component/use-mpi/mpiext_${component}_usempi.h"
AC_MSG_CHECKING([if MPI Extension $component has "use mpi" bindings])
if test -e "$test_header" ; then
AC_MSG_RESULT([yes])
# JMS Where is this needed?
EXT_USEMPI_HEADERS="$EXT_USEMPI_HEADERS mpiext/$component/use-mpi/mpiext_${component}_usempi.h"
$5="$$5 $component"
component_header="mpiext_${component}_usempi.h"
cat >> $mpiusempi_ext_h <<EOF
!
! Enabled Extension: $component
!
EOF
#
# Include the mpif.h header if it is available. Cannot do
# this from inside the usempi.h since, for VPATH builds, the
# top_ompi_srcdir is needed to find the header.
#
if test "$enabled_mpifh" = 1; then
mpifh_component_header="mpiext_${component}_mpifh.h"
cat >> $mpiusempi_ext_h <<EOF
include '$top_ompi_srcdir/ompi/mpiext/$component/mpif-h/$mpifh_component_header'
EOF
fi
cat >> $mpiusempi_ext_h <<EOF
include '$top_ompi_srcdir/ompi/mpiext/$component/use-mpi/$component_header'
EOF
else
AC_MSG_RESULT([no])
cat >> $mpiusempi_ext_h <<EOF
!
! Enabled Extension: $component
! No "use mpi" bindings available
!
EOF
fi
###############
# "use mpi_f08" bindings
###############
#
# Test if this extension has "use mpi_f08" bindings
# If not, skip this step.
#
test_header="${srcdir}/ompi/mpiext/$component/use-mpi-f08/mpiext_${component}_usempif08.h"
AC_MSG_CHECKING([if MPI Extension $component has "use mpi_f08" bindings])
if test -e "$test_header" ; then
AC_MSG_RESULT([yes])
# JMS Where is this needed?
EXT_USEMPIF08_HEADERS="$EXT_USEMPIF08_HEADERS mpiext/$component/use-mpi-f08/mpiext_${component}_usempif08.h"
$6="$$6 $component"
component_header="mpiext_${component}_usempif08.h"
cat >> $mpiusempif08_ext_h <<EOF
!
! Enabled Extension: $component
!
EOF
#
# Include the mpif.h header if it is available. Cannot do
# this from inside the usempif08.h since, for VPATH builds,
# the top_ompi_srcdir is needed to find the header.
#
if test "$enabled_mpifh" = 1; then
mpifh_component_header="mpiext_${component}_mpifh.h"
cat >> $mpiusempif08_ext_h <<EOF
include '$top_ompi_srcdir/ompi/mpiext/$component/mpif-h/$mpifh_component_header'
EOF
fi
cat >> $mpiusempif08_ext_h <<EOF
include '$top_ompi_srcdir/ompi/mpiext/$component/use-mpi-f08/$component_header'
EOF
else
AC_MSG_RESULT([no])
cat >> $mpiusempif08_ext_h <<EOF
!
! Enabled Extension: $component
! No "use mpi_f08" bindings available
!
EOF
fi
m4_ifdef([OMPI_MPIEXT_]$1[_NEED_INIT],
[echo "extern const ompi_mpiext_component_t ompi_mpiext_${component};" >> $outfile.extern
echo " &ompi_mpiext_${component}, " >> $outfile.struct])
# now add the flags that were set in the environment variables
# framework_component_FOO (for example, the flags set by
# m4_configure components)
m4_foreach(flags, [LDFLAGS, LIBS],
[AS_IF([test "$mpiext_$1_WRAPPER_EXTRA_]flags[" = ""],
[OPAL_FLAGS_APPEND_UNIQ([ompi_mca_wrapper_extra_]m4_tolower(flags), [$mpiext_$1_]flags)],
[OPAL_FLAGS_APPEND_UNIQ([ompi_mca_wrapper_extra_]m4_tolower(flags), [$mpiext_$1_WRAPPER_EXTRA_]flags)])
])
AS_IF([test "$mpiext_$1_WRAPPER_EXTRA_CPPFLAGS" != ""],
[OPAL_FLAGS_APPEND_UNIQ([ompi_mca_wrapper_extra_cppflags], [$mpiext_$1_WRAPPER_EXTRA_CPPFLAGS])])
])
######################################################################
#
# EXT_PROCESS_DEAD_COMPONENT
#
# process a component that can not be built. Do the last minute checks
# to make sure the user isn't doing something stupid.
#
# USAGE:
# EXT_PROCESS_DEAD_COMPONENT((1) component_name,
# (2) all_components_variable)
#
# NOTE: component_name will not be determined until run time.
#
######################################################################
AC_DEFUN([EXT_PROCESS_DEAD_COMPONENT],[
AC_MSG_CHECKING([if MPI Extension $1 can compile])
# Need to add this component to the "all" list so that it is
# included in DIST SUBDIRS
$2="$$2 $1"
AC_MSG_RESULT([no])
])
######################################################################
#
# EXT_COMPONENT_BUILD_CHECK
#
# checks the standard rules of component building to see if the
# given component should be built.
#
# USAGE:
# EXT_COMPONENT_BUILD_CHECK(component,
# action-if-build, action-if-not-build)
#
######################################################################
AC_DEFUN([EXT_COMPONENT_BUILD_CHECK],[
AC_REQUIRE([AC_PROG_GREP])
component=$1
component_path="$srcdir/ompi/mpiext/$component"
want_component=0
# build if:
# - the component type is direct and we are that component
# - there is no ompi_ignore file
# - there is an ompi_ignore, but there is an empty ompi_unignore
# - there is an ompi_ignore, but username is in ompi_unignore
if test -d $component_path ; then
# decide if we want the component to be built or not. This
# is spread out because some of the logic is a little complex
# and test's syntax isn't exactly the greatest. We want to
# build the component by default.
want_component=1
if test -f $component_path/.ompi_ignore ; then
# If there is an ompi_ignore file, don't build
# the component. Note that this decision can be
# overridden by the unignore logic below.
want_component=0
fi
if test -f $component_path/.ompi_unignore ; then
# if there is an empty ompi_unignore, that is
# equivalent to having your userid in the unignore file.
# If userid is in the file, unignore the ignore file.
if test ! -s $component_path/.ompi_unignore ; then
want_component=1
elif test ! -z "`$GREP $OPAL_CONFIGURE_USER $component_path/.ompi_unignore`" ; then
want_component=1
fi
fi
fi
# if we asked for everything, then allow it to build if able
str="ENABLED_COMPONENT_CHECK=\$ENABLE_EXT_ALL"
eval $str
if test ! "$ENABLED_COMPONENT_CHECK" = "1" ; then
# if we were explicitly disabled, don't build :)
str="ENABLED_COMPONENT_CHECK=\$ENABLE_${component}"
eval $str
if test ! "$ENABLED_COMPONENT_CHECK" = "1" ; then
want_component=0
fi
fi
AS_IF([test "$want_component" = "1"], [$2], [$3])
])
# OMPI_EXT_MAKE_DIR_LIST(subst'ed variable, shell list)
#
# Prefix every extension name with "mpiext/" and AC subst it.
# -------------------------------------------------------------------------
AC_DEFUN([OMPI_EXT_MAKE_DIR_LIST],[
$1=
for item in $2 ; do
$1="$$1 mpiext/$item"
done
AC_SUBST($1)
])
# OMPI_EXT_MAKE_LISTS((1) subst'ed variable prefix,
# (2) shell list,
# (3) bindings dir name,
# (4) bindings suffix)
#
# Prefix every extension name with "mpiext/".
# -------------------------------------------------------------------------
AC_DEFUN([OMPI_EXT_MAKE_LISTS],[
# Make the directory list
tmp=
for item in $2 ; do
tmp="$tmp mpiext/$item/$3"
done
$1_DIRS=$tmp
AC_SUBST($1_DIRS)
# Make the list of libraries
tmp=
for item in $2 ; do
tmp="$tmp "'$(top_builddir)'"/ompi/mpiext/$item/$3/libmpiext_${item}_$4.la"
done
$1_LIBS=$tmp
AC_SUBST($1_LIBS)
])