2 # LN_CONFIG_MAX_PAYLOAD
4 # configure maximum payload
6 AC_DEFUN([LN_CONFIG_MAX_PAYLOAD],
7 [AC_MSG_CHECKING([for non-default maximum LNET payload])
8 AC_ARG_WITH([max-payload-mb],
9 AC_HELP_STRING([--with-max-payload-mb=MBytes],
10 [set maximum lnet payload in MBytes]),
12 AC_MSG_RESULT([$with_max_payload_mb])
13 LNET_MAX_PAYLOAD_MB=$with_max_payload_mb
14 LNET_MAX_PAYLOAD="(($with_max_payload_mb)<<20)"
17 LNET_MAX_PAYLOAD="LNET_MTU"
19 AC_DEFINE_UNQUOTED(LNET_MAX_PAYLOAD, $LNET_MAX_PAYLOAD,
24 # LN_CHECK_GCC_VERSION
26 # Check compiler version
28 AC_DEFUN([LN_CHECK_GCC_VERSION],
29 [AC_MSG_CHECKING([compiler version])
30 PTL_CC_VERSION=`$CC --version | awk '/^gcc/{print $ 3}'`
31 PTL_MIN_CC_VERSION="3.2.2"
33 awk -F. '{printf "%d\n", (($ 1)*100+($ 2))*100+($ 3)}'
35 if test -z "$PTL_CC_VERSION" -o \
36 `echo $PTL_CC_VERSION | v2n` -ge `echo $PTL_MIN_CC_VERSION | v2n`; then
39 AC_MSG_RESULT([Buggy compiler found])
40 AC_MSG_ERROR([Need gcc version >= $PTL_MIN_CC_VERSION])
45 # LN_FUNC_DEV_GET_BY_NAME_2ARG
47 AC_DEFUN([LN_FUNC_DEV_GET_BY_NAME_2ARG],
48 [AC_MSG_CHECKING([if dev_get_by_name has two args])
49 LB_LINUX_TRY_COMPILE([
50 #include <linux/netdevice.h>
52 dev_get_by_name(NULL, NULL);
55 AC_DEFINE(HAVE_DEV_GET_BY_NAME_2ARG, 1, [dev_get_by_name has 2 args])
64 # check if cpu affinity is available/wanted
66 AC_DEFUN([LN_CONFIG_AFFINITY],
67 [AC_ARG_ENABLE([affinity],
68 AC_HELP_STRING([--disable-affinity],
69 [disable process/irq affinity]),
70 [],[enable_affinity='yes'])
72 AC_MSG_CHECKING([for CPU affinity support])
73 if test x$enable_affinity = xno ; then
74 AC_MSG_RESULT([no (by request)])
76 LB_LINUX_TRY_COMPILE([
77 #include <linux/sched.h>
85 set_cpus_allowed(&t, m);
87 AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
90 AC_MSG_RESULT([no (no kernel support)])
98 # configure support for Portals
100 AC_DEFUN([LN_CONFIG_PORTALS],
101 [AC_MSG_CHECKING([for portals])
102 AC_ARG_WITH([portals],
103 AC_HELP_STRING([--with-portals=path],
104 [set path to portals]),
106 case $with_portals in
109 *) PORTALS="${with_portals}"
117 if test $ENABLEPORTALS -eq 0; then
119 elif test ! \( -f ${PORTALS}/include/portals/p30.h \); then
121 AC_MSG_ERROR([bad --with-portals path])
123 AC_MSG_RESULT([$PORTALS])
124 PTLLNDCPPFLAGS="-I${PORTALS}/include"
126 AC_SUBST(PTLLNDCPPFLAGS)
132 # check if tunable tcp backoff is available/wanted
134 AC_DEFUN([LN_CONFIG_BACKOFF],
135 [AC_MSG_CHECKING([for tunable backoff TCP support])
136 AC_ARG_ENABLE([backoff],
137 AC_HELP_STRING([--disable-backoff],
138 [disable socknal tunable backoff]),
139 [],[enable_backoff='yes'])
140 if test x$enable_backoff = xno ; then
141 AC_MSG_RESULT([no (by request)])
143 BOCD="`grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h`"
144 if test "$BOCD" != 0 ; then
145 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
147 if grep rto_max $LINUX/include/linux/tcp.h|grep -q __u16; then
148 AC_DEFINE(SOCKNAL_BACKOFF_MS, 1, [tunable backoff TCP in ms])
151 AC_MSG_RESULT([no (no kernel support)])
160 # configure support for Portals LND
162 AC_DEFUN([LN_CONFIG_PTLLND],
164 if test -z "$ENABLEPORTALS"; then
168 AC_MSG_CHECKING([whether to build the kernel portals LND])
171 if test $ENABLEPORTALS -ne 0; then
183 # configure support for Portals LND
185 AC_DEFUN([LN_CONFIG_UPTLLND],
187 if test -z "$ENABLEPORTALS"; then
191 AC_MSG_CHECKING([whether to build the userspace portals LND])
194 if test $ENABLEPORTALS -ne 0; then
206 # configure support for userspace TCP/IP LND
208 AC_DEFUN([LN_CONFIG_USOCKLND],
209 [AC_MSG_CHECKING([whether to build usocklnd])
210 AC_ARG_ENABLE([usocklnd],
211 AC_HELP_STRING([--disable-usocklnd],
213 [],[enable_usocklnd='yes'])
215 if test x$enable_usocklnd = xyes ; then
216 if test "$ENABLE_LIBPTHREAD" = "yes" ; then
220 AC_MSG_RESULT([no (libpthread not present or disabled)])
224 AC_MSG_RESULT([no (disabled explicitly)])
233 # check if quadrics support is in this kernel
235 AC_DEFUN([LN_CONFIG_QUADRICS],
236 [AC_MSG_CHECKING([for QsNet sources])
238 AC_HELP_STRING([--with-qsnet=path],
239 [set path to qsnet source (default=$LINUX)]),
242 AC_MSG_RESULT([$QSNET])
244 AC_MSG_CHECKING([if quadrics kernel headers are present])
245 if test -d $QSNET/drivers/net/qsnet ; then
248 AC_MSG_CHECKING([for multirail EKC])
249 if test -f $QSNET/include/elan/epcomms.h; then
250 AC_MSG_RESULT([supported])
251 QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
253 AC_MSG_RESULT([not supported])
254 AC_MSG_ERROR([Need multirail EKC])
257 if test x$QSNET = x$LINUX ; then
258 LB_LINUX_CONFIG([QSNET],[],[
259 LB_LINUX_CONFIG([QSNET_MODULE],[],[
260 AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswlnd.])
271 AC_SUBST(QSWCPPFLAGS)
279 AC_DEFUN([LN_CONFIG_MX],
280 [AC_MSG_CHECKING([whether to enable Myrinet MX support])
284 AC_HELP_STRING([--with-mx=path],
285 [build mxlnd against path]),
299 if test $ENABLEMX -eq 0; then
300 AC_MSG_RESULT([disabled])
301 elif test ! \( -f ${MXPATH}/include/myriexpress.h -a \
302 -f ${MXPATH}/include/mx_kernel_api.h -a \
303 -f ${MXPATH}/include/mx_pin.h \); then
307 2) AC_MSG_ERROR([Myrinet MX kernel headers not present]);;
308 3) AC_MSG_ERROR([bad --with-mx path]);;
309 *) AC_MSG_ERROR([internal error]);;
312 MXCPPFLAGS="-I$MXPATH/include"
313 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
314 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
315 MXLIBS="-L$MXPATH/lib"
316 LB_LINUX_TRY_COMPILE([
318 #include <mx_extensions.h>
319 #include <myriexpress.h>
323 mx_request_t request;
327 mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
328 mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
329 mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
330 mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
339 2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]);;
340 3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]);;
341 *) AC_MSG_ERROR([internal error]);;
346 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
358 AC_DEFUN([LN_CONFIG_O2IB],[
360 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
363 AC_HELP_STRING([--with-o2ib=path],
364 [build o2iblnd against path]),
367 yes) O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
372 *) O2IBPATHS=$with_o2ib
377 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
380 if test $ENABLEO2IB -eq 0; then
381 AC_MSG_RESULT([disabled])
384 for O2IBPATH in $O2IBPATHS; do
385 if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
386 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
387 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
388 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
389 if test \( -d ${O2IBPATH}/kernel_patches -a \
390 -f ${O2IBPATH}/Makefile \); then
392 AC_MSG_ERROR([you appear to be trying to use the OFED distribution's source directory (${O2IBPATH}) rather than the "development/headers" directory which is likely in ${O2IBPATH%-*}])
398 if ! $o2ib_found; then
402 2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]);;
403 3) AC_MSG_ERROR([bad --with-o2ib path]);;
404 *) AC_MSG_ERROR([internal error]);;
407 O2IBCPPFLAGS="-I$O2IBPATH/include"
408 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
409 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $O2IBCPPFLAGS"
410 EXTRA_LNET_INCLUDE="$EXTRA_LNET_INCLUDE $O2IBCPPFLAGS"
412 LB_LINUX_TRY_COMPILE([
413 #include <linux/version.h>
414 #include <linux/pci.h>
418 #include <rdma/rdma_cm.h>
419 #include <rdma/ib_cm.h>
420 #include <rdma/ib_verbs.h>
421 #include <rdma/ib_fmr_pool.h>
423 struct rdma_cm_id *cm_id;
424 struct rdma_conn_param conn_param;
425 struct ib_device_attr device_attr;
426 struct ib_qp_attr qp_attr;
427 struct ib_pool_fmr pool_fmr;
428 enum ib_cm_rej_reason rej_reason;
430 rdma_destroy_id(NULL);
438 2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]);;
439 3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]);;
440 *) AC_MSG_ERROR([internal error]);;
445 # we know at this point that the found OFED source is good
447 if test $ENABLEO2IB -eq 3 ; then
448 # OFED default rpm not handle sles10 Modules.symvers name
449 for name in Module.symvers Modules.symvers; do
450 if test -f $O2IBPATH/$name; then
455 if test -n "$O2IB_SYMVER"; then
456 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
457 # strip out the existing symbols versions first
458 if test -f $PWD/$SYMVERFILE; then
459 egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
461 touch $PWD/$SYMVERFILE.old
463 cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
464 rm $PWD/$SYMVERFILE.old
466 AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
471 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
475 AC_SUBST(EXTRA_LNET_INCLUDE)
476 AC_SUBST(O2IBCPPFLAGS)
479 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
480 if test $ENABLEO2IB -ne 0; then
481 AC_MSG_CHECKING([if rdma_create_id wants four args])
482 LB_LINUX_TRY_COMPILE([
483 #include <rdma/rdma_cm.h>
485 rdma_create_id(NULL, NULL, 0, 0);
488 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
489 [rdma_create_id wants 4 args])
499 # check whether to use the RapidArray lnd
501 AC_DEFUN([LN_CONFIG_RALND],
503 AC_MSG_CHECKING([if RapidArray kernel headers are present])
505 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
506 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
507 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
508 LB_LINUX_TRY_COMPILE([
509 #include <linux/types.h>
513 RAP_PVOID dev_handle;
515 rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
517 return rc == RAP_SUCCESS ? 0 : 1;
526 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
535 # LN_CONFIG_USERSPACE
537 # This is defined but empty because it is called from
538 # build/autconf/lustre-build.m4 which is shared by all branches.
540 AC_DEFUN([LN_CONFIG_USERSPACE],
544 # See if sysctl proc_handler wants only 5 arguments (since 2.6.32)
545 AC_DEFUN([LN_5ARGS_SYSCTL_PROC_HANDLER],
546 [AC_MSG_CHECKING([if sysctl proc_handler wants 5 args])
547 LB_LINUX_TRY_COMPILE([
548 #include <linux/sysctl.h>
550 struct ctl_table *table = NULL;
552 void __user *buffer = NULL;
556 proc_handler *proc_handler;
557 proc_handler(table, write, buffer, lenp, ppos);
561 AC_DEFINE(HAVE_5ARGS_SYSCTL_PROC_HANDLER, 1,
562 [sysctl proc_handler wants 5 args])
569 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
571 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE],
572 [AC_MSG_CHECKING([if tcp_sendpage first parameter is socket])
573 tmp_flags="$EXTRA_KCFLAGS"
574 EXTRA_KCFLAGS="-Werror"
575 LB_LINUX_TRY_COMPILE([
576 #include <linux/net.h>
579 tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
582 AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
583 [tcp_sendpage use socket as first parameter])
587 EXTRA_KCFLAGS="$tmp_flags"
593 # LNet linux kernel checks
595 AC_DEFUN([LN_PROG_LINUX],
597 LN_FUNC_DEV_GET_BY_NAME_2ARG
606 LN_5ARGS_SYSCTL_PROC_HANDLER
608 LN_CONFIG_TCP_SENDPAGE
616 AC_DEFUN([LN_PROG_DARWIN],
617 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
623 # default paths for installed files
625 AC_DEFUN([LN_PATH_DEFAULTS],
632 # other configure checks
634 AC_DEFUN([LN_CONFIGURE],
635 [# lnet/utils/portals.c
636 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
637 AC_CHECK_FUNCS([gethostbyname socket connect])
640 AC_CHECK_HEADERS([linux/version.h])
642 AC_CHECK_TYPE([spinlock_t],
643 [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
645 [#include <linux/spinlock.h>])
647 # lnet/utils/wirecheck.c
648 AC_CHECK_FUNCS([strnlen])
650 # -------- Check for required packages --------------
655 # Build with readline
657 AC_MSG_CHECKING([whether to enable readline support])
658 AC_ARG_ENABLE(readline,
659 AC_HELP_STRING([--disable-readline],
660 [disable readline support]),
661 [],[enable_readline='yes'])
662 AC_MSG_RESULT([$enable_readline])
664 # -------- check for readline if enabled ----
665 if test x$enable_readline = xyes ; then
667 LIBS="-lncurses $LIBS"
668 AC_CHECK_LIB([readline],[readline],[
669 LIBREADLINE="-lreadline -lncurses"
670 AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
678 AC_SUBST(LIBREADLINE)
680 # -------- enable acceptor libwrap (TCP wrappers) support? -------
681 AC_MSG_CHECKING([if libwrap support is requested])
682 AC_ARG_ENABLE([libwrap],
683 AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
684 [case "${enableval}" in
685 yes) enable_libwrap=yes ;;
686 no) enable_libwrap=no ;;
687 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
688 esac],[enable_libwrap=no])
689 AC_MSG_RESULT([$enable_libwrap])
690 if test x$enable_libwrap = xyes ; then
692 AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
698 # ----------------------------------------
699 # some tests for catamount-like systems
700 # ----------------------------------------
701 AC_ARG_ENABLE([sysio_init],
702 AC_HELP_STRING([--disable-sysio-init],
703 [call sysio init functions when initializing liblustre]),
704 [],[enable_sysio_init=yes])
705 AC_MSG_CHECKING([whether to initialize libsysio])
706 AC_MSG_RESULT([$enable_sysio_init])
707 if test x$enable_sysio_init != xno ; then
708 AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
711 AC_ARG_ENABLE([urandom],
712 AC_HELP_STRING([--disable-urandom],
713 [disable use of /dev/urandom for liblustre]),
714 [],[enable_urandom=yes])
715 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
716 AC_MSG_RESULT([$enable_urandom])
717 if test x$enable_urandom != xno ; then
718 AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
721 # -------- check for -lcap support ----
722 if test x$enable_liblustre = xyes ; then
723 AC_CHECK_LIB([cap], [cap_get_proc],
726 AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
735 LN_CONFIG_MAX_PAYLOAD
743 # AM_CONDITOINAL defines for lnet
745 AC_DEFUN([LN_CONDITIONALS],
746 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
747 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
748 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
749 AM_CONDITIONAL(BUILD_RALND, test x$RALND = "xralnd")
750 AM_CONDITIONAL(BUILD_PTLLND, test x$PTLLND = "xptllnd")
751 AM_CONDITIONAL(BUILD_UPTLLND, test x$UPTLLND = "xptllnd")
752 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
758 # files that should be generated with AC_OUTPUT
760 AC_DEFUN([LN_CONFIG_FILES],
765 lnet/autoconf/Makefile
767 lnet/include/Makefile
768 lnet/include/lnet/Makefile
769 lnet/include/lnet/linux/Makefile
771 lnet/klnds/autoMakefile
772 lnet/klnds/mxlnd/autoMakefile
773 lnet/klnds/mxlnd/Makefile
774 lnet/klnds/o2iblnd/Makefile
775 lnet/klnds/o2iblnd/autoMakefile
776 lnet/klnds/qswlnd/Makefile
777 lnet/klnds/qswlnd/autoMakefile
778 lnet/klnds/ralnd/Makefile
779 lnet/klnds/ralnd/autoMakefile
780 lnet/klnds/socklnd/Makefile
781 lnet/klnds/socklnd/autoMakefile
782 lnet/klnds/ptllnd/Makefile
783 lnet/klnds/ptllnd/autoMakefile
785 lnet/lnet/autoMakefile
786 lnet/selftest/Makefile
787 lnet/selftest/autoMakefile
789 lnet/ulnds/autoMakefile
790 lnet/ulnds/socklnd/Makefile
791 lnet/ulnds/ptllnd/Makefile
793 lnet/include/lnet/darwin/Makefile