Skip to content

Commit cbf471a

Browse files
authored
Merge pull request #4861 from ggouaillardet/topic/v3.0.x/pmix_configury
configury: fix PMI detection
2 parents ae68db1 + 8eeb08b commit cbf471a

File tree

1 file changed

+78
-74
lines changed

1 file changed

+78
-74
lines changed

config/opal_check_pmi.m4

Lines changed: 78 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
# Copyright (c) 2011-2014 Los Alamos National Security, LLC. All rights
1515
# reserved.
1616
# Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
17-
# Copyright (c) 2014-2017 Research Organization for Information Science
18-
# and Technology (RIST). All rights reserved.
17+
# Copyright (c) 2014-2018 Research Organization for Information Science
18+
# and Technology (RIST). All rights reserved.
1919
# Copyright (c) 2016 IBM Corporation. All rights reserved.
2020
# $COPYRIGHT$
2121
#
@@ -39,18 +39,35 @@ AC_DEFUN([OPAL_CHECK_PMI_LIB],
3939
opal_check_$3_mycppflags=
4040
4141
# check for the header
42-
AC_MSG_CHECKING([for $3.h in $1/include])
43-
AS_IF([test -f $1/include/$3.h],
44-
[AC_MSG_RESULT([found])
45-
opal_check_$3_mycppflags="-I$1/include"],
46-
[AC_MSG_RESULT([not found])
47-
AC_MSG_CHECKING([for $3.h in $1/include/slurm])
48-
AS_IF([test -f $1/include/slurm/$3.h],
42+
AS_IF([test -n "$1"],
43+
[AC_MSG_CHECKING([for $3.h in $1])
44+
AS_IF([test -f $1/$3.h && test -r $1/$3.h],
4945
[AC_MSG_RESULT([found])
50-
opal_check_$3_mycppflags="-I$1/include/slurm"
51-
$5],
46+
opal_check_$3_mycppflags="-I$1"],
5247
[AC_MSG_RESULT([not found])
53-
opal_check_$3_hdr_happy=no])])
48+
AC_MSG_CHECKING([for $3.h in $1/include])
49+
AS_IF([test -f $1/include/$3.h && test -r $1/include/$3.h],
50+
[AC_MSG_RESULT([found])
51+
opal_check_$3_mycppflags="-I$1/include"],
52+
[AC_MSG_RESULT([not found])
53+
AC_MSG_CHECKING([for $3.h in $1/include/slurm])
54+
AS_IF([test -f $1/include/slurm/$3.h && test -r $1/include/slurm/$3.h],
55+
[AC_MSG_RESULT([found])
56+
opal_check_$3_mycppflags="-I$1/include/slurm"
57+
$5],
58+
[AC_MSG_RESULT([not found])
59+
opal_check_$3_hdr_happy=no])])])],
60+
[AC_MSG_CHECKING([for $3.h in /usr/include])
61+
AS_IF([test -f /usr/include/$3.h && test -r /usr/include/$3.h],
62+
[AC_MSG_RESULT([found])],
63+
[AC_MSG_RESULT([not found])
64+
AC_MSG_CHECKING([for $3.h in /usr/include/slurm])
65+
AS_IF([test -f /usr/include/slurm/$3.h && test -r /usr/include/slurm/$3.h],
66+
[AC_MSG_RESULT([found])
67+
opal_check_$3_mycppflags="-I/usr/include/slurm"
68+
$5],
69+
[AC_MSG_RESULT([not found])
70+
opal_check_$3_hdr_happy=no])])])
5471
5572
AS_IF([test "$opal_check_$3_hdr_happy" != "no"],
5673
[CPPFLAGS="$CPPFLAGS $opal_check_$3_mycppflags"
@@ -65,51 +82,47 @@ AC_DEFUN([OPAL_CHECK_PMI_LIB],
6582
6683
# check for the library in the given location in case
6784
# an exact path was given
68-
AC_MSG_CHECKING([for lib$3 in $2])
69-
files=`ls $2/lib$3.* 2> /dev/null | wc -l`
70-
AS_IF([test "$files" -gt "0"],
71-
[AC_MSG_RESULT([found])
72-
LDFLAGS="$LDFLAGS -L$2"
73-
AC_CHECK_LIB([$3], [$4],
74-
[opal_check_$3_lib_happy=yes
75-
$3_LDFLAGS=-L$2
76-
$3_rpath=$2],
85+
AS_IF([test -z "$1" && test -z "$2"],
86+
[AC_CHECK_LIB([$3], [$4],
87+
[opal_check_$3_lib_happy=yes],
7788
[opal_check_$3_lib_happy=no])],
78-
[opal_check_$3_lib_happy=no
79-
AC_MSG_RESULT([not found])])
80-
81-
# check for presence of lib64 directory - if found, see if the
82-
# desired library is present and matches our build requirements
83-
files=`ls $2/lib64/lib$3.* 2> /dev/null | wc -l`
84-
AS_IF([test "$opal_check_$3_lib_happy" != "yes"],
85-
[AC_MSG_CHECKING([for lib$3 in $2/lib64])
86-
AS_IF([test "$files" -gt "0"],
87-
[AC_MSG_RESULT([found])
88-
LDFLAGS="$LDFLAGS -L$2/lib64"
89-
AC_CHECK_LIB([$3], [$4],
90-
[opal_check_$3_lib_happy=yes
91-
$3_LDFLAGS=-L$2/lib64
92-
$3_rpath=$2/lib64],
93-
[opal_check_$3_lib_happy=no])],
94-
[opal_check_$3_lib_happy=no
95-
AC_MSG_RESULT([not found])])])
96-
97-
98-
# if we didn't find lib64, or the library wasn't present or correct,
99-
# then try a lib directory if present
100-
files=`ls $2/lib/lib$3.* 2> /dev/null | wc -l`
101-
AS_IF([test "$opal_check_$3_lib_happy" != "yes"],
102-
[AC_MSG_CHECKING([for lib$3 in $2/lib])
103-
AS_IF([test "$files" -gt "0"],
104-
[AC_MSG_RESULT([found])
105-
LDFLAGS="$LDFLAGS -L$2/lib"
106-
AC_CHECK_LIB([$3], [$4],
107-
[opal_check_$3_lib_happy=yes
108-
$3_LDFLAGS=-L$2/lib
109-
$3_rpath=$2/lib],
110-
[opal_check_$3_lib_happy=no])],
111-
[opal_check_$3_lib_happy=no
112-
AC_MSG_RESULT([not found])])])
89+
[AS_IF([test -n "$2"],
90+
[AC_MSG_CHECKING([for lib$3 in $2])
91+
files=`ls $2/lib$3.* 2> /dev/null | wc -l`
92+
AS_IF([test "$files" -gt "0"],
93+
[AC_MSG_RESULT([found])
94+
LDFLAGS="$LDFLAGS -L$2"
95+
AC_CHECK_LIB([$3], [$4],
96+
[opal_check_$3_lib_happy=yes
97+
$3_LDFLAGS=-L$2
98+
$3_rpath=$2],
99+
[opal_check_$3_lib_happy=no])],
100+
[opal_check_$3_lib_happy=no
101+
AC_MSG_RESULT([not found])])],
102+
[AC_MSG_CHECKING([for lib$3 in $1/lib])
103+
files=`ls $1/lib/lib$3.* 2> /dev/null | wc -l`
104+
AS_IF([test "$files" -gt "0"],
105+
[AC_MSG_RESULT([found])
106+
LDFLAGS="$LDFLAGS -L$1/lib"
107+
AC_CHECK_LIB([$3], [$4],
108+
[opal_check_$3_lib_happy=yes
109+
$3_LDFLAGS=-L$1/lib
110+
$3_rpath=$1/lib],
111+
[opal_check_$3_lib_happy=no])],
112+
[# check for presence of lib64 directory - if found, see if the
113+
# desired library is present and matches our build requirements
114+
AC_MSG_CHECKING([for lib$3 in $1/lib64])
115+
files=`ls $1/lib64/lib$3.* 2> /dev/null | wc -l`
116+
AS_IF([test "$files" -gt "0"],
117+
[AC_MSG_RESULT([found])
118+
LDFLAGS="$LDFLAGS -L$1/lib64"
119+
AC_CHECK_LIB([$3], [$4],
120+
[opal_check_$3_lib_happy=yes
121+
$3_LDFLAGS=-L$1/lib64
122+
$3_rpath=$1/lib64],
123+
[opal_check_$3_lib_happy=no])],
124+
[opal_check_$3_lib_happy=no
125+
AC_MSG_RESULT([not found])])])])])
113126
114127
# restore flags
115128
CPPFLAGS=$opal_check_$3_save_CPPFLAGS
@@ -124,7 +137,7 @@ AC_DEFUN([OPAL_CHECK_PMI_LIB],
124137
# OPAL_CHECK_PMI()
125138
# --------------------------------------------------------
126139
AC_DEFUN([OPAL_CHECK_PMI],[
127-
OPAL_VAR_SCOPE_PUSH([check_pmi_install_dir check_pmi_lib_dir default_pmi_loc default_pmi_libloc slurm_pmi_found])
140+
OPAL_VAR_SCOPE_PUSH([check_pmi_install_dir check_pmi_lib_dir default_pmi_libloc slurm_pmi_found])
128141
129142
AC_ARG_WITH([pmi],
130143
[AC_HELP_STRING([--with-pmi(=DIR)],
@@ -137,7 +150,6 @@ AC_DEFUN([OPAL_CHECK_PMI],[
137150
138151
check_pmi_install_dir=
139152
check_pmi_lib_dir=
140-
default_pmi_loc=
141153
default_pmi_libloc=
142154
slurm_pmi_found=
143155
@@ -149,18 +161,10 @@ AC_DEFUN([OPAL_CHECK_PMI],[
149161
# cannot use OPAL_CHECK_PACKAGE as its backend header
150162
# support appends "include" to the path, which won't
151163
# work with slurm :-(
152-
AS_IF([test ! -z "$with_pmi" && test "$with_pmi" != "yes"],
153-
[check_pmi_install_dir=$with_pmi
154-
default_pmi_loc=no],
155-
[check_pmi_install_dir=/usr
156-
default_pmi_loc=yes])
157-
AS_IF([test ! -z "$with_pmi_libdir"],
158-
[check_pmi_lib_dir=$with_pmi_libdir
159-
default_pmi_libloc=no],
160-
[check_pmi_lib_dir=$check_pmi_install_dir
161-
AS_IF([test "$default_pmi_loc" = "no"],
162-
[default_pmi_libloc=no],
163-
[default_pmi_libloc=yes])])
164+
AS_IF([test -n "$with_pmi" && test "$with_pmi" != "yes"],
165+
[check_pmi_install_dir=$with_pmi])
166+
AS_IF([test -n "$with_pmi_libdir"],
167+
[check_pmi_lib_dir=$with_pmi_libdir])
164168
165169
# check for pmi-1 lib */
166170
slurm_pmi_found=no
@@ -174,10 +178,10 @@ AC_DEFUN([OPAL_CHECK_PMI],[
174178
[opal_enable_pmi1=no])
175179
176180
AS_IF([test "$opal_enable_pmi1" = "yes"],
177-
[AS_IF([test "$default_pmi_loc" = "no" || test "$slurm_pmi_found" = "yes"],
181+
[AS_IF([test "$slurm_pmi_found" = "yes"],
178182
[opal_pmi1_CPPFLAGS="$pmi_CPPFLAGS"
179183
AC_SUBST(opal_pmi1_CPPFLAGS)])
180-
AS_IF([test "$default_pmi_libloc" = "no" || test "$slurm_pmi_found" = "yes"],
184+
AS_IF([test "$slurm_pmi_found" = "yes"],
181185
[opal_pmi1_LDFLAGS="$pmi_LDFLAGS"
182186
AC_SUBST(opal_pmi1_LDFLAGS)
183187
opal_pmi1_rpath="$pmi_rpath"
@@ -195,10 +199,10 @@ AC_DEFUN([OPAL_CHECK_PMI],[
195199
[opal_enable_pmi2=no])
196200
197201
AS_IF([test "$opal_enable_pmi2" = "yes"],
198-
[AS_IF([test "$default_pmi_loc" = "no" || test "$slurm_pmi_found" = "yes"],
202+
[AS_IF([test "$slurm_pmi_found" = "yes"],
199203
[opal_pmi2_CPPFLAGS="$pmi2_CPPFLAGS"
200204
AC_SUBST(opal_pmi2_CPPFLAGS)])
201-
AS_IF([test "$default_pmi_libloc" = "no" || test "$slurm_pmi_found" = "yes"],
205+
AS_IF([test "$slurm_pmi_found" = "yes"],
202206
[opal_pmi2_LDFLAGS="$pmi2_LDFLAGS"
203207
AC_SUBST(opal_pmi2_LDFLAGS)
204208
opal_pmi2_rpath="$pmi2_rpath"

0 commit comments

Comments
 (0)