3
3
dnl Copyright (c) 2015-2017 Research Organization for Information Science
4
4
dnl and Technology (RIST). All rights reserved.
5
5
dnl Copyright (c) 2017 Cisco Systems, Inc. All rights reserved.
6
+ dnl Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
6
7
dnl $COPYRIGHT $
7
8
dnl
8
9
dnl Additional copyrights may follow
@@ -66,6 +67,8 @@ AC_DEFUN([OPAL_LIBNL_SANITY_INIT], [
66
67
opal_libnl_location=$with_libnl
67
68
;;
68
69
esac
70
+
71
+ OAC_CHECK_PACKAGE_VERIFY_COMMANDS([[OPAL_LIBNL_CHECK_PACKAGE_CALLBACK]])
69
72
])
70
73
71
74
dnl OPAL_LIBNL_SANITY_FAIL_MSG(lib)
@@ -79,6 +82,28 @@ AC_DEFUN([OPAL_LIBNL_SANITY_FAIL_MSG], [
79
82
AC_MSG_WARN([Open MPI will therefore skip using lib$1 .])
80
83
])
81
84
85
+ dnl OPAL_LIBNL_CHECK_PACKAGE_CALLBACK(package name, prefix,
86
+ dnl headers, function name,
87
+ dnl action if happy, action if not happy)
88
+ dnl
89
+ dnl Callback from OAC_CHECK_PACKAGE to verify that there is
90
+ dnl not a conflict. Note that CPPFLAGS, LDFLAGS, and LIBS
91
+ dnl are setup to compile/link package.
92
+ AC_DEFUN([OPAL_LIBNL_CHECK_PACKAGE_CALLBACK], [
93
+ OPAL_VAR_SCOPE_PUSH([opal_libnl_sane])
94
+ opal_libnl_sane= 1
95
+ case $host in
96
+ * linux* )
97
+ OPAL_LIBNL_SANITY_CHECK_LINUX([$1 ], [$4 ], [], [opal_libnl_sane])
98
+ ;;
99
+ esac
100
+
101
+ AS_IF([test ${opal_libnl_sane} -eq 1],
102
+ [$5 ], [$6 ])
103
+
104
+ OPAL_VAR_SCOPE_POP([opal_libnl_sane])
105
+ ])
106
+
82
107
dnl OPAL_LIBNL_SANITY_CHECK(lib, function, LIBS, libnl_check_ok)
83
108
dnl
84
109
dnl This macro is invoked from OPAL_CHECK_PACKAGE to make sure that
@@ -101,7 +126,7 @@ AC_DEFUN([OPAL_LIBNL_SANITY_CHECK], [
101
126
opal_libnl_sane= 1
102
127
case $host in
103
128
* linux* )
104
- OPAL_LIBNL_SANITY_CHECK_LINUX($1 , $2 , $3 , opal_libnl_sane)
129
+ OPAL_LIBNL_SANITY_CHECK_LINUX([ $1 ], [ $2 ], [-l $1 $3 ], [ opal_libnl_sane] )
105
130
;;
106
131
esac
107
132
@@ -111,7 +136,7 @@ AC_DEFUN([OPAL_LIBNL_SANITY_CHECK], [
111
136
112
137
dnl
113
138
dnl Simple helper for OPAL_LIBNL_SANITY_CHECK
114
- dnl $1 : library name
139
+ dnl $1 : package name
115
140
dnl $2 : function
116
141
dnl $3 : LIBS
117
142
dnl $4 : output variable (1=ok, 0=not ok)
@@ -121,7 +146,7 @@ AC_DEFUN([OPAL_LIBNL_SANITY_CHECK_LINUX], [
121
146
122
147
AC_LANG_PUSH(C)
123
148
124
- AC_MSG_CHECKING([if lib $1 requires libnl v1 or v3])
149
+ AC_MSG_CHECKING([if $1 requires libnl v1 or v3])
125
150
cat > conftest_c.$ac_ext << EOF
126
151
extern void $2 (void);
127
152
int main(int argc, char * argv[[]]) {
@@ -133,14 +158,15 @@ EOF
133
158
this_requires_v1= 0
134
159
this_requires_v3= 0
135
160
result_msg=
136
- OPAL_LOG_COMMAND([$CC -o conftest $CFLAGS $CPPFLAGS conftest_c.$ac_ext $LDFLAGS -l $1 $LIBS $3 ],
161
+ OPAL_LOG_COMMAND([$CC -o conftest $CFLAGS $CPPFLAGS conftest_c.$ac_ext $LDFLAGS $LIBS $3 ],
137
162
[ldd_output= ` ldd conftest`
138
163
AS_IF([echo $ldd_output | grep -q libnl-3.so],
139
164
[this_requires_v3= 1
140
165
result_msg= " v3" ])
141
166
AS_IF([echo $ldd_output | grep -q libnl.so],
142
167
[this_requires_v1= 1
143
168
result_msg= " v1 $result_msg " ])
169
+ AS_IF([test -z " ${result_msg} " ], [result_msg= " none" ])
144
170
AC_MSG_RESULT([$result_msg ])
145
171
],
146
172
[AC_MSG_WARN([Could not link a simple program with lib $1 ])
156
182
157
183
# Does this library require both v1 and v3? If so, fail.
158
184
AS_IF([test $this_requires_v1 -eq 1 && test $this_requires_v3 -eq 1],
159
- [AC_MSG_WARN([Unfortunately, lib $1 links to both libnl and libnl-3.])
185
+ [AC_MSG_WARN([Unfortunately, $1 links to both libnl and libnl-3.])
160
186
OPAL_LIBNL_SANITY_FAIL_MSG($1 )
161
187
libnl_sane= 0])
162
188
176
202
# v1? If so, fail.
177
203
AS_IF([test $libnl_sane -eq 1 && test $this_requires_v3 -eq 1],
178
204
[AS_IF([test $opal_libnl_version -eq 1],
179
- [AC_MSG_WARN([libnl version conflict: $opal_libnlv1_libs requires libnl whereas lib $ 1 requires libnl-3])
205
+ [AC_MSG_WARN([libnl version conflict: $opal_libnlv1_libs requires libnl whereas 1 requires libnl-3])
180
206
OPAL_LIBNL_SANITY_FAIL_MSG($1 )
181
207
libnl_sane= 0],
182
208
[opal_libnlv3_libs= " $opal_libnlv3_libs $1 "
0 commit comments