-
Notifications
You must be signed in to change notification settings - Fork 35
/
configure.ac
260 lines (229 loc) · 6.89 KB
/
configure.ac
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
dnl Copyright (C) 2007 The Trustees of Indiana University
dnl
dnl Use, modification and distribution is subject to the Boost Software
dnl License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
dnl http://www.boost.org/LICENSE_1_0.txt)
dnl
dnl Authors: Douglas Gregor
dnl Andrew Lumsdaine
AC_INIT(MPI.NET, 0.6.0)
AC_CONFIG_AUX_DIR(./Config)
AM_INIT_AUTOMAKE(foreign)
AC_PROG_INSTALL
dnl Libtool with shared libraries (only)
AC_LANG([C])
AC_ENABLE_SHARED
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
dnl C# compiler
AC_PATH_PROG(CSC, csc, no)
AC_PATH_PROG(MCS, gmcs, no)
AC_PATH_PROG(MONO, mono, no)
dnl CIL assembler
AC_PATH_PROG(ILASM, ilasm, no)
dnl Other tools we need
AC_PATH_PROG(SED, sed, no)
AC_PATH_PROG(PERL, perl, no)
dnl Flags for the C# compiler
CSHARP_FLAGS="-optimize+"
CSHARP_DEFINES=""
CS="C#"
if test "x$CSC" = "xno" -a "x$MCS" = "xno" ; then
AC_MSG_ERROR([No $CS compiler found])
fi
if test "x$MCS" = "xno" ; then
MCS=$CSC
else
CSHARP_DEFINES="$CSHARP_DEFINES -define:BROKEN_IL_EMIT -define:BROKEN_NULL_DELEGATE"
fi
if test "x$ILASM" = "xno" ; then
AC_MSG_ERROR([No CIL assembler found])
fi
if test "x$MONO" = "xno"; then
AC_MSG_ERROR([No mono runtime found])
fi
dnl Detect MPI
ACX_MPI([], [AC_MSG_ERROR([No MPI implementation found])])
AC_PATH_PROG(MPIEXEC, mpiexec, no)
dnl Whether we need the C bridge to make the MPI.NET assembly work
need_cbridge="yes"
dnl Determine which MPI this is (if we can). This block of checks will
dnl set three variables:
dnl MPI_KIND string describing which kind of MPI this is, e.g.,
dnl mpich2, openmpi, lam
dnl MPI_COMPILEINFO string passed to the wrapper compiler that requests
dnl the commands to pass on to the compiler
dnl MPI_LINKINFO string passed to the wrapper compiler that requests
dnl the commands to pass on to the linker
real_CC="$CC"
CC="$MPICC"
AC_MSG_CHECKING([which MPI is available])
dnl Check for MPICH2-based MPIs
AC_TRY_COMPILE([#include <mpi.h>
#ifndef MPICH2
# error Not MPICH2
#endif
],[],
[AC_MSG_RESULT([MPICH2-based])
MPI_KIND="mpich2"
MPI_COMPILEINFO="-show"
MPI_LINKINFO="-show"
MPI_SHARED_LIB_NAME="mpich"
MPI_FUNC_PREFIX="PMPI"
],[])
dnl Check for Open MPI
if test "x$MPI_KIND" = "x" ; then
AC_TRY_COMPILE([#include <mpi.h>
#ifndef OPEN_MPI
# error Not OpenMPI
#endif
],[],
[AC_MSG_RESULT([Open MPI])
MPI_KIND="openmpi"
MPI_COMPILEINFO="--showme:compile"
MPI_LINKINFO="--showme:link"
MPI_SHARED_LIB_NAME="mpi"
MPI_FUNC_PREFIX="MPI"
],[])
fi
dnl Check for LAM/MPI
if test "x$MPI_KIND" = "x" ; then
AC_TRY_COMPILE([#include <mpi.h>
#ifndef LAM_MPI
# error Not LAM/MPI
#endif
],[],
[AC_MSG_RESULT([LAM/MPI])
MPI_KIND="lam"
MPI_COMPILEINFO="--showme"
MPI_LINKINFO="--showme"
MPI_SHARED_LIB_NAME="mpi"
MPI_FUNC_PREFIX="MPI"
],[])
fi
CC="$real_CC"
if test "x$MPI_SHARED_LIB_NAME" == "x" ; then
MPI_SHARED_LIB_NAME="mpi"
MPI_FUNC_PREFIX="MPI"
fi
dnl Extract the set of include directories added by the wrapper compiler
if test "x$MPI_COMPILEINFO" != "x" ; then
if test "$MPI_KIND" = "openmpi" ; then
dnl Open MPI makes this extremely easy with --showme:incdirs
MPI_INCLUDEDIRS=`$MPICC --showme:incdirs`
else
dnl For all other MPIs, we have to parse -I lines.
MPI_INCLUDEDIRS=`$MPICC $MPI_COMPILEINFO|$SED -n -e "s/ -[[^I]][[^ ]]*//pg"|$SED -n -e "s/-I\([[^ ]]*\)/\1/pg"`
fi
fi
dnl Find the actual file <mpi.h>, because we need to parse it to
dnl determine values of the various MPI constants.
if test "x$MPI_INCLUDEDIRS" != "x" ; then
AC_MSG_CHECKING([for location of mpi.h])
for dir in $MPI_INCLUDEDIRS ; do
if test -f "$dir/mpi.h" ; then
MPI_HEADER="$dir/mpi.h"
fi
done
if test "x$MPI_HEADER" == "x" ; then
AC_MSG_ERROR([not found!])
else
AC_MSG_RESULT($MPI_HEADER)
fi
fi
if test "$MPI_KIND" = "mpich2" ; then
dnl If it's MPICH2-based, make sure that MPICH2 was built as a shared
dnl library (which is not the default). The order of these
dnl checks is *very* important, because we rely on the
dnl fact that libpmpich depends on libmpich, and that information is
dnl only available in the shared library version. So a static pmpich
dnl library check will fail while the static mpich check passes; both
dnl will pass when a shared MPICH is installed.
dnl We do not need the C bridge at all; everything can be done from C#
need_cbridge="no"
real_CC="$CC"
CC="$MPICC"
AC_CHECK_LIB(pmpich,MPI_Init,[HAVE_LIBPMPICH=yes],[HAVE_LIBPMPICH=no],)
AC_CHECK_LIB(mpich,PMPI_Init,[HAVE_LIBMPICH=yes],[HAVE_LIBMPICH=no],)
if test "$HAVE_LIBPMPICH" = "no" ; then
if test "$HAVE_LIBMPICH" = "yes" ; then
AC_MSG_ERROR([ MPICH library is built statically.
Please install MPICH built as a shared library by configuring MPICH with
the --enable-sharedlibs=??? option)])
fi
fi
CC="$real_CC"
elif test "$MPI_KIND" = "openmpi" ; then
dnl With Open MPI, we need to explicitly determine which libraries
dnl the MPI.NET C bridge will need to link against, because libtool
dnl has the *extremely annoying* behavior that it completely ignores
dnl the compiler wrapper when it is linking.
ompi_libdirs=`$MPICC --showme:libdirs`
ompi_libs=`$MPICC --showme:libs`
for dir in $ompi_libdirs ; do
MPILIBS="$MPILIBS -L$dir"
done
for lib in $ompi_libs ; do
MPILIBS="$MPILIBS -l$lib"
done
fi
dnl If we need a C bridge, it's because MPI handles are actually
dnl pointers
if test "$need_cbridge" = "yes" ; then
CSHARP_DEFINES="$CSHARP_DEFINES -define:MPI_HANDLES_ARE_POINTERS"
fi
dnl Conditionals
AM_CONDITIONAL(MPINET_CBRIDGE, test "$need_cbridge" = "yes")
dnl Get size of int and size_t for Unsafe.pl
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([size_t])
dnl Variable substitutions
AC_SUBST(MCS)
AC_SUBST(ILASM)
AC_SUBST(MONO)
AC_SUBST(MPIEXEC)
AC_SUBST(PERL)
AC_SUBST(CSHARP_FLAGS)
AC_SUBST(CSHARP_DEFINES)
AC_SUBST(MPI_HEADER)
AC_SUBST(MPI_SHARED_LIB_NAME)
AC_SUBST(MPI_FUNC_PREFIX)
AC_CONFIG_FILES([MPI/MPI.dll.config Tests/runtest.sh],[],[])
AC_OUTPUT([
Makefile
MPIUtils/Makefile
MPI/Makefile
TestCommons/Makefile
Examples/Makefile
Examples/Hello/Makefile
Examples/Hostnames/Makefile
Examples/Pi/Makefile
Examples/PingPong/Makefile
Examples/Ring/Makefile
Benchmarks/Makefile
Benchmarks/Netpipe_cs/Makefile
Benchmarks/Netcoll_cs/Makefile
Tests/Makefile
Tests/AllgatherTest/Makefile
Tests/AllreduceTest/Makefile
Tests/AlltoallTest/Makefile
Tests/AttributesTest/Makefile
Tests/BroadcastTest/Makefile
Tests/CartTest/Makefile
Tests/DatatypesTest/Makefile
Tests/ExceptionTest/Makefile
Tests/ExclusiveScanTest/Makefile
Tests/GatherTest/Makefile
Tests/GraphTest/Makefile
Tests/IntercommunicatorTest/Makefile
Tests/NonblockingTest/Makefile
Tests/ReduceScatterTest/Makefile
Tests/ReduceTest/Makefile
Tests/ScanTest/Makefile
Tests/ScatterTest/Makefile
Tests/SendReceiveTest/Makefile
Tests/UnitTestOutcomeTest/Makefile
])
# TODO Tests/SpawnTest/Makefile