/
x_ac_pmix.m4
executable file
·196 lines (179 loc) · 7.54 KB
/
x_ac_pmix.m4
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
##*****************************************************************************
# AUTHOR:
# Artem Polyakov <artpol84@gmail.com>
# Ralph Castain <ralph.h.castain@intel.com>
#
# SYNOPSIS:
# X_AC_PMIX
#
# DESCRIPTION:
# Determine if the PMIx libraries exists. Derived from "x_ac_hwloc.m4".
##*****************************************************************************
AC_DEFUN([X_AC_PMIX],
[
_x_ac_pmix_dirs="/usr /usr/local"
_x_ac_pmix_libs="lib64 lib"
_x_ac_pmix_v1_found="0"
_x_ac_pmix_v2_found="0"
_x_ac_pmix_v3_found="0"
_x_ac_pmix_v4_found="0"
AC_ARG_WITH(
[pmix],
AS_HELP_STRING(--with-pmix=PATH,Specify path to pmix installation(s). Multiple version directories can be ':' delimited.),
[AS_IF([test "x$with_pmix" != xno && test "x$with_pmix" != xyes],
[_x_ac_pmix_dirs="`echo $with_pmix | sed "s/:/ /g"`"])])
if [test "x$with_pmix" = xno]; then
AC_MSG_WARN([support for pmix disabled])
else
AC_CACHE_CHECK(
[for pmix installation],
[x_ac_cv_pmix_dir],
[
for d in $_x_ac_pmix_dirs; do
if [ ! test -d "$d/include" ] || [ ! test -f "$d/include/pmix_server.h" ] ||
[ ! test -f "$d/include/pmix/pmix_common.h" && ! test -f $d/include/pmix_common.h ]; then
if [ test -n "$with_pmix" && test "$with_pmix" != yes ]; then
AC_MSG_ERROR([No PMIX installation found in $d])
fi
continue
fi
for d1 in $_x_ac_pmix_libs; do
test -d "$d/$d1" || continue
_x_ac_pmix_cppflags_save="$CPPFLAGS"
CPPFLAGS="-I$d/include $CPPFLAGS"
_x_ac_pmix_libs_save="$LIBS"
LIBS="-L$d/$d1 -lpmix $LIBS"
AC_LINK_IFELSE(
[AC_LANG_CALL([], PMIx_Get_version)],
AS_VAR_SET(x_ac_cv_pmix_dir, $d)
AS_VAR_SET(x_ac_cv_pmix_libdir, $d/$d1))
if [test -z "$x_ac_cv_pmix_dir"] ||
[test -z "$x_ac_cv_pmix_libdir"]; then
AC_MSG_WARN([unable to locate pmix installation])
continue
fi
_x_ac_pmix_version="0"
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
#include <pmix_version.h>
#if (PMIX_VERSION_MAJOR != 4L)
#error "not version 4"
#endif
], [ ] )],
[ _x_ac_pmix_version="4" ],
[ AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
#include <pmix_version.h>
#if (PMIX_VERSION_MAJOR != 3L)
#error "not version 3"
#endif
], [ ] )],
[ _x_ac_pmix_version="3" ],
[ AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
#include<pmix_server.h>
#if (PMIX_VERSION_MAJOR != 2L)
#error "not version 2"
#endif
], [ ] )],
[ _x_ac_pmix_version="2" ],
[ _x_ac_pmix_version="1" ] )
])
])
CPPFLAGS="$_x_ac_pmix_cppflags_save"
LIBS="$_x_ac_pmix_libs_save"
m4_define([err_pmix],[was already found in one of the previous paths])
if [test "$_x_ac_pmix_version" = "1"]; then
if [test "$_x_ac_pmix_v1_found" = "1" ]; then
m4_define([err_pmix_v1],[error processing $x_ac_cv_pmix_libdir: PMIx v1.x])
AC_MSG_ERROR(err_pmix_v1 err_pmix)
fi
_x_ac_pmix_v1_found="1"
PMIX_V1_CPPFLAGS="-I$x_ac_cv_pmix_dir/include"
if test "$ac_with_rpath" = "yes"; then
PMIX_V1_LDFLAGS="-Wl,-rpath -Wl,$x_ac_cv_pmix_libdir -L$x_ac_cv_pmix_libdir"
else
PMIX_V1_CPPFLAGS=$PMIX_V1_CPPFLAGS" -DPMIXP_V1_LIBPATH=\\\"$x_ac_cv_pmix_libdir\\\""
fi
# We don't want to search the other lib after we found it in
# one place or we might report a false duplicate if lib64 is a
# symlink of lib.
break
fi
if [test "$_x_ac_pmix_version" = "2"]; then
if [test "$_x_ac_pmix_v2_found" = "1" ]; then
m4_define([err_pmix_v2],[error processing $x_ac_cv_pmix_libdir: PMIx v2.x])
AC_MSG_ERROR(err_pmix_v2 err_pmix)
fi
_x_ac_pmix_v2_found="1"
PMIX_V2_CPPFLAGS="-I$x_ac_cv_pmix_dir/include"
if test "$ac_with_rpath" = "yes"; then
PMIX_V2_LDFLAGS="-Wl,-rpath -Wl,$x_ac_cv_pmix_libdir -L$x_ac_cv_pmix_libdir"
else
PMIX_V2_CPPFLAGS=$PMIX_V2_CPPFLAGS" -DPMIXP_V2_LIBPATH=\\\"$x_ac_cv_pmix_libdir\\\""
fi
# We don't want to search the other lib after we found it in
# one place or we might report a false duplicate if lib64 is a
# symlink of lib.
break
fi
if [test "$_x_ac_pmix_version" = "3"]; then
if [test "$_x_ac_pmix_v3_found" = "1" ]; then
m4_define([err_pmix_v3],[error processing $x_ac_cv_pmix_libdir: PMIx v3.x])
AC_MSG_ERROR(err_pmix_v3 err_pmix)
fi
_x_ac_pmix_v3_found="1"
PMIX_V3_CPPFLAGS="-I$x_ac_cv_pmix_dir/include"
if test "$ac_with_rpath" = "yes"; then
PMIX_V3_LDFLAGS="-Wl,-rpath -Wl,$x_ac_cv_pmix_libdir -L$x_ac_cv_pmix_libdir"
else
PMIX_V3_CPPFLAGS=$PMIX_V3_CPPFLAGS" -DPMIXP_V3_LIBPATH=\\\"$x_ac_cv_pmix_libdir\\\""
fi
# We don't want to search the other lib after we found it in
# one place or we might report a false duplicate if lib64 is a
# symlink of lib.
break
fi
if [test "$_x_ac_pmix_version" = "4"]; then
if [test "$_x_ac_pmix_v4_found" = "1" ]; then
m4_define([err_pmix_v4],[error processing $x_ac_cv_pmix_libdir: PMIx v4.x])
AC_MSG_ERROR(err_pmix_v4 err_pmix)
fi
_x_ac_pmix_v4_found="1"
PMIX_V4_CPPFLAGS="-I$x_ac_cv_pmix_dir/include"
if test "$ac_with_rpath" = "yes"; then
PMIX_V4_LDFLAGS="-Wl,-rpath -Wl,$x_ac_cv_pmix_libdir -L$x_ac_cv_pmix_libdir"
else
PMIX_V4_CPPFLAGS=$PMIX_V4_CPPFLAGS" -DPMIXP_V4_LIBPATH=\\\"$x_ac_cv_pmix_libdir\\\""
fi
# We don't want to search the other lib after we found it in
# one place or we might report a false duplicate if lib64 is a
# symlink of lib.
break
fi
done
done
])
AC_DEFINE(HAVE_PMIX, 1, [Define to 1 if pmix library found])
AC_SUBST(PMIX_V1_CPPFLAGS)
AC_SUBST(PMIX_V1_LDFLAGS)
AC_SUBST(PMIX_V2_CPPFLAGS)
AC_SUBST(PMIX_V2_LDFLAGS)
AC_SUBST(PMIX_V3_CPPFLAGS)
AC_SUBST(PMIX_V3_LDFLAGS)
AC_SUBST(PMIX_V4_CPPFLAGS)
AC_SUBST(PMIX_V4_LDFLAGS)
if test $_x_ac_pmix_v1_found = 0 && test $_x_ac_pmix_v2_found = 0 &&
test $_x_ac_pmix_v3_found = 0 && test $_x_ac_pmix_v4_found = 0; then
if test -z "$with_pmix"; then
AC_MSG_WARN([unable to locate pmix installation])
else
AC_MSG_ERROR([unable to locate pmix installation])
fi
fi
fi
AM_CONDITIONAL(HAVE_PMIX, [test $_x_ac_pmix_v1_found = "1"] ||
[test $_x_ac_pmix_v2_found = "1"] ||
[test $_x_ac_pmix_v3_found = "1"] )
AM_CONDITIONAL(HAVE_PMIX_V1, [test $_x_ac_pmix_v1_found = "1"])
AM_CONDITIONAL(HAVE_PMIX_V2, [test $_x_ac_pmix_v2_found = "1"])
AM_CONDITIONAL(HAVE_PMIX_V3, [test $_x_ac_pmix_v3_found = "1"])
AM_CONDITIONAL(HAVE_PMIX_V4, [test $_x_ac_pmix_v4_found = "1"])
])