1
1
# ################################################################################################
2
- # Copyright (c) 2010, Lawrence Livermore National Security, LLC.
3
- # Produced at the Lawrence Livermore National Laboratory
2
+ # Copyright (c) 2010, Lawrence Livermore National Security, LLC.
3
+ # Produced at the Lawrence Livermore National Laboratory
4
4
# Written by Todd Gamblin, [email protected] .
5
5
# LLNL-CODE-417602
6
- # All rights reserved.
7
- #
6
+ # All rights reserved.
7
+ #
8
8
# This file is part of Libra. For details, see http://github.com/tgamblin/libra.
9
9
# Please also read the LICENSE file for further information.
10
- #
10
+ #
11
11
# Redistribution and use in source and binary forms, with or without modification, are
12
12
# permitted provided that the following conditions are met:
13
- #
13
+ #
14
14
# * Redistributions of source code must retain the above copyright notice, this list of
15
15
# conditions and the disclaimer below.
16
16
# * Redistributions in binary form must reproduce the above copyright notice, this list of
17
17
# conditions and the disclaimer (as noted below) in the documentation and/or other materials
18
18
# provided with the distribution.
19
19
# * Neither the name of the LLNS/LLNL nor the names of its contributors may be used to endorse
20
20
# or promote products derived from this software without specific prior written permission.
21
- #
21
+ #
22
22
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
23
23
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24
24
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
33
33
#
34
34
# LX_FIND_MPI()
35
35
# ------------------------------------------------------------------------
36
- # This macro finds an MPI compiler and extracts includes and libraries from
36
+ # This macro finds an MPI compiler and extracts includes and libraries from
37
37
# it for use in automake projects. The script exports the following variables:
38
38
#
39
39
# AC_DEFINE variables:
51
51
# MPIF77 Name of MPI Fortran 77 compiler
52
52
# MPI_F77FLAGS Includes and defines for MPI Fortran 77 compilation
53
53
# MPI_F77LDFLAGS Libraries and library paths for linking MPI Fortran 77 programs
54
- #
54
+ #
55
55
# MPIFC Name of MPI Fortran compiler
56
56
# MPI_FFLAGS Includes and defines for MPI Fortran compilation
57
57
# MPI_FLDFLAGS Libraries and library paths for linking MPI Fortran programs
58
- #
58
+ #
59
59
# Shell variables output by this macro:
60
60
# have_C_mpi 'yes' if we found MPI for C, 'no' otherwise
61
61
# have_CXX_mpi 'yes' if we found MPI for C++, 'no' otherwise
62
62
# have_F77_mpi 'yes' if we found MPI for F77, 'no' otherwise
63
63
# have_F_mpi 'yes' if we found MPI for Fortran, 'no' otherwise
64
64
#
65
- AC_DEFUN ( [ LX_FIND_MPI] ,
65
+ AC_DEFUN ( [ LX_FIND_MPI] ,
66
66
[
67
67
AC_LANG_CASE(
68
68
[ C] , [
@@ -73,7 +73,7 @@ AC_DEFUN([LX_FIND_MPI],
73
73
LX_QUERY_MPI_COMPILER(MPICC, [ mpicc mpiicc mpixlc mpipgcc] , C)
74
74
fi
75
75
] ,
76
- [ C++] , [
76
+ [ C++] , [
77
77
AC_REQUIRE ( [ AC_PROG_CXX ] )
78
78
if [ [ ! -z "$MPICXX" ] ] ; then
79
79
LX_QUERY_MPI_COMPILER(MPICXX, [ $MPICXX] , CXX)
@@ -110,17 +110,17 @@ AC_DEFUN([LX_FIND_MPI],
110
110
# AC_SUBST variables:
111
111
# MPI_<prefix>FLAGS Includes and defines for MPI compilation
112
112
# MPI_<prefix>LDFLAGS Libraries and library paths for linking MPI C programs
113
- #
113
+ #
114
114
# Shell variables output by this macro:
115
115
# found_mpi_flags 'yes' if we were able to get flags, 'no' otherwise
116
116
#
117
117
AC_DEFUN ( [ LX_QUERY_MPI_COMPILER] ,
118
118
[
119
119
# Try to find a working MPI compiler from the supplied names
120
120
AC_PATH_PROGS ( $1 , [ $2 ] , [ not-found] )
121
-
121
+
122
122
# Figure out what the compiler responds to to get it to show us the compile
123
- # and link lines. After this part of the macro, we'll have a valid
123
+ # and link lines. After this part of the macro, we'll have a valid
124
124
# lx_mpi_command_line
125
125
echo -n "Checking whether $$1 responds to '-showme:compile'... "
126
126
lx_mpi_compile_line=`$$1 -showme:compile 2>/dev/null`
@@ -145,27 +145,34 @@ AC_DEFUN([LX_QUERY_MPI_COMPILER],
145
145
if [ [ "$?" -eq 0 ] ] ; then
146
146
echo yes
147
147
else
148
- echo no
148
+ echo no
149
+ echo -n "Checking whether $$1 responds to '-compile_info'... "
150
+ lx_mpi_command_line=`$$1 -compile_info 2>/dev/null`
151
+ if [ [ "$?" -eq 0 ] ] ; then
152
+ echo yes
153
+ else
154
+ echo no
155
+ fi
149
156
fi
150
157
fi
151
158
else
152
159
echo yes
153
160
fi
154
161
fi
155
-
162
+
156
163
if [ [ ! -z "$lx_mpi_compile_line" -a ! -z "$lx_mpi_link_line" ] ] ; then
157
164
lx_mpi_command_line="$lx_mpi_compile_line $lx_mpi_link_line"
158
165
fi
159
166
160
167
if [ [ ! -z "$lx_mpi_command_line" ] ] ; then
161
- # Now extract the different parts of the MPI command line. Do these separately in case we need to
168
+ # Now extract the different parts of the MPI command line. Do these separately in case we need to
162
169
# parse them all out in future versions of this macro.
163
170
lx_mpi_defines=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-D\([ [ ^\"[ :space:] ] ] \+\|\"[ [ ^\"[ :space:] ] ] \+\"\)'`
164
171
lx_mpi_includes=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-I\([ [ ^\"[ :space:] ] ] \+\|\"[ [ ^\"[ :space:] ] ] \+\"\)'`
165
172
lx_mpi_link_paths=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-L\([ [ ^\"[ :space:] ] ] \+\|\"[ [ ^\"[ :space:] ] ] \+\"\)'`
166
173
lx_mpi_libs=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-l\([ [ ^\"[ :space:] ] ] \+\|\"[ [ ^\"[ :space:] ] ] \+\"\)'`
167
174
lx_mpi_link_args=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-Wl,\([ [ ^\"[ :space:] ] ] \+\|\"[ [ ^\"[ :space:] ] ] \+\"\)'`
168
-
175
+
169
176
# Create variables and clean up newlines and multiple spaces
170
177
MPI_$3 FLAGS="$lx_mpi_defines $lx_mpi_includes"
171
178
MPI_$3 LDFLAGS="$lx_mpi_link_paths $lx_mpi_libs $lx_mpi_link_args"
@@ -198,7 +205,6 @@ AC_DEFUN([LX_QUERY_MPI_COMPILER],
198
205
CPPFLAGS=$OLD_CPPFLAGS
199
206
else
200
207
echo Unable to find suitable MPI Compiler. Try setting $1 .
201
- have_$3 _mpi='no'
208
+ have_$3 _mpi='no'
202
209
fi
203
210
] )
204
-
0 commit comments