Whamcloud - gitweb
LU-17744 ldiskfs: mballoc stats fixes
[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         AC_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_SUBST(KFICPPFLAGS)
718 AC_SUBST(KFILND)
719 AC_SUBST(EXTRA_SYMBOLS)
720 ]) # LN_CONFIG_KFILND
721
722 # LN_CONFIG_STRSCPY_EXISTS
723 #
724 # If strscpy exists, prefer it over strlcpy
725 #
726 AC_DEFUN([LN_CONFIG_STRSCPY_EXISTS], [
727 tmp_flags="$EXTRA_KCFLAGS"
728 EXTRA_KCFLAGS="-Werror"
729 LB_CHECK_COMPILE([kernel strscpy is available],
730 strscpy_exists, [
731         #include <linux/string.h>
732 ],[
733         strscpy((char *)NULL, (const char *)NULL, 0);
734 ],[
735         AC_DEFINE(HAVE_STRSCPY, 1,
736                 [kernel strscpy is available])
737 ])
738 EXTRA_KCFLAGS="$tmp_flags"
739 ]) # LN_CONFIG_STRSCPY_EXISTS
740
741 # LN_CONFIG_SOCK_CREATE_KERN
742 #
743 # 4.x sock_create_kern() added a first parameter as 'struct net *'
744 # instead of int.
745 #
746 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
747 tmp_flags="$EXTRA_KCFLAGS"
748 EXTRA_KCFLAGS="-Werror"
749 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
750 sock_create_kern_net, [
751         #include <linux/net.h>
752         #include <net/net_namespace.h>
753 ],[
754         sock_create_kern((struct net*)0, 0, 0, 0, NULL);
755 ],[
756         AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
757                 [sock_create_kern use net as first parameter])
758 ])
759 EXTRA_KCFLAGS="$tmp_flags"
760 ]) # LN_CONFIG_SOCK_CREATE_KERN
761
762 #
763 # LN_CONFIG_SK_DATA_READY
764 #
765 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
766 #
767 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
768 tmp_flags="$EXTRA_KCFLAGS"
769 EXTRA_KCFLAGS="-Werror"
770 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
771 sk_data_ready, [
772         #include <linux/net.h>
773         #include <net/sock.h>
774 ],[
775         ((struct sock *)0)->sk_data_ready(NULL);
776 ],[
777         AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
778                 [sk_data_ready uses only one argument])
779 ])
780 EXTRA_KCFLAGS="$tmp_flags"
781 ]) # LN_CONFIG_SK_DATA_READY
782
783 #
784 # LN_EXPORT_KMAP_TO_PAGE
785 #
786 # 3.10 Export kmap_to_page
787 #
788 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
789 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
790         [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
791                 [kmap_to_page is exported by the kernel])])
792 ]) # LN_EXPORT_KMAP_TO_PAG
793
794 #
795 # LN_HAVE_HYPERVISOR_IS_TYPE
796 #
797 # 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
798 # x86/paravirt: Provide a way to check for hypervisors
799 #
800 AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
801 tmp_flags="$EXTRA_KCFLAGS"
802 EXTRA_KCFLAGS="-Werror"
803 LB_CHECK_COMPILE([if hypervisor_is_type function is available],
804 hypervisor_is_type_exists, [
805         #include <asm/hypervisor.h>
806 ],[
807         (void)hypervisor_is_type(X86_HYPER_NATIVE);
808 ],[
809         AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
810                 [hypervisor_is_type function exists])
811 ])
812 EXTRA_KCFLAGS="$tmp_flags"
813 ]) # LN_HAVE_HYPERVISOR_IS_TYPE
814
815 #
816 # LN_HAVE_ORACLE_OFED_EXTENSIONS
817 #
818 # Oracle UEK 5
819 #
820 AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
821 LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
822 oracle_ofed_ext, [
823         #include <rdma/ib_fmr_pool.h>
824 ],[
825         struct ib_fmr_pool_param param = {
826                 .relaxed           = 0
827         };
828         (void)param;
829 ],[
830         AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
831                 [if Oracle OFED Extensions are enabled])
832 ])
833 ]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
834
835 #
836 # LN_CONFIG_SOCK_GETNAME
837 #
838 # 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
839 # does not take the length *int argument and returns the length
840 #
841 AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
842 tmp_flags="$EXTRA_KCFLAGS"
843 EXTRA_KCFLAGS="-Werror"
844 LB_CHECK_COMPILE([if 'getname' has two args],
845 kern_sock_getname_2args, [
846         #include <linux/net.h>
847 ],[
848         kernel_getsockname(NULL, NULL);
849 ],[
850         AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
851                 ['getname' has two args])
852 ])
853 EXTRA_KCFLAGS="$tmp_flags"
854 ]) # LN_CONFIG_SOCK_GETNAME
855
856 #
857 # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
858 #
859 # kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
860 # and kernel 4.18.0-193.el8:
861 # added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
862 # and removed for_ifa and endfor_ifa.
863 # Use the _rntl variant as the current locking is rtnl.
864 #
865 AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
866 tmp_flags="$EXTRA_KCFLAGS"
867 EXTRA_KCFLAGS="-Werror"
868 LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
869 in_dev_for_each_ifa_rtnl_test, [
870         #include <linux/inetdevice.h>
871 ],[
872         const struct in_ifaddr *ifa = NULL;
873         struct in_device *in_dev = NULL;
874
875         in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
876 ],[
877         AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
878                 ['in_dev_for_each_ifa_rtnl' is defined])
879 ])
880 EXTRA_KCFLAGS="$tmp_flags"
881 ]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
882
883 #
884 # LN_IB_DEVICE_OPS_EXISTS
885 #
886 # kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
887 # RDMA/core: Introduce ib_device_ops
888 # ... introduces the ib_device_ops structure that defines all the
889 # InfiniBand device operations in one place ...
890 #
891 AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
892 tmp_flags="$EXTRA_KCFLAGS"
893 EXTRA_KCFLAGS="-Werror"
894 LB_CHECK_COMPILE([if struct ib_device_ops is defined],
895 ib_device_ops_test, [
896         #include <rdma/ib_verbs.h>
897 ],[
898         int x = offsetof(struct ib_device_ops, unmap_fmr);
899         x = x;
900         (void)x;
901 ],[
902         AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
903                 [if struct ib_device_ops is defined])
904 ])
905 EXTRA_KCFLAGS="$tmp_flags"
906 ]) # LN_IB_DEVICE_OPS_EXISTS
907
908 #
909 # LN_IB_SG_DMA_ADDRESS_EXISTS
910 #
911 # kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
912 # IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
913 # ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
914 #
915 AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
916 tmp_flags="$EXTRA_KCFLAGS"
917 EXTRA_KCFLAGS="-Werror"
918 LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
919 ib_sg_dma_address_test, [
920         #include <rdma/ib_verbs.h>
921 ],[
922         u64 x = ib_sg_dma_address(NULL, NULL);
923         x = x;
924         (void)x;
925 ],[
926         AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
927                 [if ib_sg_dma_address wrapper exists])
928 ])
929 EXTRA_KCFLAGS="$tmp_flags"
930 ]) # LN_IB_SG_DMA_ADDRESS_EXISTS
931
932 #
933 # LN_USR_RDMA
934 #
935 #
936 AC_DEFUN([LN_USR_RDMA], [
937 AC_MSG_CHECKING([if RDMA_PS_TCP exists])
938 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
939         #include <rdma/rdma_user_cm.h>
940
941         int main(void) {
942                 int x = (int)RDMA_PS_TCP;
943                 return x;
944         }
945 ])],[
946         AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
947                 [RDMA_PS_TCP exists])
948 ])
949 ]) # LN_USR_RDMA
950
951
952 AC_DEFUN([LN_PROG_LINUX_SRC], [])
953 AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
954
955 #
956 # LN_PROG_LINUX
957 #
958 # LNet linux kernel checks
959 #
960 AC_DEFUN([LN_PROG_LINUX], [
961 AC_MSG_NOTICE([LNet kernel checks
962 ==============================================================================])
963
964 LN_CONFIG_BACKOFF
965 LN_CONFIG_O2IB
966 LN_CONFIG_GNILND
967 LN_CONFIG_STRSCPY_EXISTS
968 LN_CONFIG_KFILND
969 # 3.10
970 LN_EXPORT_KMAP_TO_PAGE
971 # 3.15
972 LN_CONFIG_SK_DATA_READY
973 # 4.x
974 LN_CONFIG_SOCK_CREATE_KERN
975 # 4.14
976 LN_HAVE_HYPERVISOR_IS_TYPE
977 LN_HAVE_ORACLE_OFED_EXTENSIONS
978 # 4.17
979 LN_CONFIG_SOCK_GETNAME
980 # 5.3 and 4.18.0-193.el8
981 LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
982 ]) # LN_PROG_LINUX
983
984 #
985 # LN_PATH_DEFAULTS
986 #
987 # default paths for installed files
988 #
989 AC_DEFUN([LN_PATH_DEFAULTS], [
990 ]) # LN_PATH_DEFAULTS
991
992 #
993 # LN_CONFIGURE
994 #
995 # other configure checks
996 #
997 AC_DEFUN([LN_CONFIGURE], [
998 AC_MSG_NOTICE([LNet core checks
999 ==============================================================================])
1000
1001 AC_ARG_WITH([cuda],
1002         AS_HELP_STRING([--with-cuda=path],
1003                         [Use a CUDA sources.]),
1004         [LB_ARG_CANON_PATH([cuda], [CUDA_PATH])],
1005         [CUDA_PATH=`ls -d1 /usr/src/nvidia-*/nvidia/ | tail -1`]
1006 )
1007
1008 AC_ARG_WITH([gds],
1009         AS_HELP_STRING([--with-gds=path],
1010                         [Use a gds sources.]),
1011         [LB_ARG_CANON_PATH([gds], [GDS_PATH])],
1012         [GDS_PATH=`ls -d1 /usr/src/nvidia-fs* | tail -1`]
1013 )
1014
1015 AS_IF([test -n "${CUDA_PATH}" && test -n "${GDS_PATH}"],[
1016 LB_CHECK_FILE([$CUDA_PATH/nv-p2p.h],
1017         [
1018         AC_MSG_RESULT([CUDA path is $CUDA_PATH])
1019         AC_SUBST(CUDA_PATH)
1020         ],
1021         [AC_MSG_ERROR([CUDA sources don't found. nv-p2p.h don't exit])]
1022 )
1023
1024 LB_CHECK_FILE([$GDS_PATH/nvfs-dma.h],
1025         [
1026         LB_CHECK_FILE([$GDS_PATH/config-host.h], [
1027         AC_MSG_RESULT([GDS path is $GDS_PATH])
1028         AC_SUBST(GDS_PATH)
1029         AC_DEFINE(WITH_GDS, 1, "GDS build enabled")
1030         ], [])
1031         ],
1032         [])
1033 ],[
1034         AC_MSG_WARN([CUDA or GDS sources not found. GDS support disabled])
1035 ]
1036 )
1037
1038 # lnet/utils/lnetconfig/liblnetconfig_netlink.c
1039 AS_IF([test "x$enable_dist" = xno], [
1040         PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
1041 ])
1042
1043 AC_CHECK_LIB([nl-3], [nla_get_s32], [
1044         AC_DEFINE(HAVE_NLA_GET_S32, 1,
1045                 [libnl3 supports nla_get_s32])
1046         ], [
1047 ])
1048
1049 AC_CHECK_LIB([nl-3], [nla_get_s64], [
1050         AC_DEFINE(HAVE_NLA_GET_S64, 1,
1051                 [libnl3 supports nla_get_s64])
1052         ], [
1053 ])
1054
1055 #
1056 # LN_USR_NLMSGERR
1057 #
1058 AC_DEFUN([LN_USR_NLMSGERR], [
1059 AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
1060 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1061         #include <linux/netlink.h>
1062
1063         int main(void) {
1064                 int x = (int)NLMSGERR_ATTR_MAX;
1065                 return x;
1066         }
1067 ])],[
1068         AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
1069                 ['enum nlmsgerr_attrs' exists])
1070 ])
1071 ]) # LN_USR_NLMGSERR
1072
1073 # lnet/utils/portals.c
1074 AC_CHECK_HEADERS([netdb.h])
1075 AC_CHECK_FUNCS([gethostbyname])
1076
1077 # lnet/utils/wirecheck.c
1078 AC_CHECK_FUNCS([strnlen])
1079
1080 # --------  Check for required packages  --------------
1081
1082 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
1083 AC_ARG_ENABLE(efence,
1084         AS_HELP_STRING([--enable-efence],
1085                 [use efence library]),
1086         [], [enable_efence="no"])
1087 AC_MSG_RESULT([$enable_efence])
1088
1089 LIBEFENCE=""
1090 AS_IF([test "$enable_efence" = yes], [
1091         LIBEFENCE="-lefence"
1092         AC_DEFINE(HAVE_LIBEFENCE, 1,
1093                 [libefence support is requested])
1094 ])
1095 AC_SUBST(LIBEFENCE)
1096
1097 LN_CONFIG_DLC
1098 LN_USR_RDMA
1099 LN_USR_NLMSGERR
1100 ]) # LN_CONFIGURE
1101
1102 #
1103 # LN_CONDITIONALS
1104 #
1105 # AM_CONDITIONAL defines for lnet
1106 #
1107 AC_DEFUN([LN_CONDITIONALS], [
1108 AM_CONDITIONAL(BUILD_O2IBLND,    test x$O2IBLND = "xo2iblnd")
1109 AM_CONDITIONAL(BUILD_GNILND,     test x$GNILND  = "xgnilnd")
1110 AM_CONDITIONAL(BUILD_KFILND,     test x$KFILND  = "xkfilnd")
1111 ]) # LN_CONDITIONALS
1112
1113 #
1114 # LN_CONFIG_FILES
1115 #
1116 # files that should be generated with AC_OUTPUT
1117 #
1118 AC_DEFUN([LN_CONFIG_FILES], [
1119 AC_CONFIG_FILES([
1120 lnet/Makefile
1121 lnet/autoMakefile
1122 lnet/autoconf/Makefile
1123 lnet/doc/Makefile
1124 lnet/include/Makefile
1125 lnet/include/lnet/Makefile
1126 lnet/include/uapi/linux/lnet/Makefile
1127 lnet/klnds/Makefile
1128 lnet/klnds/autoMakefile
1129 lnet/klnds/o2iblnd/Makefile
1130 lnet/klnds/o2iblnd/autoMakefile
1131 lnet/klnds/gnilnd/Makefile
1132 lnet/klnds/gnilnd/autoMakefile
1133 lnet/klnds/socklnd/Makefile
1134 lnet/klnds/socklnd/autoMakefile
1135 lnet/klnds/kfilnd/Makefile
1136 lnet/klnds/kfilnd/autoMakefile
1137 lnet/lnet/Makefile
1138 lnet/lnet/autoMakefile
1139 lnet/selftest/Makefile
1140 lnet/selftest/autoMakefile
1141 lnet/utils/Makefile
1142 lnet/utils/lnetconfig/Makefile
1143 ])
1144 ]) # LN_CONFIG_FILES