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])
47 # check if cpu affinity is available/wanted
49 AC_DEFUN([LN_CONFIG_AFFINITY],
50 [AC_ARG_ENABLE([affinity],
51 AC_HELP_STRING([--disable-affinity],
52 [disable process/irq affinity]),
53 [],[enable_affinity='yes'])
55 AC_MSG_CHECKING([for CPU affinity support])
56 if test x$enable_affinity = xno ; then
57 AC_MSG_RESULT([no (by request)])
59 LB_LINUX_TRY_COMPILE([
60 #include <linux/sched.h>
68 set_cpus_allowed(&t, m);
70 AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
73 AC_MSG_RESULT([no (no kernel support)])
81 # configure support for Portals
83 AC_DEFUN([LN_CONFIG_PORTALS],
84 [AC_MSG_CHECKING([for portals])
85 AC_ARG_WITH([portals],
86 AC_HELP_STRING([--with-portals=path],
87 [set path to portals]),
92 *) PORTALS="${with_portals}"
100 if test $ENABLEPORTALS -eq 0; then
102 elif test ! \( -f ${PORTALS}/include/portals/p30.h \); then
104 AC_MSG_ERROR([bad --with-portals path])
106 AC_MSG_RESULT([$PORTALS])
107 PTLLNDCPPFLAGS="-I${PORTALS}/include"
109 AC_SUBST(PTLLNDCPPFLAGS)
115 # check if tunable tcp backoff is available/wanted
117 AC_DEFUN([LN_CONFIG_BACKOFF],
118 [AC_MSG_CHECKING([for tunable backoff TCP support])
119 AC_ARG_ENABLE([backoff],
120 AC_HELP_STRING([--disable-backoff],
121 [disable socknal tunable backoff]),
122 [],[enable_backoff='yes'])
123 if test x$enable_backoff = xno ; then
124 AC_MSG_RESULT([no (by request)])
126 BOCD="`grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h`"
127 if test "$BOCD" != 0 ; then
128 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
130 if grep rto_max $LINUX/include/linux/tcp.h|grep -q __u16; then
131 AC_DEFINE(SOCKNAL_BACKOFF_MS, 1, [tunable backoff TCP in ms])
134 AC_MSG_RESULT([no (no kernel support)])
143 # configure support for Portals LND
145 AC_DEFUN([LN_CONFIG_PTLLND],
147 if test -z "$ENABLEPORTALS"; then
151 AC_MSG_CHECKING([whether to build the kernel portals LND])
154 if test $ENABLEPORTALS -ne 0; then
166 # configure support for Portals LND
168 AC_DEFUN([LN_CONFIG_UPTLLND],
170 if test -z "$ENABLEPORTALS"; then
174 AC_MSG_CHECKING([whether to build the userspace portals LND])
177 if test $ENABLEPORTALS -ne 0; then
189 # configure support for userspace TCP/IP LND
191 AC_DEFUN([LN_CONFIG_USOCKLND],
192 [AC_MSG_CHECKING([whether to build usocklnd])
193 AC_ARG_ENABLE([usocklnd],
194 AC_HELP_STRING([--disable-usocklnd],
196 [],[enable_usocklnd='yes'])
198 if test x$enable_usocklnd = xyes ; then
199 if test "$ENABLE_LIBPTHREAD" = "yes" ; then
203 AC_MSG_RESULT([no (libpthread not present or disabled)])
207 AC_MSG_RESULT([no (disabled explicitly)])
216 # check if quadrics support is in this kernel
218 AC_DEFUN([LN_CONFIG_QUADRICS],
219 [AC_MSG_CHECKING([for QsNet sources])
221 AC_HELP_STRING([--with-qsnet=path],
222 [set path to qsnet source (default=$LINUX)]),
225 AC_MSG_RESULT([$QSNET])
227 AC_MSG_CHECKING([if quadrics kernel headers are present])
228 if test -d $QSNET/drivers/net/qsnet ; then
231 AC_MSG_CHECKING([for multirail EKC])
232 if test -f $QSNET/include/elan/epcomms.h; then
233 AC_MSG_RESULT([supported])
234 QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
236 AC_MSG_RESULT([not supported])
237 AC_MSG_ERROR([Need multirail EKC])
240 if test x$QSNET = x$LINUX ; then
241 LB_LINUX_CONFIG([QSNET],[],[
242 LB_LINUX_CONFIG([QSNET_MODULE],[],[
243 AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswlnd.])
254 AC_SUBST(QSWCPPFLAGS)
262 AC_DEFUN([LN_CONFIG_MX],
263 [AC_MSG_CHECKING([whether to enable Myrinet MX support])
267 AC_HELP_STRING([--with-mx=path],
268 [build mxlnd against path]),
282 if test $ENABLEMX -eq 0; then
283 AC_MSG_RESULT([disabled])
284 elif test ! \( -f ${MXPATH}/include/myriexpress.h -a \
285 -f ${MXPATH}/include/mx_kernel_api.h -a \
286 -f ${MXPATH}/include/mx_pin.h \); then
290 2) AC_MSG_ERROR([Myrinet MX kernel headers not present]);;
291 3) AC_MSG_ERROR([bad --with-mx path]);;
292 *) AC_MSG_ERROR([internal error]);;
295 MXCPPFLAGS="-I$MXPATH/include"
296 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
297 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
298 MXLIBS="-L$MXPATH/lib"
299 LB_LINUX_TRY_COMPILE([
301 #include <mx_extensions.h>
302 #include <myriexpress.h>
306 mx_request_t request;
310 mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
311 mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
312 mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
313 mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
322 2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]);;
323 3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]);;
324 *) AC_MSG_ERROR([internal error]);;
329 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
341 AC_DEFUN([LN_CONFIG_O2IB],[
342 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
345 AC_HELP_STRING([--with-o2ib=path],
346 [build o2iblnd against path]),
349 yes) O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
354 *) O2IBPATHS=$with_o2ib
359 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
362 if test $ENABLEO2IB -eq 0; then
363 AC_MSG_RESULT([disabled])
366 for O2IBPATH in $O2IBPATHS; do
367 if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
368 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
369 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
370 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
371 if test \( -d ${O2IBPATH}/kernel_patches -a \
372 -f ${O2IBPATH}/Makefile \); then
374 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%-*}])
380 if ! $o2ib_found; then
384 2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]);;
385 3) AC_MSG_ERROR([bad --with-o2ib path]);;
386 *) AC_MSG_ERROR([internal error]);;
389 O2IBCPPFLAGS="-I$O2IBPATH/include"
390 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
391 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $O2IBCPPFLAGS"
392 EXTRA_LNET_INCLUDE="$EXTRA_LNET_INCLUDE $O2IBCPPFLAGS"
394 LB_LINUX_TRY_COMPILE([
395 #include <linux/version.h>
396 #include <linux/pci.h>
400 #include <rdma/rdma_cm.h>
401 #include <rdma/ib_cm.h>
402 #include <rdma/ib_verbs.h>
403 #include <rdma/ib_fmr_pool.h>
405 struct rdma_cm_id *cm_id;
406 struct rdma_conn_param conn_param;
407 struct ib_device_attr device_attr;
408 struct ib_qp_attr qp_attr;
409 struct ib_pool_fmr pool_fmr;
410 enum ib_cm_rej_reason rej_reason;
412 cm_id = rdma_create_id(NULL, NULL, RDMA_PS_TCP);
413 return PTR_ERR(cm_id);
421 2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]);;
422 3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]);;
423 *) AC_MSG_ERROR([internal error]);;
428 # we know at this point that the found OFED source is good
430 if test $ENABLEO2IB -eq 3 ; then
431 # OFED default rpm not handle sles10 Modules.symvers name
432 for name in Module.symvers Modules.symvers; do
433 if test -f $O2IBPATH/$name; then
438 if test -n "$O2IB_SYMVER"; then
439 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
440 # strip out the existing symbols versions first
441 if test -f $PWD/$SYMVERFILE; then
442 egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
444 touch $PWD/$SYMVERFILE.old
446 cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
447 rm $PWD/$SYMVERFILE.old
449 AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
454 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
458 AC_SUBST(EXTRA_LNET_INCLUDE)
459 AC_SUBST(O2IBCPPFLAGS)
466 # check whether to use the RapidArray lnd
468 AC_DEFUN([LN_CONFIG_RALND],
470 AC_MSG_CHECKING([if RapidArray kernel headers are present])
472 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
473 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
474 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
475 LB_LINUX_TRY_COMPILE([
476 #include <linux/types.h>
480 RAP_PVOID dev_handle;
482 rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
484 return rc == RAP_SUCCESS ? 0 : 1;
493 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
502 # LN_CONFIG_USERSPACE
504 # This is defined but empty because it is called from
505 # build/autconf/lustre-build.m4 which is shared by all branches.
507 AC_DEFUN([LN_CONFIG_USERSPACE],
511 # See if sysctl proc_handler wants only 5 arguments (since 2.6.32)
512 AC_DEFUN([LN_5ARGS_SYSCTL_PROC_HANDLER],
513 [AC_MSG_CHECKING([if sysctl proc_handler wants 5 args])
514 LB_LINUX_TRY_COMPILE([
515 #include <linux/sysctl.h>
517 struct ctl_table *table = NULL;
519 void __user *buffer = NULL;
523 proc_handler *proc_handler;
524 proc_handler(table, write, buffer, lenp, ppos);
528 AC_DEFINE(HAVE_5ARGS_SYSCTL_PROC_HANDLER, 1,
529 [sysctl proc_handler wants 5 args])
538 # LNet linux kernel checks
540 AC_DEFUN([LN_PROG_LINUX],
550 LN_5ARGS_SYSCTL_PROC_HANDLER
558 AC_DEFUN([LN_PROG_DARWIN],
559 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
565 # default paths for installed files
567 AC_DEFUN([LN_PATH_DEFAULTS],
574 # other configure checks
576 AC_DEFUN([LN_CONFIGURE],
577 [# lnet/utils/portals.c
578 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
579 AC_CHECK_FUNCS([gethostbyname socket connect])
582 AC_CHECK_HEADERS([linux/version.h])
584 AC_CHECK_TYPE([spinlock_t],
585 [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
587 [#include <linux/spinlock.h>])
589 # lnet/utils/wirecheck.c
590 AC_CHECK_FUNCS([strnlen])
592 # -------- Check for required packages --------------
597 # Build with readline
599 AC_MSG_CHECKING([whether to enable readline support])
600 AC_ARG_ENABLE(readline,
601 AC_HELP_STRING([--disable-readline],
602 [disable readline support]),
603 [],[enable_readline='yes'])
604 AC_MSG_RESULT([$enable_readline])
606 # -------- check for readline if enabled ----
607 if test x$enable_readline = xyes ; then
609 LIBS="-lncurses $LIBS"
610 AC_CHECK_LIB([readline],[readline],[
611 LIBREADLINE="-lreadline -lncurses"
612 AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
620 AC_SUBST(LIBREADLINE)
622 # -------- enable acceptor libwrap (TCP wrappers) support? -------
623 AC_MSG_CHECKING([if libwrap support is requested])
624 AC_ARG_ENABLE([libwrap],
625 AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
626 [case "${enableval}" in
627 yes) enable_libwrap=yes ;;
628 no) enable_libwrap=no ;;
629 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
630 esac],[enable_libwrap=no])
631 AC_MSG_RESULT([$enable_libwrap])
632 if test x$enable_libwrap = xyes ; then
634 AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
640 # ----------------------------------------
641 # some tests for catamount-like systems
642 # ----------------------------------------
643 AC_ARG_ENABLE([sysio_init],
644 AC_HELP_STRING([--disable-sysio-init],
645 [call sysio init functions when initializing liblustre]),
646 [],[enable_sysio_init=yes])
647 AC_MSG_CHECKING([whether to initialize libsysio])
648 AC_MSG_RESULT([$enable_sysio_init])
649 if test x$enable_sysio_init != xno ; then
650 AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
653 AC_ARG_ENABLE([urandom],
654 AC_HELP_STRING([--disable-urandom],
655 [disable use of /dev/urandom for liblustre]),
656 [],[enable_urandom=yes])
657 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
658 AC_MSG_RESULT([$enable_urandom])
659 if test x$enable_urandom != xno ; then
660 AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
663 # -------- check for -lcap support ----
664 if test x$enable_liblustre = xyes ; then
665 AC_CHECK_LIB([cap], [cap_get_proc],
668 AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
677 LN_CONFIG_MAX_PAYLOAD
685 # AM_CONDITOINAL defines for lnet
687 AC_DEFUN([LN_CONDITIONALS],
688 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
689 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
690 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
691 AM_CONDITIONAL(BUILD_RALND, test x$RALND = "xralnd")
692 AM_CONDITIONAL(BUILD_PTLLND, test x$PTLLND = "xptllnd")
693 AM_CONDITIONAL(BUILD_UPTLLND, test x$UPTLLND = "xptllnd")
694 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
700 # files that should be generated with AC_OUTPUT
702 AC_DEFUN([LN_CONFIG_FILES],
707 lnet/autoconf/Makefile
709 lnet/include/Makefile
710 lnet/include/lnet/Makefile
711 lnet/include/lnet/linux/Makefile
713 lnet/klnds/autoMakefile
714 lnet/klnds/mxlnd/autoMakefile
715 lnet/klnds/mxlnd/Makefile
716 lnet/klnds/o2iblnd/Makefile
717 lnet/klnds/o2iblnd/autoMakefile
718 lnet/klnds/qswlnd/Makefile
719 lnet/klnds/qswlnd/autoMakefile
720 lnet/klnds/ralnd/Makefile
721 lnet/klnds/ralnd/autoMakefile
722 lnet/klnds/socklnd/Makefile
723 lnet/klnds/socklnd/autoMakefile
724 lnet/klnds/ptllnd/Makefile
725 lnet/klnds/ptllnd/autoMakefile
727 lnet/lnet/autoMakefile
728 lnet/selftest/Makefile
729 lnet/selftest/autoMakefile
731 lnet/ulnds/autoMakefile
732 lnet/ulnds/socklnd/Makefile
733 lnet/ulnds/ptllnd/Makefile
735 lnet/include/lnet/darwin/Makefile