4 # Check compiler version
6 AC_DEFUN([LN_CHECK_GCC_VERSION], [
7 AC_MSG_CHECKING([compiler version])
8 PTL_CC_VERSION=`$CC --version | awk '/^gcc/{print $ 3}'`
9 PTL_MIN_CC_VERSION="3.2.2"
11 awk -F. '{printf "%d\n", (($ 1)*100+($ 2))*100+($ 3)}'
13 if test -z "$PTL_CC_VERSION" -o \
14 $(echo $PTL_CC_VERSION | v2n) -ge $(echo $PTL_MIN_CC_VERSION | v2n); then
17 AC_MSG_RESULT([Buggy compiler found])
18 AC_MSG_ERROR([Need gcc version >= $PTL_MIN_CC_VERSION])
20 ]) # LN_CHECK_GCC_VERSION
25 # check if cpu affinity is available/wanted
27 AC_DEFUN([LN_CONFIG_AFFINITY], [
28 AC_MSG_CHECKING([whether to enable CPU affinity support])
29 AC_ARG_ENABLE([affinity],
30 AC_HELP_STRING([--disable-affinity],
31 [disable process/irq affinity]),
32 [], [enable_affinity="yes"])
33 AC_MSG_RESULT([$enable_affinity])
34 AS_IF([test "x$enable_affinity" = xyes], [
35 LB_CHECK_COMPILE([if Linux kernel has cpu affinity support],
36 set_cpus_allowed_ptr, [
37 #include <linux/sched.h>
39 struct task_struct *t = NULL;
42 set_cpus_allowed_ptr(t, &m);
44 AC_DEFINE(CPU_AFFINITY, 1,
45 [kernel has cpu affinity support])
48 ]) # LN_CONFIG_AFFINITY
53 # check if tunable tcp backoff is available/wanted
55 AC_DEFUN([LN_CONFIG_BACKOFF], [
56 AC_MSG_CHECKING([whether to enable tunable backoff TCP support])
57 AC_ARG_ENABLE([backoff],
58 AC_HELP_STRING([--disable-backoff],
59 [disable socknal tunable backoff]),
60 [], [enable_backoff="yes"])
61 AC_MSG_RESULT([$enable_backoff])
62 AS_IF([test "x$enable_backoff" = xyes], [
63 AC_MSG_CHECKING([if Linux kernel has tunable backoff TCP support])
64 AS_IF([grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h >/dev/null], [
66 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
67 AS_IF([grep rto_max $LINUX/include/linux/tcp.h | grep -q __u16 >/dev/null],
68 [AC_DEFINE(SOCKNAL_BACKOFF_MS, 1,
69 [tunable backoff TCP in ms])])
74 ]) # LN_CONFIG_BACKOFF
81 # fail to build if libyaml is not installed
83 AC_DEFUN([LN_CONFIG_DLC], [
84 AC_CHECK_LIB([yaml], [yaml_parser_initialize],
86 [AC_MSG_ERROR([YAML development libraries not not installed])],
93 # If current OFED installed (assume with "ofed_info") and devel
94 # headers are not found, error because we assume OFED infiniband
95 # driver needs to be used and we must configure/build with it.
96 # Current OFED headers detection mechanism allow for non-standard
97 # prefix but relies on "ofed_info" command and on "%prefix/openib"
98 # link (both are ok for 1.5.x and 3.x versions), and should work
99 # for both source and DKMS builds.
101 AC_DEFUN([LN_CONFIG_O2IB], [
102 AC_MSG_CHECKING([whether to use Compat RDMA])
104 AC_HELP_STRING([--with-o2ib=[yes|no|<path>]],
105 [build o2iblnd against path]),
106 [], [with_o2ib="yes"])
109 yes) AS_IF([which ofed_info 2>/dev/null], [
110 AS_IF([test x$uses_dpkg = xyes], [
111 OFED_INFO="ofed_info | awk '{print \[$]2}'"
112 LSPKG="dpkg --listfiles"
114 OFED_INFO="ofed_info"
117 O2IBPATHS=$(eval $OFED_INFO | egrep -w 'mlnx-ofed-kernel-dkms|mlnx-ofa_kernel-devel|compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' | xargs $LSPKG | grep '\(/openib\|/ofa_kernel/default\|/ofa_kernel\)$' | head -n1)
118 AS_IF([test -z "$O2IBPATHS"], [
120 You seem to have an OFED installed but have not installed it's devel package.
121 If you still want to build Lustre for your OFED I/B stack, you need to install its devel headers RPM.
122 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.
125 AS_IF([test $(echo $O2IBPATHS | wc -w) -ge 2], [
127 It appears that you have multiple OFED versions installed.
128 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.
129 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.
132 if test -e $O2IBPATHS/${LINUXRELEASE}; then
133 O2IBPATHS=$O2IBPATHS/${LINUXRELEASE}
134 elif test -e $O2IBPATHS/default; then
135 O2IBPATHS=$O2IBPATHS/default
139 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
145 *) O2IBPATHS=$with_o2ib
146 ENABLEO2IB="withpath"
151 AS_IF([test $ENABLEO2IB = "no"], [
155 for O2IBPATH in $O2IBPATHS; do
156 AS_IF([test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
157 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
158 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
159 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \)], [
164 if ! $o2ib_found; then
167 "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;;
168 "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
169 *) AC_MSG_ERROR([internal error]) ;;
173 compatrdma_found=false
174 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
176 compatrdma_found=true
177 AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
178 EXTRA_OFED_CONFIG="$EXTRA_OFED_CONFIG -include ${O2IBPATH}/include/linux/compat-2.6.h"
179 if test -f "$O2IBPATH/include/linux/compat_autoconf.h"; then
180 COMPAT_AUTOCONF="$O2IBPATH/include/linux/compat_autoconf.h"
185 if ! $compatrdma_found; then
186 if test -f "$O2IBPATH/config.mk"; then
187 . "$O2IBPATH/config.mk"
188 elif test -f "$O2IBPATH/ofed_patch.mk"; then
189 . "$O2IBPATH/ofed_patch.mk"
191 elif test -z "$COMPAT_AUTOCONF"; then
193 if test "x$RHEL_KERNEL" = xyes; then
194 RHEL_MAJOR=$(awk '/ RHEL_MAJOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
195 I=$(awk '/ RHEL_MINOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
196 while test "$I" -ge 0; do
197 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_${RHEL_MAJOR}_$I"
200 elif test "x$SUSE_KERNEL" = xyes; then
201 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
202 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
206 AC_MSG_CHECKING([whether to use any OFED backport headers])
207 if test -n "$BACKPORT_INCLUDES"; then
209 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
210 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
216 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
217 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include -I$O2IBPATH/include/uapi"
218 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
219 LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
220 openib_gen2_support, [
221 #ifdef HAVE_COMPAT_RDMA
223 #undef PACKAGE_TARNAME
224 #undef PACKAGE_VERSION
225 #undef PACKAGE_STRING
226 #undef PACKAGE_BUGREPORT
228 #include <linux/compat-2.6.h>
230 #include <linux/version.h>
231 #include <linux/pci.h>
232 #include <linux/gfp.h>
233 #include <rdma/rdma_cm.h>
234 #include <rdma/ib_cm.h>
235 #include <rdma/ib_verbs.h>
236 #include <rdma/ib_fmr_pool.h>
238 struct rdma_cm_id *cm_idi __attribute__ ((unused));
239 struct rdma_conn_param conn_param __attribute__ ((unused));
240 struct ib_device_attr device_attr __attribute__ ((unused));
241 struct ib_qp_attr qp_attr __attribute__ ((unused));
242 struct ib_pool_fmr pool_fmr __attribute__ ((unused));
243 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
244 rdma_destroy_id(NULL);
249 "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
250 "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
251 *) AC_MSG_ERROR([internal error]) ;;
254 # we know at this point that the found OFED source is good
256 if test $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then
257 if test -f $O2IBPATH/Module.symvers; then
258 O2IB_SYMVER=$O2IBPATH/Module.symvers;
261 if test -n "$O2IB_SYMVER"; then
262 AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path])
263 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER"
264 AC_SUBST(EXTRA_SYMBOLS)
266 AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
270 LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
271 linux_kthread_worker, [
272 #ifdef HAVE_COMPAT_RDMA
274 #undef PACKAGE_TARNAME
275 #undef PACKAGE_VERSION
276 #undef PACKAGE_STRING
277 #undef PACKAGE_BUGREPORT
279 #include <linux/compat-2.6.h>
281 #include <linux/kthread.h>
283 struct kthread_work *kth_wrk = NULL;
284 flush_kthread_work(kth_wrk);
286 AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
287 if test -z "$COMPAT_AUTOCONF"; then
288 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
291 EXTRA_CHECK_INCLUDE=""
294 AC_SUBST(EXTRA_OFED_CONFIG)
295 AC_SUBST(EXTRA_OFED_INCLUDE)
300 AS_IF([test $ENABLEO2IB != "no"], [
301 EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
303 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
304 LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
305 rdma_create_id_4args, [
306 #ifdef HAVE_COMPAT_RDMA
308 #undef PACKAGE_TARNAME
309 #undef PACKAGE_VERSION
310 #undef PACKAGE_STRING
311 #undef PACKAGE_BUGREPORT
313 #include <linux/compat-2.6.h>
315 #include <rdma/rdma_cm.h>
317 rdma_create_id(NULL, NULL, 0, 0);
319 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
320 [rdma_create_id wants 4 args])
323 # 4.4 added network namespace parameter for rdma_create_id()
324 LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
325 rdma_create_id_5args, [
326 #ifdef HAVE_COMPAT_RDMA
328 #undef PACKAGE_TARNAME
329 #undef PACKAGE_VERSION
330 #undef PACKAGE_STRING
331 #undef PACKAGE_BUGREPORT
333 #include <linux/compat-2.6.h>
335 #include <rdma/rdma_cm.h>
337 rdma_create_id(NULL, NULL, NULL, 0, 0);
339 AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
340 [rdma_create_id wants 5 args])
343 # 4.2 introduced struct ib_cq_init_attr which is used
344 # by ib_create_cq(). Note some OFED stacks only keep
345 # their headers in sync with latest kernels but not
346 # the functionality which means for infiniband testing
347 # we need to always test functionality testings.
348 LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
350 #ifdef HAVE_COMPAT_RDMA
352 #undef PACKAGE_TARNAME
353 #undef PACKAGE_VERSION
354 #undef PACKAGE_STRING
355 #undef PACKAGE_BUGREPORT
357 #include <linux/compat-2.6.h>
359 #include <rdma/ib_verbs.h>
361 struct ib_cq_init_attr cq_attr;
363 ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
365 AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
366 [struct ib_cq_init_attr is used by ib_create_cq])
369 # 4.3 removed ib_alloc_fast_reg_mr()
370 LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
371 ib_alloc_fast_reg_mr, [
372 #ifdef HAVE_COMPAT_RDMA
374 #undef PACKAGE_TARNAME
375 #undef PACKAGE_VERSION
376 #undef PACKAGE_STRING
377 #undef PACKAGE_BUGREPORT
379 #include <linux/compat-2.6.h>
381 #include <rdma/ib_verbs.h>
383 ib_alloc_fast_reg_mr(NULL, 0);
385 AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
386 [ib_alloc_fast_reg_mr is defined])
389 # 4.9 must stop using ib_get_dma_mr and the global MR
390 # We then have to use FMR/Fastreg for all RDMA.
391 LB_CHECK_COMPILE([if 'ib_get_dma_mr' exists],
393 #ifdef HAVE_COMPAT_RDMA
395 #undef PACKAGE_TARNAME
396 #undef PACKAGE_VERSION
397 #undef PACKAGE_STRING
398 #undef PACKAGE_BUGREPORT
400 #include <linux/compat-2.6.h>
402 #include <rdma/ib_verbs.h>
404 ib_get_dma_mr(NULL, 0);
406 AC_DEFINE(HAVE_IB_GET_DMA_MR, 1,
407 [ib_get_dma_mr is defined])
410 # In v4.4 Linux kernel,
411 # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
412 # split up struct ib_send_wr so that all non-trivial verbs
413 # use their own structure which embedds struct ib_send_wr.
414 LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
416 #ifdef HAVE_COMPAT_RDMA
418 #undef PACKAGE_TARNAME
419 #undef PACKAGE_VERSION
420 #undef PACKAGE_STRING
421 #undef PACKAGE_BUGREPORT
423 #include <linux/compat-2.6.h>
425 #include <rdma/ib_verbs.h>
427 struct ib_rdma_wr *wr __attribute__ ((unused));
431 AC_DEFINE(HAVE_IB_RDMA_WR, 1,
432 [struct ib_rdma_wr is defined])
435 # new fast registration API introduced in 4.4
436 LB_CHECK_COMPILE([if 4arg 'ib_map_mr_sg' exists],
437 ib_map_mr_sg_4args, [
438 #ifdef HAVE_COMPAT_RDMA
440 #undef PACKAGE_TARNAME
441 #undef PACKAGE_VERSION
442 #undef PACKAGE_STRING
443 #undef PACKAGE_BUGREPORT
445 #include <linux/compat-2.6.h>
447 #include <rdma/ib_verbs.h>
449 ib_map_mr_sg(NULL, NULL, 0, 0);
451 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
452 [ib_map_mr_sg exists])
455 # ib_map_mr_sg changes from 4 to 5 args (adding sg_offset_p)
456 # in kernel 4.7 (and RHEL 7.3)
457 LB_CHECK_COMPILE([if 5arg 'ib_map_mr_sg' exists],
458 ib_map_mr_sg_5args, [
459 #ifdef HAVE_COMPAT_RDMA
461 #undef PACKAGE_TARNAME
462 #undef PACKAGE_VERSION
463 #undef PACKAGE_STRING
464 #undef PACKAGE_BUGREPORT
466 #include <linux/compat-2.6.h>
468 #include <rdma/ib_verbs.h>
470 ib_map_mr_sg(NULL, NULL, 0, NULL, 0);
472 AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
473 [ib_map_mr_sg exists])
474 AC_DEFINE(HAVE_IB_MAP_MR_SG_5ARGS, 1,
475 [ib_map_mr_sg has 5 arguments])
478 # ib_query_device() removed in 4.5
479 LB_CHECK_COMPILE([if 'struct ib_device' has member 'attrs'],
481 #ifdef HAVE_COMPAT_RDMA
483 #undef PACKAGE_TARNAME
484 #undef PACKAGE_VERSION
485 #undef PACKAGE_STRING
486 #undef PACKAGE_BUGREPORT
488 #include <linux/compat-2.6.h>
490 #include <rdma/ib_verbs.h>
492 struct ib_device dev;
493 struct ib_device_attr dev_attr = {};
494 dev.attrs = dev_attr;
496 AC_DEFINE(HAVE_IB_DEVICE_ATTRS, 1,
497 [struct ib_device.attrs is defined])
500 # A flags argument was added to ib_alloc_pd() in Linux 4.9,
501 # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
502 LB_CHECK_COMPILE([if 2arg 'ib_alloc_pd' exists],
504 #ifdef HAVE_COMPAT_RDMA
506 #undef PACKAGE_TARNAME
507 #undef PACKAGE_VERSION
508 #undef PACKAGE_STRING
509 #undef PACKAGE_BUGREPORT
511 #include <linux/compat-2.6.h>
513 #include <rdma/ib_verbs.h>
515 ib_alloc_pd(NULL, 0);
517 AC_DEFINE(HAVE_IB_ALLOC_PD_2ARGS, 1,
518 [ib_alloc_pd has 2 arguments])
521 LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
523 #ifdef HAVE_COMPAT_RDMA
525 #undef PACKAGE_TARNAME
526 #undef PACKAGE_VERSION
527 #undef PACKAGE_STRING
528 #undef PACKAGE_BUGREPORT
530 #include <linux/compat-2.6.h>
532 #include <rdma/ib_verbs.h>
534 (void)ib_inc_rkey(0);
536 AC_DEFINE(HAVE_IB_INC_RKEY, 1,
537 [function ib_inc_rkey exist])
540 # In MOFED 4.6, the second and third parameters for
541 # ib_post_send() and ib_post_recv() are declared with
543 tmp_flags="$EXTRA_KCFLAGS"
544 EXTRA_KCFLAGS="-Werror"
545 LB_CHECK_COMPILE([if 'ib_post_send() and ib_post_recv()' have const parameters],
546 ib_post_send_recv_const, [
547 #ifdef HAVE_COMPAT_RDMA
549 #undef PACKAGE_TARNAME
550 #undef PACKAGE_VERSION
551 #undef PACKAGE_STRING
552 #undef PACKAGE_BUGREPORT
554 #include <linux/compat-2.6.h>
556 #include <rdma/ib_verbs.h>
558 ib_post_send(NULL, (const struct ib_send_wr *)NULL,
559 (const struct ib_send_wr **)NULL);
561 AC_DEFINE(HAVE_IB_POST_SEND_RECV_CONST, 1,
562 [ib_post_send and ib_post_recv have const parameters])
564 EXTRA_KCFLAGS="$tmp_flags"
566 EXTRA_CHECK_INCLUDE=""
567 ]) # ENABLEO2IB != "no"
573 # check whether to use the Gemini Network Interface lnd
575 AC_DEFUN([LN_CONFIG_GNILND], [
576 AC_MSG_CHECKING([whether to enable GNI lnd])
578 AC_HELP_STRING([--enable-gni],
580 [], [enable_gni="no"])
581 AC_MSG_RESULT([$enable_gni])
583 AS_IF([test "x$enable_gni" = xyes], [
584 # GNICPPFLAGS was set in spec file
585 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
586 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
587 LB_CHECK_COMPILE([if GNI kernel headers are present],
589 #include <linux/types.h>
592 gni_cdm_handle_t kgni_domain;
595 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
596 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
601 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
603 # at this point, we have gnilnd basic support,
604 # now check for extra features
605 LB_CHECK_COMPILE([to use RCA in gnilnd],
607 #include <linux/types.h>
609 #include <krca_lib.h>
611 gni_cdm_handle_t kgni_domain;
613 krca_ticket_t ticket = KRCA_NULL_TICKET;
615 __u32 nid = 0, nic_addr;
616 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
617 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
618 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
619 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
622 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
624 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
626 AC_SUBST(GNICPPFLAGS)
628 ]) # LN_CONFIG_GNILND
633 # 2.6.35 kernel has sk_sleep function
635 AC_DEFUN([LN_CONFIG_SK_SLEEP], [
636 LB_CHECK_COMPILE([if Linux kernel has 'sk_sleep'],
638 #include <net/sock.h>
642 AC_DEFINE(HAVE_SK_SLEEP, 1,
643 [kernel has sk_sleep])
645 ]) # LN_CONFIG_SK_SLEEP
648 # LN_CONFIG_TCP_SENDPAGE
650 # 2.6.36 tcp_sendpage() first parameter is 'struct sock'
651 # instead of 'struct socket'.
653 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE], [
654 tmp_flags="$EXTRA_KCFLAGS"
655 EXTRA_KCFLAGS="-Werror"
656 LB_CHECK_COMPILE([if 'tcp_sendpage' first parameter is socket],
657 tcp_sendpage_socket, [
658 #include <linux/net.h>
661 tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
663 AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
664 [tcp_sendpage use socket as first parameter])
666 EXTRA_KCFLAGS="$tmp_flags"
667 ]) # LN_CONFIG_TCP_SENDPAGE
669 # LN_CONFIG_SOCK_CREATE_KERN
671 # 4.x sock_create_kern() added a first parameter as 'struct net *'
674 AC_DEFUN([LN_CONFIG_SOCK_CREATE_KERN], [
675 tmp_flags="$EXTRA_KCFLAGS"
676 EXTRA_KCFLAGS="-Werror"
677 LB_CHECK_COMPILE([if 'sock_create_kern' first parameter is net],
678 sock_create_kern_net, [
679 #include <linux/net.h>
680 #include <net/net_namespace.h>
682 sock_create_kern((struct net*)0, 0, 0, 0, NULL);
684 AC_DEFINE(HAVE_SOCK_CREATE_KERN_USE_NET, 1,
685 [sock_create_kern use net as first parameter])
687 EXTRA_KCFLAGS="$tmp_flags"
688 ]) # LN_CONFIG_SOCK_CREATE_KERN
691 # LN_CONFIG_SK_DATA_READY
693 # 3.15 for struct sock the *sk_data_ready() field only takes one argument now
695 AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
696 tmp_flags="$EXTRA_KCFLAGS"
697 EXTRA_KCFLAGS="-Werror"
698 LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
700 #include <linux/net.h>
701 #include <net/sock.h>
703 ((struct sock *)0)->sk_data_ready(NULL);
705 AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
706 [sk_data_ready uses only one argument])
708 EXTRA_KCFLAGS="$tmp_flags"
709 ]) # LN_CONFIG_SK_DATA_READY
712 # LN_EXPORT_KMAP_TO_PAGE
714 # 3.10 Export kmap_to_page
716 AC_DEFUN([LN_EXPORT_KMAP_TO_PAGE], [
717 LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
718 [AC_DEFINE(HAVE_KMAP_TO_PAGE, 1,
719 [kmap_to_page is exported by the kernel])])
720 ]) # LN_EXPORT_KMAP_TO_PAG
723 # LN_CONFIG_SOCK_ACCEPT
725 # 4.11 commit cdfbabfb2f0ce983fdaa42f20e5f7842178fc01e added a flag
726 # to handle a possible lockdep condition kernel socket accept.
728 AC_DEFUN([LN_CONFIG_SOCK_ACCEPT], [
729 tmp_flags="$EXTRA_KCFLAGS"
730 EXTRA_KCFLAGS="-Werror"
731 LB_CHECK_COMPILE([if 'struct sock' accept function requires a bool argument],
733 #include <linux/net.h>
735 ((struct socket *)0)->ops->accept(NULL, NULL, O_NONBLOCK, false);
737 AC_DEFINE(HAVE_KERN_SOCK_ACCEPT_FLAG_ARG, 1,
738 ['struct sock' accept function requires bool argument])
740 EXTRA_KCFLAGS="$tmp_flags"
741 ]) # LN_CONFIG_SOCK_ACCEPT
746 # LNet linux kernel checks
748 AC_DEFUN([LN_PROG_LINUX], [
749 AC_MSG_NOTICE([LNet kernel checks
750 ==============================================================================])
759 LN_CONFIG_TCP_SENDPAGE
761 LN_EXPORT_KMAP_TO_PAGE
763 LN_CONFIG_SK_DATA_READY
765 LN_CONFIG_SOCK_CREATE_KERN
767 LN_CONFIG_SOCK_ACCEPT
773 # default paths for installed files
775 AC_DEFUN([LN_PATH_DEFAULTS], [
776 ]) # LN_PATH_DEFAULTS
781 # other configure checks
783 AC_DEFUN([LN_CONFIGURE], [
784 AC_MSG_NOTICE([LNet core checks
785 ==============================================================================])
787 # lnet/utils/portals.c
788 AC_CHECK_HEADERS([netdb.h])
789 AC_CHECK_FUNCS([gethostbyname])
791 # lnet/utils/wirecheck.c
792 AC_CHECK_FUNCS([strnlen])
794 # -------- Check for required packages --------------
796 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
797 AC_ARG_ENABLE(efence,
798 AC_HELP_STRING([--enable-efence],
799 [use efence library]),
800 [], [enable_efence="no"])
801 AC_MSG_RESULT([$enable_efence])
804 AS_IF([test "$enable_efence" = yes], [
806 AC_DEFINE(HAVE_LIBEFENCE, 1,
807 [libefence support is requested])
817 # AM_CONDITIONAL defines for lnet
819 AC_DEFUN([LN_CONDITIONALS], [
820 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
821 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
827 # files that should be generated with AC_OUTPUT
829 AC_DEFUN([LN_CONFIG_FILES], [
833 lnet/autoconf/Makefile
835 lnet/include/Makefile
836 lnet/include/lnet/Makefile
837 lnet/include/uapi/linux/lnet/Makefile
839 lnet/klnds/autoMakefile
840 lnet/klnds/o2iblnd/Makefile
841 lnet/klnds/o2iblnd/autoMakefile
842 lnet/klnds/gnilnd/Makefile
843 lnet/klnds/gnilnd/autoMakefile
844 lnet/klnds/socklnd/Makefile
845 lnet/klnds/socklnd/autoMakefile
847 lnet/lnet/autoMakefile
848 lnet/selftest/Makefile
849 lnet/selftest/autoMakefile
851 lnet/utils/lnetconfig/Makefile