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