@@ -38,35 +38,23 @@ AC_DEFUN([OPAL_LIBNL_SANITY_INIT], [
38
38
opal_libnl_version= 0
39
39
opal_libnlv1_libs=
40
40
opal_libnlv3_libs=
41
+
41
42
AC_ARG_WITH([libnl],
42
43
[AS_HELP_STRING([--with-libnl(=DIR)],
43
- [Directory prefix for libnl (typically only necessary if libnl is installed in a location that the compiler/linker will not search by default)])])
44
-
45
- # The --with options carry two pieces of information: 1) do
46
- # you want a specific version of libnl, and 2) where that
47
- # version of libnl lives. For simplicity, let's separate
48
- # those two pieces of information.
49
- case " $with_libnl " in
50
- no)
51
- # Nope, don't want it
52
- opal_want_libnl=no
53
- ;;
54
- " " )
55
- # Just try to build with libnl
56
- opal_want_libnl=try
57
- opal_libnl_location=
58
- ;;
59
- yes)
60
- # Yes, definitely want it
61
- opal_want_libnl=yes
62
- opal_libnl_location=
63
- ;;
64
- * )
65
- # Yes, definitely want it -- at a specific location
66
- opal_want_libnl=yes
67
- opal_libnl_location=$with_libnl
68
- ;;
69
- esac
44
+ [Directory prefix for libnlv3 (typically only necessary if libnl is installed in a location that the compiler/linker will not search by default)])])
45
+ AC_ARG_WITH([libn-libdirl],
46
+ [AS_HELP_STRING([--with-libnl-libdir= DIR],
47
+ [Directory prefix for libnlv3 libs(typically only necessary if libnl is installed in a location that the compiler/linker will not search by default)])])
48
+
49
+ # ugly hack to deal with potentially alternate locations for
50
+ # libnl3 headers. Note that if the pkg-config file is found,
51
+ # this ugly hack won't be used.
52
+ AS_IF([test -n " $with_libnl_incdir " ],
53
+ [# skip check if someone above set incdir],
54
+ [test -d " /usr/include/libnl3" ],
55
+ [with_libnl_incdir= " /usr/include/libnl3" ],
56
+ [test -d " /usr/local/include/libnl3" ],
57
+ [with_libnl_incdir= " /usr/local/include/libnl3" ])
70
58
71
59
OAC_CHECK_PACKAGE_VERIFY_COMMANDS([[OPAL_LIBNL_CHECK_PACKAGE_CALLBACK]])
72
60
])
@@ -106,10 +94,10 @@ AC_DEFUN([OPAL_LIBNL_CHECK_PACKAGE_CALLBACK], [
106
94
107
95
dnl OPAL_LIBNL_SANITY_CHECK(lib, function, LIBS, libnl_check_ok)
108
96
dnl
109
- dnl This macro is invoked from OPAL_CHECK_PACKAGE to make sure that
97
+ dnl This macro is invoked from CHECK_PACKAGE to make sure that
110
98
dnl new libraries that are added to LIBS do not pull in conflicting
111
99
dnl versions of libnl. E.g., if we already have a library in LIBS
112
- dnl that pulls in libnl v3, if OPAL_CHECK_PACKAGE is later called that
100
+ dnl that pulls in libnl v3, if CHECK_PACKAGE is later called that
113
101
dnl pulls in a library that pulls in libnl v1, this macro will detect
114
102
dnl the conflict and will abort configure.
115
103
dnl
@@ -220,159 +208,6 @@ EOF
220
208
OPAL_VAR_SCOPE_POP([ldd_output libnl_sane this_requires_v1 this_requires_v3 result_msg])
221
209
])
222
210
223
- dnl
224
- dnl Check for libnl-3.
225
- dnl
226
- dnl Inputs:
227
- dnl
228
- dnl $1 : prefix where to look for libnl-3
229
- dnl $2 : var name prefix of _CPPFLAGS and _LDFLAGS and _LIBS
230
- dnl
231
- dnl Outputs:
232
- dnl
233
- dnl - Set $2 _CPPFLAGS necessary to compile with libnl-3
234
- dnl - Set $2 _LDFLAGS necessary to link with libnl-3
235
- dnl - Set $2 _LIBS necessary to link with libnl-3
236
- dnl - Set OPAL_HAVE_LIBNL3 1 if libnl-3 will be used
237
- dnl
238
- AC_DEFUN([OPAL_CHECK_LIBNL_V3],[
239
- OPAL_VAR_SCOPE_PUSH([CPPFLAGS_save opal_tmp_CPPFLAGS LIBS_save LDFLAGS_save])
240
- AC_MSG_NOTICE([checking for libnl v3])
241
-
242
- AS_IF([test " $opal_want_libnl " != " no" ],
243
- [AS_IF([test -z " $opal_libnl_location " ],
244
- [AC_MSG_CHECKING([for /usr/include/libnl3])
245
- AS_IF([test -d " /usr/include/libnl3" ],
246
- [opal_tmp_CPPFLAGS= -I/usr/include/libnl3
247
- opal_libnlv3_happy= 1
248
- AC_MSG_RESULT([found])],
249
- [AC_MSG_RESULT([not found])
250
- AC_MSG_CHECKING([for /usr/local/include/libnl3])
251
- AS_IF([test -d " /usr/local/include/libnl3" ],
252
- [opal_tmp_CPPFLAGS= -I/usr/local/include/netlink3
253
- opal_libnlv3_happy= 1
254
- AC_MSG_RESULT([found])],
255
- [opal_libnlv3_happy= 0
256
- AC_MSG_RESULT([not found])])])],
257
- [AC_MSG_CHECKING([for $1 /include/libnl3])
258
- AS_IF([test -d " $1 /include/libnl3" ],
259
- [opal_tmp_CPPFLAGS= " -I$1 /include/libnl3"
260
- opal_libnlv3_happy= 1
261
- AC_MSG_RESULT([found])],
262
- [opal_libnlv3_happy= 0
263
- AC_MSG_RESULT([not found])])])
264
- CPPFLAGS_save= $CPPFLAGS
265
- CPPFLAGS= " $opal_tmp_CPPFLAGS $CPPFLAGS "
266
-
267
- # Random note: netlink/version.h is only in libnl v3 - it is not in libnl v1.
268
- # Also, nl_recvmsgs_report is only in libnl v3.
269
- AS_IF([test $opal_libnlv3_happy -eq 1],
270
- [OPAL_CHECK_PACKAGE([$2 ],
271
- [netlink/version.h],
272
- [nl-3],
273
- [nl_recvmsgs_report],
274
- [],
275
- [$1 ],
276
- [],
277
- [],
278
- [opal_libnlv3_happy= 0])
279
-
280
- # Note that OPAL_CHECK_PACKAGE is going to add
281
- # -I$dir/include into $2_CPPFLAGS. But because libnl v3
282
- # puts the headers in $dir/include/libnl3, we need to
283
- # overwrite $2_CPPFLAGS with -I$dir/include/libnl3. We can do
284
- # this unconditionally; we don't have to check for
285
- # success (checking for success occurs below).
286
- $2 _CPPFLAGS= $opal_tmp_CPPFLAGS ])
287
-
288
- # If we found libnl-3, we *also* need libnl-route-3
289
- LIBS_save= $LIBS
290
- LDFLAGS_save= $LDFLAGS
291
- AS_IF([test -n " $$ 2_LDFLAGS" ],
292
- [LDFLAGS= " $$ 2_LDFLAGS $LDFLAGS " ])
293
- AS_IF([test $opal_libnlv3_happy -eq 1],
294
- [AC_SEARCH_LIBS([nl_rtgen_request],
295
- [nl-route-3],
296
- [],
297
- [opal_libnlv3_happy= 0])])
298
- LIBS= $LIBS_save
299
- LDFLAGS= $LDFLAGS_save
300
-
301
- # Just because libnl* is evil, double check that the
302
- # netlink/version.h we found was for libnl v3. As far as we
303
- # know, netlink/version.h only first appeared in version
304
- # 3... but let's really be sure.
305
- AS_IF([test $opal_libnlv3_happy -eq 1],
306
- [AC_MSG_CHECKING([to ensure these really are libnl v3 headers])
307
- AS_IF([test -n " $$ 2_CPPFLAGS" ],
308
- [CPPFLAGS= " $$ 2_CPPFLAGS $CPPFLAGS " ])
309
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
310
- # include <netlink/netlink.h>
311
- # include <netlink/version.h>
312
- # ifndef LIBNL_VER_MAJ
313
- # error "LIBNL_VER_MAJ not defined!"
314
- # endif
315
- /* to the best of our knowledge, version.h only exists in libnl v3 * /
316
- # if LIBNL_VER_MAJ != 3
317
- # error "LIBNL_VER_MAJ != 3, I am sad"
318
- # endif
319
- ]])],
320
- [AC_MSG_RESULT([yes])],
321
- [AC_MSG_RESULT([no])
322
- opal_libnlv3_happy= 0])])
323
-
324
- CPPFLAGS= $CPPFLAGS_save ],
325
-
326
- [opal_libnlv3_happy= 0])
327
-
328
- # If we found everything
329
- AS_IF([test $opal_libnlv3_happy -eq 1],
330
- [$2 _LIBS= " -lnl-3 -lnl-route-3"
331
- OPAL_HAVE_LIBNL3= 1],
332
- [# OPAL_CHECK_PACKAGE(...,nl_recvmsgs_report,...) might have set the variables below
333
- # so reset them if libnl v3 cannot be used
334
- $2 _CPPFLAGS= " "
335
- $2 _LDFLAGS= " "
336
- $2 _LIBS= " " ])
337
-
338
- OPAL_VAR_SCOPE_POP
339
- ])
340
-
341
- dnl
342
- dnl Check for libnl.
343
- dnl
344
- dnl Inputs:
345
- dnl
346
- dnl $1 : prefix where to look for libnl
347
- dnl $2 : var name prefix of _CPPFLAGS and _LDFLAGS and _LIBS
348
- dnl
349
- dnl Outputs:
350
- dnl
351
- dnl - Set $2 _CPPFLAGS necessary to compile with libnl
352
- dnl - Set $2 _LDFLAGS necessary to link with libnl
353
- dnl - Set $2 _LIBS necessary to link with libnl
354
- dnl - Set OPAL_HAVE_LIBNL3 0 if libnl will be used
355
- dnl
356
- AC_DEFUN([OPAL_CHECK_LIBNL_V1],[
357
- AC_MSG_NOTICE([checking for libnl v1])
358
-
359
- AS_IF([test " $opal_want_libnl " != " no" ],
360
- [OPAL_CHECK_PACKAGE([$2 ],
361
- [netlink/netlink.h],
362
- [nl],
363
- [nl_connect],
364
- [-lm],
365
- [$1 ],
366
- [],
367
- [opal_libnlv1_happy= 1],
368
- [opal_libnlv1_happy= 0])],
369
- [opal_libnlv1_happy= 0])
370
-
371
- AS_IF([test $opal_libnlv1_happy -eq 1],
372
- [$2 _LIBS= " -lnl -lm"
373
- OPAL_HAVE_LIBNL3= 0])
374
- ])
375
-
376
211
dnl
377
212
dnl Summarize libnl and libnl3 usage,
378
213
dnl and abort if conflict is found
0 commit comments