Skip to content

Commit 3d8fbfa

Browse files
JulianKunkeladammoody
authored andcommitted
Fix for MPICH.
1 parent 1139488 commit 3d8fbfa

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

m4/lx_find_mpi.m4

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
#################################################################################################
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
44
# Written by Todd Gamblin, [email protected].
55
# LLNL-CODE-417602
6-
# All rights reserved.
7-
#
6+
# All rights reserved.
7+
#
88
# This file is part of Libra. For details, see http://github.com/tgamblin/libra.
99
# Please also read the LICENSE file for further information.
10-
#
10+
#
1111
# Redistribution and use in source and binary forms, with or without modification, are
1212
# permitted provided that the following conditions are met:
13-
#
13+
#
1414
# * Redistributions of source code must retain the above copyright notice, this list of
1515
# conditions and the disclaimer below.
1616
# * Redistributions in binary form must reproduce the above copyright notice, this list of
1717
# conditions and the disclaimer (as noted below) in the documentation and/or other materials
1818
# provided with the distribution.
1919
# * Neither the name of the LLNS/LLNL nor the names of its contributors may be used to endorse
2020
# or promote products derived from this software without specific prior written permission.
21-
#
21+
#
2222
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
2323
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2424
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -33,7 +33,7 @@
3333
#
3434
# LX_FIND_MPI()
3535
# ------------------------------------------------------------------------
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
3737
# it for use in automake projects. The script exports the following variables:
3838
#
3939
# AC_DEFINE variables:
@@ -51,18 +51,18 @@
5151
# MPIF77 Name of MPI Fortran 77 compiler
5252
# MPI_F77FLAGS Includes and defines for MPI Fortran 77 compilation
5353
# MPI_F77LDFLAGS Libraries and library paths for linking MPI Fortran 77 programs
54-
#
54+
#
5555
# MPIFC Name of MPI Fortran compiler
5656
# MPI_FFLAGS Includes and defines for MPI Fortran compilation
5757
# MPI_FLDFLAGS Libraries and library paths for linking MPI Fortran programs
58-
#
58+
#
5959
# Shell variables output by this macro:
6060
# have_C_mpi 'yes' if we found MPI for C, 'no' otherwise
6161
# have_CXX_mpi 'yes' if we found MPI for C++, 'no' otherwise
6262
# have_F77_mpi 'yes' if we found MPI for F77, 'no' otherwise
6363
# have_F_mpi 'yes' if we found MPI for Fortran, 'no' otherwise
6464
#
65-
AC_DEFUN([LX_FIND_MPI],
65+
AC_DEFUN([LX_FIND_MPI],
6666
[
6767
AC_LANG_CASE(
6868
[C], [
@@ -73,7 +73,7 @@ AC_DEFUN([LX_FIND_MPI],
7373
LX_QUERY_MPI_COMPILER(MPICC, [mpicc mpiicc mpixlc mpipgcc], C)
7474
fi
7575
],
76-
[C++], [
76+
[C++], [
7777
AC_REQUIRE([AC_PROG_CXX])
7878
if [[ ! -z "$MPICXX" ]]; then
7979
LX_QUERY_MPI_COMPILER(MPICXX, [$MPICXX], CXX)
@@ -110,17 +110,17 @@ AC_DEFUN([LX_FIND_MPI],
110110
# AC_SUBST variables:
111111
# MPI_<prefix>FLAGS Includes and defines for MPI compilation
112112
# MPI_<prefix>LDFLAGS Libraries and library paths for linking MPI C programs
113-
#
113+
#
114114
# Shell variables output by this macro:
115115
# found_mpi_flags 'yes' if we were able to get flags, 'no' otherwise
116116
#
117117
AC_DEFUN([LX_QUERY_MPI_COMPILER],
118118
[
119119
# Try to find a working MPI compiler from the supplied names
120120
AC_PATH_PROGS($1, [$2], [not-found])
121-
121+
122122
# 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
124124
# lx_mpi_command_line
125125
echo -n "Checking whether $$1 responds to '-showme:compile'... "
126126
lx_mpi_compile_line=`$$1 -showme:compile 2>/dev/null`
@@ -145,27 +145,34 @@ AC_DEFUN([LX_QUERY_MPI_COMPILER],
145145
if [[ "$?" -eq 0 ]]; then
146146
echo yes
147147
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
149156
fi
150157
fi
151158
else
152159
echo yes
153160
fi
154161
fi
155-
162+
156163
if [[ ! -z "$lx_mpi_compile_line" -a ! -z "$lx_mpi_link_line" ]]; then
157164
lx_mpi_command_line="$lx_mpi_compile_line $lx_mpi_link_line"
158165
fi
159166
160167
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
162169
# parse them all out in future versions of this macro.
163170
lx_mpi_defines=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-D\([[^\"[:space:]]]\+\|\"[[^\"[:space:]]]\+\"\)'`
164171
lx_mpi_includes=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-I\([[^\"[:space:]]]\+\|\"[[^\"[:space:]]]\+\"\)'`
165172
lx_mpi_link_paths=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-L\([[^\"[:space:]]]\+\|\"[[^\"[:space:]]]\+\"\)'`
166173
lx_mpi_libs=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-l\([[^\"[:space:]]]\+\|\"[[^\"[:space:]]]\+\"\)'`
167174
lx_mpi_link_args=` echo "$lx_mpi_command_line" | grep -o -- '\(^\| \)-Wl,\([[^\"[:space:]]]\+\|\"[[^\"[:space:]]]\+\"\)'`
168-
175+
169176
# Create variables and clean up newlines and multiple spaces
170177
MPI_$3FLAGS="$lx_mpi_defines $lx_mpi_includes"
171178
MPI_$3LDFLAGS="$lx_mpi_link_paths $lx_mpi_libs $lx_mpi_link_args"
@@ -198,7 +205,6 @@ AC_DEFUN([LX_QUERY_MPI_COMPILER],
198205
CPPFLAGS=$OLD_CPPFLAGS
199206
else
200207
echo Unable to find suitable MPI Compiler. Try setting $1.
201-
have_$3_mpi='no'
208+
have_$3_mpi='no'
202209
fi
203210
])
204-

0 commit comments

Comments
 (0)