Skip to content

Commit b86e0f0

Browse files
committed
configury: fix PMI detection
and do not end up with -L/usr/lib[64] when PMI libraries are installed in the default location. Thanks Davide Vanzo for the report. Signed-off-by: Gilles Gouaillardet <[email protected]>
1 parent 40e0ae7 commit b86e0f0

File tree

1 file changed

+73
-74
lines changed

1 file changed

+73
-74
lines changed

config/opal_check_pmi.m4

Lines changed: 73 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-2017 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,30 @@ 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/include])
44+
AS_IF([test -f $1/include/$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/include"],
5247
[AC_MSG_RESULT([not found])
53-
opal_check_$3_hdr_happy=no])])
48+
AC_MSG_CHECKING([for $3.h in $1/include/slurm])
49+
AS_IF([test -f $1/include/slurm/$3.h],
50+
[AC_MSG_RESULT([found])
51+
opal_check_$3_mycppflags="-I$1/include/slurm"
52+
$5],
53+
[AC_MSG_RESULT([not found])
54+
opal_check_$3_hdr_happy=no])])],
55+
[AC_MSG_CHECKING([for $3.h in /usr/include])
56+
AS_IF([test -f /usr/include/$3.h],
57+
[AC_MSG_RESULT([found])],
58+
[AC_MSG_RESULT([not found])
59+
AC_MSG_CHECKING([for $3.h in /usr/include/slurm])
60+
AS_IF([test -f /usr/include/slurm/$3.h],
61+
[AC_MSG_RESULT([found])
62+
opal_check_$3_mycppflags="-I/usr/include/slurm"
63+
$5],
64+
[AC_MSG_RESULT([not found])
65+
opal_check_$3_hdr_happy=no])])])
5466
5567
AS_IF([test "$opal_check_$3_hdr_happy" != "no"],
5668
[CPPFLAGS="$CPPFLAGS $opal_check_$3_mycppflags"
@@ -65,51 +77,47 @@ AC_DEFUN([OPAL_CHECK_PMI_LIB],
6577
6678
# check for the library in the given location in case
6779
# 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],
80+
AS_IF([test -z "$1" && test -z "$2"],
81+
[AC_CHECK_LIB([$3], [$4],
82+
[opal_check_$3_lib_happy=yes],
7783
[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])])])
84+
[AS_IF([test -n "$2"],
85+
[AC_MSG_CHECKING([for lib$3 in $2])
86+
files=`ls $2/lib$3.* 2> /dev/null | wc -l`
87+
AS_IF([test "$files" -gt "0"],
88+
[AC_MSG_RESULT([found])
89+
LDFLAGS="$LDFLAGS -L$2"
90+
AC_CHECK_LIB([$3], [$4],
91+
[opal_check_$3_lib_happy=yes
92+
$3_LDFLAGS=-L$2
93+
$3_rpath=$2],
94+
[opal_check_$3_lib_happy=no])],
95+
[opal_check_$3_lib_happy=no
96+
AC_MSG_RESULT([not found])])],
97+
[AC_MSG_CHECKING([for lib$3 in $1/lib])
98+
files=`ls $1/lib/lib$3.* 2> /dev/null | wc -l`
99+
AS_IF([test "$files" -gt "0"],
100+
[AC_MSG_RESULT([found])
101+
LDFLAGS="$LDFLAGS -L$1/lib"
102+
AC_CHECK_LIB([$3], [$4],
103+
[opal_check_$3_lib_happy=yes
104+
$3_LDFLAGS=-L$1/lib
105+
$3_rpath=$1/lib],
106+
[opal_check_$3_lib_happy=no])],
107+
[# check for presence of lib64 directory - if found, see if the
108+
# desired library is present and matches our build requirements
109+
AC_MSG_CHECKING([for lib$3 in $1/lib64])
110+
files=`ls $1/lib64/lib$3.* 2> /dev/null | wc -l`
111+
AS_IF([test "$files" -gt "0"],
112+
[AC_MSG_RESULT([found])
113+
LDFLAGS="$LDFLAGS -L$1/lib64"
114+
AC_CHECK_LIB([$3], [$4],
115+
[opal_check_$3_lib_happy=yes
116+
$3_LDFLAGS=-L$1/lib64
117+
$3_rpath=$1/lib64],
118+
[opal_check_$3_lib_happy=no])],
119+
[opal_check_$3_lib_happy=no
120+
AC_MSG_RESULT([not found])])])])])
113121
114122
# restore flags
115123
CPPFLAGS=$opal_check_$3_save_CPPFLAGS
@@ -124,7 +132,7 @@ AC_DEFUN([OPAL_CHECK_PMI_LIB],
124132
# OPAL_CHECK_PMI()
125133
# --------------------------------------------------------
126134
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])
135+
OPAL_VAR_SCOPE_PUSH([check_pmi_install_dir check_pmi_lib_dir default_pmi_libloc slurm_pmi_found])
128136
129137
AC_ARG_WITH([pmi],
130138
[AC_HELP_STRING([--with-pmi(=DIR)],
@@ -137,7 +145,6 @@ AC_DEFUN([OPAL_CHECK_PMI],[
137145
138146
check_pmi_install_dir=
139147
check_pmi_lib_dir=
140-
default_pmi_loc=
141148
default_pmi_libloc=
142149
slurm_pmi_found=
143150
@@ -149,18 +156,10 @@ AC_DEFUN([OPAL_CHECK_PMI],[
149156
# cannot use OPAL_CHECK_PACKAGE as its backend header
150157
# support appends "include" to the path, which won't
151158
# 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])])
159+
AS_IF([test -n "$with_pmi" && test "$with_pmi" != "yes"],
160+
[check_pmi_install_dir=$with_pmi])
161+
AS_IF([test -n "$with_pmi_libdir"],
162+
[check_pmi_lib_dir=$with_pmi_libdir])
164163
165164
# check for pmi-1 lib */
166165
slurm_pmi_found=no
@@ -174,10 +173,10 @@ AC_DEFUN([OPAL_CHECK_PMI],[
174173
[opal_enable_pmi1=no])
175174
176175
AS_IF([test "$opal_enable_pmi1" = "yes"],
177-
[AS_IF([test "$default_pmi_loc" = "no" || test "$slurm_pmi_found" = "yes"],
176+
[AS_IF([test "$slurm_pmi_found" = "yes"],
178177
[opal_pmi1_CPPFLAGS="$pmi_CPPFLAGS"
179178
AC_SUBST(opal_pmi1_CPPFLAGS)])
180-
AS_IF([test "$default_pmi_libloc" = "no" || test "$slurm_pmi_found" = "yes"],
179+
AS_IF([test "$slurm_pmi_found" = "yes"],
181180
[opal_pmi1_LDFLAGS="$pmi_LDFLAGS"
182181
AC_SUBST(opal_pmi1_LDFLAGS)
183182
opal_pmi1_rpath="$pmi_rpath"
@@ -195,10 +194,10 @@ AC_DEFUN([OPAL_CHECK_PMI],[
195194
[opal_enable_pmi2=no])
196195
197196
AS_IF([test "$opal_enable_pmi2" = "yes"],
198-
[AS_IF([test "$default_pmi_loc" = "no" || test "$slurm_pmi_found" = "yes"],
197+
[AS_IF([test "$slurm_pmi_found" = "yes"],
199198
[opal_pmi2_CPPFLAGS="$pmi2_CPPFLAGS"
200199
AC_SUBST(opal_pmi2_CPPFLAGS)])
201-
AS_IF([test "$default_pmi_libloc" = "no" || test "$slurm_pmi_found" = "yes"],
200+
AS_IF([test "$slurm_pmi_found" = "yes"],
202201
[opal_pmi2_LDFLAGS="$pmi2_LDFLAGS"
203202
AC_SUBST(opal_pmi2_LDFLAGS)
204203
opal_pmi2_rpath="$pmi2_rpath"

0 commit comments

Comments
 (0)