Whamcloud - gitweb
LU-16240 build: Use new AS_HELP_STRING
[fs/lustre-release.git] / lnet / autoconf / lustre-lnet.m4
1 # LN_CONFIG_BACKOFF
2 #
3 # check if tunable tcp backoff is available/wanted
4 #
5 AC_DEFUN([LN_CONFIG_BACKOFF], [
6 AC_MSG_CHECKING([whether to enable tunable backoff TCP support])
7 AC_ARG_ENABLE([backoff],
8         AS_HELP_STRING([--disable-backoff],
9                 [disable socknal tunable backoff]),
10         [], [enable_backoff="yes"])
11 AC_MSG_RESULT([$enable_backoff])
12 AS_IF([test "x$enable_backoff" = xyes], [
13         AC_MSG_CHECKING([if Linux kernel has tunable backoff TCP support])
14         AS_IF([grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h >/dev/null], [
15                 AC_MSG_RESULT([yes])
16                 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
17                 AS_IF([grep rto_max $LINUX/include/linux/tcp.h | grep -q __u16 >/dev/null],
18                         [AC_DEFINE(SOCKNAL_BACKOFF_MS, 1,
19                                 [tunable backoff TCP in ms])])
20         ], [
21                 AC_MSG_RESULT([no])
22         ])
23 ])
24 ]) # LN_CONFIG_BACKOFF
25
26 #
27 # LN_CONFIG_DLC
28 #
29 # Configure dlc
30 #
31 # fail to build if libyaml is not installed
32 #
33 AC_DEFUN([LN_CONFIG_DLC], [
34         AS_IF([test "x$enable_dist" = xno], [
35                 AC_CHECK_LIB([yaml], [yaml_parser_initialize],
36                              [LIBYAML="libyaml"],
37                              [AC_MSG_ERROR([YAML development libraries not not installed])],
38                              [-lm])
39         ])
40 ])
41
42 #
43 # LN_CONFIG_O2IB
44 #
45 # If current OFED installed (assume with "ofed_info") and devel
46 # headers are not found, error because we assume OFED infiniband
47 # driver needs to be used and we must configure/build with it.
48 # Current OFED headers detection mechanism allow for non-standard
49 # prefix but relies on "ofed_info" command and on "%prefix/openib"
50 # link (both are ok for 1.5.x and 3.x versions), and should work
51 # for both source and DKMS builds.
52 #
53 AC_DEFUN([LN_CONFIG_O2IB], [
54 AC_MSG_CHECKING([whether to use Compat RDMA])
55 AC_ARG_WITH([o2ib],
56         AS_HELP_STRING([--with-o2ib=[yes|no|<path>]],
57                 [build o2iblnd against path]),
58         [], [with_o2ib="yes"])
59
60 case $with_o2ib in
61         yes)    AS_IF([which ofed_info 2>/dev/null], [
62                         AS_IF([test x$uses_dpkg = xyes], [
63                                 LIST_ALL_PKG="dpkg -l | awk '{print \[$]2}'"
64                                 LSPKG="dpkg --listfiles"
65                         ], [
66                                 LIST_ALL_PKG="rpm -qa"
67                                 LSPKG="rpm -ql"
68                         ])
69
70                         O2IBPKG="mlnx-ofed-kernel-dkms"
71                         O2IBPKG+="|mlnx-ofed-kernel-modules"
72                         O2IBPKG+="|mlnx-ofa_kernel-devel"
73                         O2IBPKG+="|compat-rdma-devel"
74                         O2IBPKG+="|kernel-ib-devel"
75                         O2IBPKG+="|ofa_kernel-devel"
76
77                         O2IBDIR="/ofa_kernel"
78                         O2IBDIR+="|/ofa_kernel/default"
79                         O2IBDIR+="|/openib"
80
81                         O2IBDIR_PATH=$(eval $LIST_ALL_PKG |
82                                        egrep -w "$O2IBPKG" | xargs $LSPKG |
83                                        egrep "${O2IBDIR}$" | head -n1)
84
85                         if test -n "$O2IBDIR_PATH"; then
86                                 O2IBPATHS=$(find $O2IBDIR_PATH -name rdma_cm.h |
87                                         sed -e 's/\/include\/rdma\/rdma_cm.h//')
88                         fi
89
90                         AS_IF([test -z "$O2IBPATHS"], [
91                                 AC_MSG_ERROR([
92 You seem to have an OFED installed but have not installed it's devel package.
93 If you still want to build Lustre for your OFED I/B stack, you need to install its devel headers RPM.
94 Instead, if you want to build Lustre for your kernel's built-in I/B stack rather than your installed OFED stack, either remove the OFED package(s) or use --with-o2ib=no.
95                                              ])
96                         ])
97                         AS_IF([test $(echo $O2IBPATHS | wc -w) -ge 2], [
98                                 AC_MSG_ERROR([
99 It appears that you have multiple OFED versions installed.
100 If you still want to build Lustre for your OFED I/B stack, you need to install a single version with its devel headers RPM.
101 Instead, if you want to build Lustre for your in-kernel I/B stack rather than your installed external OFED stack, either remove the OFED package(s) or use --with-o2ib=no.
102                                              ])
103                         ])
104                         if test -e $O2IBPATHS/${LINUXRELEASE}; then
105                             O2IBPATHS=$O2IBPATHS/${LINUXRELEASE}
106                         elif test -e $O2IBPATHS/default; then
107                             O2IBPATHS=$O2IBPATHS/default
108                         fi
109                         OFED="yes"
110                 ], [
111                         O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
112                 ])
113                 ENABLEO2IB="yes"
114                 ;;
115         no)     ENABLEO2IB="no"
116                 ;;
117         *)      O2IBPATHS=$with_o2ib
118                 ENABLEO2IB="withpath"
119                 OFED="yes"
120                 ;;
121 esac
122
123 AS_IF([test $ENABLEO2IB = "no"], [
124         AC_MSG_RESULT([no])
125         AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
126         AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
127 ], [
128         o2ib_found=false
129         for O2IBPATH in $O2IBPATHS; do
130                 AS_IF([test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
131                            -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
132                            -f ${O2IBPATH}/include/rdma/ib_verbs.h \)], [
133                         o2ib_found=true
134                         break
135                 ])
136         done
137         if ! $o2ib_found; then
138                 AC_MSG_RESULT([no])
139                 case $ENABLEO2IB in
140                         "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;;
141                         "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
142                         *) AC_MSG_ERROR([internal error]) ;;
143                 esac
144         else
145                 COMPAT_AUTOCONF=""
146                 compatrdma_found=false
147                 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
148                         AC_MSG_RESULT([yes])
149                         compatrdma_found=true
150                         AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
151                         EXTRA_OFED_CONFIG="$EXTRA_OFED_CONFIG -include ${O2IBPATH}/include/linux/compat-2.6.h"
152                         if test -f "$O2IBPATH/include/linux/compat_autoconf.h"; then
153                                 COMPAT_AUTOCONF="$O2IBPATH/include/linux/compat_autoconf.h"
154                         fi
155                 else
156                         AC_MSG_RESULT([no])
157                 fi
158                 if ! $compatrdma_found; then
159                         if test -f "$O2IBPATH/config.mk"; then
160                                 . "$O2IBPATH/config.mk"
161                         elif test -f "$O2IBPATH/ofed_patch.mk"; then
162                                 . "$O2IBPATH/ofed_patch.mk"
163                         fi
164                 elif test -z "$COMPAT_AUTOCONF"; then
165                         # Depreciated checks
166                         if test "x$RHEL_KERNEL" = xyes; then
167                                 RHEL_MAJOR=$(awk '/ RHEL_MAJOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
168                                 I=$(awk '/ RHEL_MINOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
169                                 while test "$I" -ge 0; do
170                                         EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_${RHEL_MAJOR}_$I"
171                                         I=$(($I-1))
172                                 done
173                         elif test "x$SUSE_KERNEL" = xyes; then
174                                 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
175                                 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
176                         fi
177                 fi
178
179                 AC_MSG_CHECKING([whether to use any OFED backport headers])
180                 if test -n "$BACKPORT_INCLUDES"; then
181                         AC_MSG_RESULT([yes])
182                         OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
183                         EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
184                 else
185                         AC_MSG_RESULT([no])
186                 fi
187
188                 O2IBLND=""
189                 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
190                 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include -I$O2IBPATH/include/uapi"
191                 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
192                 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
193                 openib_gen2_support, [
194                         #ifdef HAVE_COMPAT_RDMA
195                         #undef PACKAGE_NAME
196                         #undef PACKAGE_TARNAME
197                         #undef PACKAGE_VERSION
198                         #undef PACKAGE_STRING
199                         #undef PACKAGE_BUGREPORT
200                         #undef PACKAGE_URL
201                         #include <linux/compat-2.6.h>
202                         #endif
203                         #include <linux/version.h>
204                         #include <linux/pci.h>
205                         #include <linux/gfp.h>
206                         #include <rdma/rdma_cm.h>
207                         #include <rdma/ib_cm.h>
208                         #include <rdma/ib_verbs.h>
209                 ],[
210                         struct rdma_cm_id      *cm_idi __attribute__ ((unused));
211                         struct rdma_conn_param  conn_param __attribute__ ((unused));
212                         struct ib_device_attr   device_attr __attribute__ ((unused));
213                         struct ib_qp_attr       qp_attr __attribute__ ((unused));
214                         enum   ib_cm_rej_reason rej_reason __attribute__ ((unused));
215                         rdma_destroy_id(NULL);
216                 ],[
217                         O2IBLND="o2iblnd"
218                 ],[
219                         case $ENABLEO2IB in
220                         "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
221                         "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
222                         *) AC_MSG_ERROR([internal error]) ;;
223                         esac
224                 ])
225                 # we know at this point that the found OFED source is good
226                 O2IB_SYMVER=""
227                 if test -f $O2IBPATH/Module.symvers; then
228                         O2IB_SYMVER=$O2IBPATH/Module.symvers
229                 elif test "x$SUSE_KERNEL" = "xyes"; then
230                         O2IB_SYMVER=$(find ${O2IBPATH}* -name Module.symvers)
231                         # Select only the current 'flavor' if there is more than 1
232                         NUM_AVAIL=$(find ${O2IBPATH}* -name Module.symvers | wc -l)
233                         if test ${NUM_AVAIL} -gt 1; then
234                                 PREFER=$(basename ${LINUX_OBJ})
235                                 for F in $(find ${O2IBPATH}-obj -name Module.symvers)
236                                 do
237                                         maybe=$(echo $F | grep "/${PREFER}")
238                                         if test "x$maybe" != "x"; then
239                                                 O2IB_SYMVER=$F
240                                         fi
241                                 done
242                         fi
243                 elif test -f $LINUX_OBJ/Module.symvers; then
244                         # Debian symvers is in the arch tree
245                         O2IB_SYMVER=$LINUX_OBJ/Module.symvers
246                 fi
247                 if test -n "$O2IB_SYMVER"; then
248                         AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path])
249                         EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER"
250                         AC_SUBST(EXTRA_SYMBOLS)
251                 else
252                         AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
253                 fi
254
255                 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
256                 linux_kthread_worker, [
257                         #ifdef HAVE_COMPAT_RDMA
258                         #undef PACKAGE_NAME
259                         #undef PACKAGE_TARNAME
260                         #undef PACKAGE_VERSION
261                         #undef PACKAGE_STRING
262                         #undef PACKAGE_BUGREPORT
263                         #undef PACKAGE_URL
264                         #include <linux/compat-2.6.h>
265                         #endif
266                         #include <linux/kthread.h>
267                 ],[
268                         struct kthread_work *kth_wrk = NULL;
269                         flush_kthread_work(kth_wrk);
270                 ],[
271                         AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
272                         if test -z "$COMPAT_AUTOCONF"; then
273                                 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
274                         fi
275                 ])
276                 EXTRA_CHECK_INCLUDE=""
277         fi
278 ])
279 AC_SUBST(EXTRA_OFED_CONFIG)
280 AC_SUBST(EXTRA_OFED_INCLUDE)
281 AC_SUBST(O2IBLND)
282 AC_SUBST(O2IBPATH)
283 AC_SUBST(ENABLEO2IB)
284
285 AS_IF([test $ENABLEO2IB != "no"], [
286         EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
287         KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $O2IBPATH/Module.symvers"
288
289         # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
290         LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
291         rdma_create_id_4args, [
292                 #ifdef HAVE_COMPAT_RDMA
293                 #undef PACKAGE_NAME
294                 #undef PACKAGE_TARNAME
295                 #undef PACKAGE_VERSION
296                 #undef PACKAGE_STRING
297                 #undef PACKAGE_BUGREPORT
298                 #undef PACKAGE_URL
299                 #include <linux/compat-2.6.h>
300                 #endif
301                 #include <rdma/rdma_cm.h>
302         ],[
303                 rdma_create_id(NULL, NULL, 0, 0);
304         ],[
305                 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
306                         [rdma_create_id wants 4 args])
307         ])
308
309         # 4.4 added network namespace parameter for rdma_create_id()
310         LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
311         rdma_create_id_5args, [
312                 #ifdef HAVE_COMPAT_RDMA
313                 #undef PACKAGE_NAME
314                 #undef PACKAGE_TARNAME
315                 #undef PACKAGE_VERSION
316                 #undef PACKAGE_STRING
317                 #undef PACKAGE_BUGREPORT
318                 #undef PACKAGE_URL
319                 #include <linux/compat-2.6.h>
320                 #endif
321                 #include <rdma/rdma_cm.h>
322         ],[
323                 rdma_create_id(NULL, NULL, NULL, 0, 0);
324         ],[
325                 AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
326                         [rdma_create_id wants 5 args])
327         ])
328
329         # 4.2 introduced struct ib_cq_init_attr which is used
330         # by ib_create_cq(). Note some OFED stacks only keep
331         # their headers in sync with latest kernels but not
332         # the functionality which means for infiniband testing
333         # we need to always test functionality testings.
334         LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
335         ib_cq_init_attr, [
336                 #ifdef HAVE_COMPAT_RDMA
337                 #undef PACKAGE_NAME
338                 #undef PACKAGE_TARNAME
339                 #undef PACKAGE_VERSION
340                 #undef PACKAGE_STRING
341                 #undef PACKAGE_BUGREPORT
342                 #undef PACKAGE_URL
343                 #include <linux/compat-2.6.h>
344                 #endif
345                 #include <rdma/ib_verbs.h>
346         ],[
347                 struct ib_cq_init_attr cq_attr;
348
349                 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
350         ],[
351                 AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
352                         [struct ib_cq_init_attr is used by ib_create_cq])
353         ])
354
355         # 4.3 removed ib_alloc_fast_reg_mr()
356         LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
357         ib_alloc_fast_reg_mr, [
358                 #ifdef HAVE_COMPAT_RDMA
359                 #undef PACKAGE_NAME
360                 #undef PACKAGE_TARNAME
361                 #undef PACKAGE_VERSION
362                 #undef PACKAGE_STRING
363                 #undef PACKAGE_BUGREPORT
364                 #undef PACKAGE_URL
365                 #include <linux/compat-2.6.h>
366                 #endif
367                 #include <rdma/ib_verbs.h>
368         ],[
369                 ib_alloc_fast_reg_mr(NULL, 0);
370         ],[
371                 AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
372                         [ib_alloc_fast_reg_mr is defined])
373         ])
374
375         # 4.9 must stop using ib_get_dma_mr and the global MR
376         # We then have to use FMR/Fastreg for all RDMA.
377         LB_CHECK_COMPILE([if 'ib_get_dma_mr' exists],
378         ib_get_dma_mr, [
379                 #ifdef HAVE_COMPAT_RDMA
380                 #undef PACKAGE_NAME
381                 #undef PACKAGE_TARNAME
382                 #undef PACKAGE_VERSION
383                 #undef PACKAGE_STRING
384                 #undef PACKAGE_BUGREPORT
385                 #undef PACKAGE_URL
386                 #include <linux/compat-2.6.h>
387                 #endif
388                 #include <rdma/ib_verbs.h>
389         ],[
390                 ib_get_dma_mr(NULL, 0);
391         ],[
392                 AC_DEFINE(HAVE_IB_GET_DMA_MR, 1,
393                         [ib_get_dma_mr is defined])
394         ])
395
396         # In v4.4 Linux kernel,
397         # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
398         # split up struct ib_send_wr so that all non-trivial verbs
399         # use their own structure which embedds struct ib_send_wr.
400         LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
401         ib_rdma_wr, [
402                 #ifdef HAVE_COMPAT_RDMA
403                 #undef PACKAGE_NAME
404                 #undef PACKAGE_TARNAME
405                 #undef PACKAGE_VERSION
406                 #undef PACKAGE_STRING
407                 #undef PACKAGE_BUGREPORT
408                 #undef PACKAGE_URL
409                 #include <linux/compat-2.6.h>
410                 #endif
411                 #include <rdma/ib_verbs.h>
412         ],[
413                 struct ib_rdma_wr *wr __attribute__ ((unused));
414
415                 wr = rdma_wr(NULL);
416         ],[
417                 AC_DEFINE(HAVE_IB_RDMA_WR, 1,
418                         [struct ib_rdma_wr is defined])
419         ])
420
421         # new fast registration API introduced in 4.4
422         LB_CHECK_COMPILE([if 4arg 'ib_map_mr_sg' exists],
423         ib_map_mr_sg_4args, [
424                 #ifdef HAVE_COMPAT_RDMA
425                 #undef PACKAGE_NAME
426                 #undef PACKAGE_TARNAME
427                 #undef PACKAGE_VERSION
428                 #undef PACKAGE_STRING
429                 #undef PACKAGE_BUGREPORT
430                 #undef PACKAGE_URL
431                 #include <linux/compat-2.6.h>
432                 #endif
433                 #include <rdma/ib_verbs.h>
434         ],[
435                 ib_map_mr_sg(NULL, NULL, 0, 0);
436         ],[
437                 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
438                         [ib_map_mr_sg exists])
439         ])
440
441         # ib_map_mr_sg changes from 4 to 5 args (adding sg_offset_p)
442         # in kernel 4.7 (and RHEL 7.3)
443         LB_CHECK_COMPILE([if 5arg 'ib_map_mr_sg' exists],
444         ib_map_mr_sg_5args, [
445                 #ifdef HAVE_COMPAT_RDMA
446                 #undef PACKAGE_NAME
447                 #undef PACKAGE_TARNAME
448                 #undef PACKAGE_VERSION
449                 #undef PACKAGE_STRING
450                 #undef PACKAGE_BUGREPORT
451                 #undef PACKAGE_URL
452                 #include <linux/compat-2.6.h>
453                 #endif
454                 #include <rdma/ib_verbs.h>
455         ],[
456                 ib_map_mr_sg(NULL, NULL, 0, NULL, 0);
457         ],[
458                 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
459                         [ib_map_mr_sg exists])
460                 AC_DEFINE(HAVE_IB_MAP_MR_SG_5ARGS, 1,
461                         [ib_map_mr_sg has 5 arguments])
462         ])
463
464         # ib_query_device() removed in 4.5
465         LB_CHECK_COMPILE([if 'struct ib_device' has member 'attrs'],
466         ib_device.attrs, [
467                 #ifdef HAVE_COMPAT_RDMA
468                 #undef PACKAGE_NAME
469                 #undef PACKAGE_TARNAME
470                 #undef PACKAGE_VERSION
471                 #undef PACKAGE_STRING
472                 #undef PACKAGE_BUGREPORT
473                 #undef PACKAGE_URL
474                 #include <linux/compat-2.6.h>
475                 #endif
476                 #include <rdma/ib_verbs.h>
477         ],[
478                 struct ib_device dev;
479                 struct ib_device_attr dev_attr = {};
480                 dev.attrs = dev_attr;
481         ],[
482                 AC_DEFINE(HAVE_IB_DEVICE_ATTRS, 1,
483                         [struct ib_device.attrs is defined])
484         ])
485
486         # A flags argument was added to ib_alloc_pd() in Linux 4.9,
487         # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
488         LB_CHECK_COMPILE([if 2arg 'ib_alloc_pd' exists],
489         ib_alloc_pd, [
490                 #ifdef HAVE_COMPAT_RDMA
491                 #undef PACKAGE_NAME
492                 #undef PACKAGE_TARNAME
493                 #undef PACKAGE_VERSION
494                 #undef PACKAGE_STRING
495                 #undef PACKAGE_BUGREPORT
496                 #undef PACKAGE_URL
497                 #include <linux/compat-2.6.h>
498                 #endif
499                 #include <rdma/ib_verbs.h>
500         ],[
501                 ib_alloc_pd(NULL, 0);
502         ],[
503                 AC_DEFINE(HAVE_IB_ALLOC_PD_2ARGS, 1,
504                         [ib_alloc_pd has 2 arguments])
505         ])
506
507         LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
508         ib_inc_rkey, [
509                 #ifdef HAVE_COMPAT_RDMA
510                 #undef PACKAGE_NAME
511                 #undef PACKAGE_TARNAME
512                 #undef PACKAGE_VERSION
513                 #undef PACKAGE_STRING
514                 #undef PACKAGE_BUGREPORT
515                 #undef PACKAGE_URL
516                 #include <linux/compat-2.6.h>
517                 #endif
518                 #include <rdma/ib_verbs.h>
519         ],[
520                 (void)ib_inc_rkey(0);
521         ],[
522                 AC_DEFINE(HAVE_IB_INC_RKEY, 1,
523                           [function ib_inc_rkey exist])
524         ])
525
526         # In MOFED 4.6, the second and third parameters for
527         # ib_post_send() and ib_post_recv() are declared with
528         # 'const'.
529         tmp_flags="$EXTRA_KCFLAGS"
530         EXTRA_KCFLAGS="-Werror"
531         LB_CHECK_COMPILE([if 'ib_post_send() and ib_post_recv()' have const parameters],
532         ib_post_send_recv_const, [
533                 #ifdef HAVE_COMPAT_RDMA
534                 #undef PACKAGE_NAME
535                 #undef PACKAGE_TARNAME
536                 #undef PACKAGE_VERSION
537                 #undef PACKAGE_STRING
538                 #undef PACKAGE_BUGREPORT
539                 #undef PACKAGE_URL
540                 #include <linux/compat-2.6.h>
541                 #endif
542                 #include <rdma/ib_verbs.h>
543         ],[
544                 ib_post_send(NULL, (const struct ib_send_wr *)NULL,
545                              (const struct ib_send_wr **)NULL);
546         ],[
547                 AC_DEFINE(HAVE_IB_POST_SEND_RECV_CONST, 1,
548                         [ib_post_send and ib_post_recv have const parameters])
549         ])
550         EXTRA_KCFLAGS="$tmp_flags"
551
552         # 5.0
553         LN_IB_DEVICE_OPS_EXISTS
554         # 5.1
555         LN_IB_SG_DMA_ADDRESS_EXISTS
556
557         # A reason argument was added to rdma_reject() in Linux 5.8,
558         # commit 8094ba0ace7f6cd1e31ea8b151fba3594cadfa9a
559         LB_CHECK_COMPILE([if 4arg 'rdma_reject' exists],
560         rdma_reject, [
561                 #ifdef HAVE_COMPAT_RDMA
562                 #undef PACKAGE_NAME
563                 #undef PACKAGE_TARNAME
564                 #undef PACKAGE_VERSION
565                 #undef PACKAGE_STRING
566                 #undef PACKAGE_BUGREPORT
567                 #undef PACKAGE_URL
568                 #include <linux/compat-2.6.h>
569                 #endif
570                 #include <rdma/ib_verbs.h>
571                 #include <rdma/ib_cm.h>
572                 #include <rdma/rdma_cm.h>
573         ],[
574                 rdma_reject(NULL, NULL, 0, 0);
575         ],[
576                 AC_DEFINE(HAVE_RDMA_REJECT_4ARGS, 1,
577                         [rdma_reject has 4 arguments])
578         ])
579
580         # The FMR pool API was removed in Linux 5.8,
581         # commit 4e373d5417ecbb4f438a8500f0379a2fc29c2643
582         LB_CHECK_COMPILE([if FMR pools API available],
583         ib_fmr, [
584                 #include <rdma/ib_verbs.h>
585         ],[
586                 struct ib_fmr fmr = {};
587         ],[
588                 AC_DEFINE(HAVE_FMR_POOL_API, 1,
589                         [FMR pool API is available])
590         ])
591
592         # rdma_connect_locked() was added in Linux 5.10,
593         # commit 071ba4cc559de47160761b9500b72e8fa09d923d
594         # and in MOFED-5.2-2. rdma_connect_locked() must
595         # be called instead of rdma_connect() in
596         # RDMA_CM_EVENT_ROUTE_RESOLVED handler.
597         LB_CHECK_COMPILE([if 'rdma_connect_locked' exists],
598         rdma_connect_locked, [
599                 #include <rdma/rdma_cm.h>
600         ],[
601                 rdma_connect_locked(NULL, NULL);
602         ],[
603                 AC_DEFINE(HAVE_RDMA_CONNECT_LOCKED, 1,
604                         [rdma_connect_locked is defined])
605         ])
606
607         # ethtool_link_settings was added in Linux 4.6
608         LB_CHECK_COMPILE([if 'ethtool_link_settings' exists],
609         ethtool_link_settings, [
610                 #include <linux/ethtool.h>
611         ],[
612                 struct ethtool_link_ksettings cmd;
613         ],[
614                 AC_DEFINE(HAVE_ETHTOOL_LINK_SETTINGS, 1,
615                         [ethtool_link_settings is defined])
616         ])
617
618         EXTRA_CHECK_INCLUDE=""
619         AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
620         AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
621 ]) # ENABLEO2IB != "no"
622 ]) # LN_CONFIG_O2IB
623
624 #
625 # LN_CONFIG_GNILND
626 #
627 # check whether to use the Gemini Network Interface lnd
628 #
629 AC_DEFUN([LN_CONFIG_GNILND], [
630 AC_MSG_CHECKING([whether to enable GNI lnd])
631 AC_ARG_ENABLE([gni],
632         AS_HELP_STRING([--enable-gni],
633                 [enable GNI lnd]),
634         [], [enable_gni="no"])
635 AC_MSG_RESULT([$enable_gni])
636
637 AS_IF([test "x$enable_gni" = xyes], [
638         # GNICPPFLAGS was set in spec file
639         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
640         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
641         LB_CHECK_COMPILE([if GNI kernel headers are present],
642         GNI_header, [
643                 #include <linux/types.h>
644                 #include <gni_pub.h>
645         ],[
646                 gni_cdm_handle_t kgni_domain;
647                 gni_return_t     rc;
648                 int              rrc;
649                 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
650                 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
651                 return rrc;
652         ],[
653                 GNILND="gnilnd"
654         ],[
655                 AC_MSG_ERROR([cannot compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
656         ])
657         # at this point, we have gnilnd basic support,
658         # now check for extra features
659         LB_CHECK_COMPILE([to use RCA in gnilnd],
660         RCA_gnilnd, [
661                 #include <linux/types.h>
662                 #include <gni_pub.h>
663                 #include <krca_lib.h>
664         ],[
665                 gni_cdm_handle_t kgni_domain;
666                 gni_return_t     rc;
667                 krca_ticket_t    ticket = KRCA_NULL_TICKET;
668                 int              rrc;
669                 __u32            nid = 0, nic_addr;
670                 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
671                 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
672                 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
673                 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
674                 return rrc;
675         ],[
676                 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
677         ])
678         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
679 ])
680 AC_SUBST(GNICPPFLAGS)
681 AC_SUBST(GNILND)
682 ]) # LN_CONFIG_GNILND
683
684 #
685 # LN_CONFIG_KFILND
686 #
687 # check whether to use the kfabric Network Interface lnd
688 #
689 AC_DEFUN([LN_CONFIG_KFILND], [
690 AC_ARG_WITH([kfi],
691         AS_HELP_STRING([--with-kfi=<path>], [Kfabric build path for kfilnd]),
692         [
693                 AC_CHECK_FILE([$with_kfi/Module.symvers],
694                 [
695                         # KFICPPFLAGS was set in spec file
696                         KFICPPFLAGS="-I$with_kfi/include"
697                         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
698                         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $KFICPPFLAGS"
699                         KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $with_kfi/Module.symvers"
700                         LB_CHECK_COMPILE([if kfabric headers are present], KFI_header,
701                         [
702                                 #include <kfi_endpoint.h>
703                         ],[
704                                 struct kfi_info *hints;
705                                 hints = kfi_allocinfo();
706                         ],[
707                                 KFILND="kfilnd"
708                                 AC_MSG_NOTICE([adding $with_kfi/Module.symvers to Symbol Path])
709                                 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $with_kfi/Module.symvers"
710                         ],[
711                                 AC_MSG_ERROR([can't compile kfilnd with given KFICPPFLAGS: $KFICPPFLAGS])
712                         ])
713                 ],[
714                         AC_MSG_ERROR(["$with_kfi/Module.symvers does not exist"])
715                 ])
716         ],[])
717 AC_DEFINE(HAVE_KFILND, 1, [support kfabric LND])
718 AC_SUBST(KFICPPFLAGS)
719 AC_SUBST(KFILND)
720 AC_SUBST(EXTRA_SYMBOLS)
721 ]) # LN_CONFIG_KFILND
722
723 # LN_CONFIG_STRSCPY_EXISTS
724 #
725 # If strscpy exists, prefer it over strlcpy
726 #
727 AC_DEFUN([LN_CONFIG_STRSCPY_EXISTS], [
728 tmp_flags="$EXTRA_KCFLAGS"
729 EXTRA_KCFLAGS="-Werror"
730 LB_CHECK_COMPILE([kernel strscpy is available],
731 strscpy_exists, [
732         #include <linux/string.h>
733 ],[
734         strscpy((char *)NULL, (const char *)NULL, 0);
735 ],[
736         AC_DEFINE(HAVE_STRSCPY, 1,
737                 [kernel strscpy is available])
738 ])
739 EXTRA_KCFLAGS="$tmp_flags"
740 ]) # LN_CONFIG_STRSCPY_EXISTS
741
742 # LN_CONFIG_SOCK_CREATE_KERN
743 #
744 # 4.x sock_create_kern() added a first parameter as 'struct net *'
745 # instead of int.
746 #
747 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
748 tmp_flags="$EXTRA_KCFLAGS"
749 EXTRA_KCFLAGS="-Werror"
750 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
751 sock_create_kern_net, [
752         #include <linux/net.h>
753         #include <net/net_namespace.h>
754 ],[
755         sock_create_kern((struct net*)0, 0, 0, 0, NULL);
756 ],[
757         AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
758                 [sock_create_kern use net as first parameter])
759 ])
760 EXTRA_KCFLAGS="$tmp_flags"
761 ]) # LN_CONFIG_SOCK_CREATE_KERN
762
763 #
764 # LN_CONFIG_SK_DATA_READY
765 #
766 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
767 #
768 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
769 tmp_flags="$EXTRA_KCFLAGS"
770 EXTRA_KCFLAGS="-Werror"
771 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
772 sk_data_ready, [
773         #include <linux/net.h>
774         #include <net/sock.h>
775 ],[
776         ((struct sock *)0)->sk_data_ready(NULL);
777 ],[
778         AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
779                 [sk_data_ready uses only one argument])
780 ])
781 EXTRA_KCFLAGS="$tmp_flags"
782 ]) # LN_CONFIG_SK_DATA_READY
783
784 #
785 # LN_EXPORT_KMAP_TO_PAGE
786 #
787 # 3.10 Export kmap_to_page
788 #
789 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
790 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
791         [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
792                 [kmap_to_page is exported by the kernel])])
793 ]) # LN_EXPORT_KMAP_TO_PAG
794
795 #
796 # LN_HAVE_HYPERVISOR_IS_TYPE
797 #
798 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
799 # x86/paravirt: Provide a way to check for hypervisors
800 #
801 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
802 tmp_flags="$EXTRA_KCFLAGS"
803 EXTRA_KCFLAGS="-Werror"
804 LB_CHECK_COMPILE([if hypervisor_is_type function is available],
805 hypervisor_is_type_exists, [
806         #include <asm/hypervisor.h>
807 ],[
808         (void)hypervisor_is_type(X86_HYPER_NATIVE);
809 ],[
810         AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
811                 [hypervisor_is_type function exists])
812 ])
813 EXTRA_KCFLAGS="$tmp_flags"
814 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
815
816 #
817 # LN_HAVE_ORACLE_OFED_EXTENSIONS
818 #
819 # Oracle UEK 5
820 #
821 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
822 LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
823 oracle_ofed_ext, [
824         #include <rdma/ib_fmr_pool.h>
825 ],[
826         struct ib_fmr_pool_param param = {
827                 .relaxed           = 0
828         };
829         (void)param;
830 ],[
831         AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
832                 [if Oracle OFED Extensions are enabled])
833 ])
834 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
835
836 #
837 # LN_CONFIG_SOCK_GETNAME
838 #
839 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
840 # does not take the length *int argument and returns the length
841 #
842 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
843 tmp_flags="$EXTRA_KCFLAGS"
844 EXTRA_KCFLAGS="-Werror"
845 LB_CHECK_COMPILE([if 'getname' has two args],
846 kern_sock_getname_2args, [
847         #include <linux/net.h>
848 ],[
849         kernel_getsockname(NULL, NULL);
850 ],[
851         AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
852                 ['getname' has two args])
853 ])
854 EXTRA_KCFLAGS="$tmp_flags"
855 ]) # LN_CONFIG_SOCK_GETNAME
856
857 #
858 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
859 #
860 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
861 # and kernel 4.18.0-193.el8:
862 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
863 # and removed for_ifa and endfor_ifa.
864 # Use the _rntl variant as the current locking is rtnl.
865 #
866 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
867 tmp_flags="$EXTRA_KCFLAGS"
868 EXTRA_KCFLAGS="-Werror"
869 LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
870 in_dev_for_each_ifa_rtnl_test, [
871         #include <linux/inetdevice.h>
872 ],[
873         const struct in_ifaddr *ifa = NULL;
874         struct in_device *in_dev = NULL;
875
876         in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
877 ],[
878         AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
879                 ['in_dev_for_each_ifa_rtnl' is defined])
880 ])
881 EXTRA_KCFLAGS="$tmp_flags"
882 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
883
884 #
885 # LN_IB_DEVICE_OPS_EXISTS
886 #
887 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
888 # RDMA/core: Introduce ib_device_ops
889 # ... introduces the ib_device_ops structure that defines all the
890 # InfiniBand device operations in one place ...
891 #
892 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
893 tmp_flags="$EXTRA_KCFLAGS"
894 EXTRA_KCFLAGS="-Werror"
895 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
896 ib_device_ops_test, [
897         #include <rdma/ib_verbs.h>
898 ],[
899         int x = offsetof(struct ib_device_ops, unmap_fmr);
900         x = x;
901         (void)x;
902 ],[
903         AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
904                 [if struct ib_device_ops is defined])
905 ])
906 EXTRA_KCFLAGS="$tmp_flags"
907 ]) # LN_IB_DEVICE_OPS_EXISTS
908
909 #
910 # LN_IB_SG_DMA_ADDRESS_EXISTS
911 #
912 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
913 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
914 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
915 #
916 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
917 tmp_flags="$EXTRA_KCFLAGS"
918 EXTRA_KCFLAGS="-Werror"
919 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
920 ib_sg_dma_address_test, [
921         #include <rdma/ib_verbs.h>
922 ],[
923         u64 x = ib_sg_dma_address(NULL, NULL);
924         x = x;
925         (void)x;
926 ],[
927         AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
928                 [if ib_sg_dma_address wrapper exists])
929 ])
930 EXTRA_KCFLAGS="$tmp_flags"
931 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
932
933 #
934 # LN_USR_RDMA
935 #
936 #
937 AC_DEFUN([LN_USR_RDMA], [
938 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
939 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
940         #include <rdma/rdma_user_cm.h>
941
942         int main(void) {
943                 int x = (int)RDMA_PS_TCP;
944                 return x;
945         }
946 ])],[
947         AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
948                 [RDMA_PS_TCP exists])
949 ])
950 ]) # LN_USR_RDMA
951
952
953 AC_DEFUN([LN_PROG_LINUX_SRC], [])
954 AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
955
956 #
957 # LN_PROG_LINUX
958 #
959 # LNet linux kernel checks
960 #
961 AC_DEFUN([LN_PROG_LINUX], [
962 AC_MSG_NOTICE([LNet kernel checks
963 ==============================================================================])
964
965 LN_CONFIG_BACKOFF
966 LN_CONFIG_O2IB
967 LN_CONFIG_GNILND
968 LN_CONFIG_STRSCPY_EXISTS
969 LN_CONFIG_KFILND
970 # 3.10
971 LN_EXPORT_KMAP_TO_PAGE
972 # 3.15
973 LN_CONFIG_SK_DATA_READY
974 # 4.x
975 LN_CONFIG_SOCK_CREATE_KERN
976 # 4.14
977 LN_HAVE_HYPERVISOR_IS_TYPE
978 LN_HAVE_ORACLE_OFED_EXTENSIONS
979 # 4.17
980 LN_CONFIG_SOCK_GETNAME
981 # 5.3 and 4.18.0-193.el8
982 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
983 ]) # LN_PROG_LINUX
984
985 #
986 # LN_PATH_DEFAULTS
987 #
988 # default paths for installed files
989 #
990 AC_DEFUN([LN_PATH_DEFAULTS], [
991 ]) # LN_PATH_DEFAULTS
992
993 #
994 # LN_CONFIGURE
995 #
996 # other configure checks
997 #
998 AC_DEFUN([LN_CONFIGURE], [
999 AC_MSG_NOTICE([LNet core checks
1000 ==============================================================================])
1001
1002 AC_ARG_WITH([cuda],
1003         AS_HELP_STRING([--with-cuda=path],
1004                         [Use a CUDA sources.]),
1005         [LB_ARG_CANON_PATH([cuda], [CUDA_PATH])],
1006         [CUDA_PATH=`ls -d1 /usr/src/nvidia-*/nvidia/ | tail -1`]
1007 )
1008
1009 AC_ARG_WITH([gds],
1010         AS_HELP_STRING([--with-gds=path],
1011                         [Use a gds sources.]),
1012         [LB_ARG_CANON_PATH([gds], [GDS_PATH])],
1013         [GDS_PATH=`ls -d1 /usr/src/nvidia-fs* | tail -1`]
1014 )
1015
1016 AS_IF([test -n "${CUDA_PATH}" && test -n "${GDS_PATH}"],[
1017 LB_CHECK_FILE([$CUDA_PATH/nv-p2p.h],
1018         [
1019         AC_MSG_RESULT([CUDA path is $CUDA_PATH])
1020         AC_SUBST(CUDA_PATH)
1021         ],
1022         [AC_MSG_ERROR([CUDA sources don't found. nv-p2p.h don't exit])]
1023 )
1024
1025 LB_CHECK_FILE([$GDS_PATH/nvfs-dma.h],
1026         [
1027         LB_CHECK_FILE([$GDS_PATH/config-host.h], [
1028         AC_MSG_RESULT([GDS path is $GDS_PATH])
1029         AC_SUBST(GDS_PATH)
1030         AC_DEFINE(WITH_GDS, 1, "GDS build enabled")
1031         ], [])
1032         ],
1033         [])
1034 ],[
1035         AC_MSG_WARN([CUDA or GDS sources not found. GDS support disabled])
1036 ]
1037 )
1038
1039 # lnet/utils/lnetconfig/liblnetconfig_netlink.c
1040 AS_IF([test "x$enable_dist" = xno], [
1041         PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
1042 ])
1043
1044 AC_CHECK_LIB([nl-3], [nla_get_s32], [
1045         AC_DEFINE(HAVE_NLA_GET_S32, 1,
1046                 [libnl3 supports nla_get_s32])
1047         ], [
1048 ])
1049
1050 AC_CHECK_LIB([nl-3], [nla_get_s64], [
1051         AC_DEFINE(HAVE_NLA_GET_S64, 1,
1052                 [libnl3 supports nla_get_s64])
1053         ], [
1054 ])
1055
1056 #
1057 # LN_USR_NLMSGERR
1058 #
1059 AC_DEFUN([LN_USR_NLMSGERR], [
1060 AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
1061 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1062         #include <linux/netlink.h>
1063
1064         int main(void) {
1065                 int x = (int)NLMSGERR_ATTR_MAX;
1066                 return x;
1067         }
1068 ])],[
1069         AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
1070                 ['enum nlmsgerr_attrs' exists])
1071 ])
1072 ]) # LN_USR_NLMGSERR
1073
1074 # lnet/utils/portals.c
1075 AC_CHECK_HEADERS([netdb.h])
1076 AC_CHECK_FUNCS([gethostbyname])
1077
1078 # lnet/utils/wirecheck.c
1079 AC_CHECK_FUNCS([strnlen])
1080
1081 # --------  Check for required packages  --------------
1082
1083 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
1084 AC_ARG_ENABLE(efence,
1085         AS_HELP_STRING([--enable-efence],
1086                 [use efence library]),
1087         [], [enable_efence="no"])
1088 AC_MSG_RESULT([$enable_efence])
1089
1090 LIBEFENCE=""
1091 AS_IF([test "$enable_efence" = yes], [
1092         LIBEFENCE="-lefence"
1093         AC_DEFINE(HAVE_LIBEFENCE, 1,
1094                 [libefence support is requested])
1095 ])
1096 AC_SUBST(LIBEFENCE)
1097
1098 LN_CONFIG_DLC
1099 LN_USR_RDMA
1100 LN_USR_NLMSGERR
1101 ]) # LN_CONFIGURE
1102
1103 #
1104 # LN_CONDITIONALS
1105 #
1106 # AM_CONDITIONAL defines for lnet
1107 #
1108 AC_DEFUN([LN_CONDITIONALS], [
1109 AM_CONDITIONAL(BUILD_O2IBLND,    test x$O2IBLND = "xo2iblnd")
1110 AM_CONDITIONAL(BUILD_GNILND,     test x$GNILND  = "xgnilnd")
1111 AM_CONDITIONAL(BUILD_KFILND,     test x$KFILND  = "xkfilnd")
1112 ]) # LN_CONDITIONALS
1113
1114 #
1115 # LN_CONFIG_FILES
1116 #
1117 # files that should be generated with AC_OUTPUT
1118 #
1119 AC_DEFUN([LN_CONFIG_FILES], [
1120 AC_CONFIG_FILES([
1121 lnet/Makefile
1122 lnet/autoMakefile
1123 lnet/autoconf/Makefile
1124 lnet/doc/Makefile
1125 lnet/include/Makefile
1126 lnet/include/lnet/Makefile
1127 lnet/include/uapi/linux/lnet/Makefile
1128 lnet/klnds/Makefile
1129 lnet/klnds/autoMakefile
1130 lnet/klnds/o2iblnd/Makefile
1131 lnet/klnds/o2iblnd/autoMakefile
1132 lnet/klnds/gnilnd/Makefile
1133 lnet/klnds/gnilnd/autoMakefile
1134 lnet/klnds/socklnd/Makefile
1135 lnet/klnds/socklnd/autoMakefile
1136 lnet/klnds/kfilnd/Makefile
1137 lnet/klnds/kfilnd/autoMakefile
1138 lnet/lnet/Makefile
1139 lnet/lnet/autoMakefile
1140 lnet/selftest/Makefile
1141 lnet/selftest/autoMakefile
1142 lnet/utils/Makefile
1143 lnet/utils/lnetconfig/Makefile
1144 ])
1145 ]) # LN_CONFIG_FILES