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 PORTALS=$(readlink --canonicalize $PORTALS)
124 AC_MSG_RESULT([$PORTALS])
125 PTLLNDCPPFLAGS="-I${PORTALS}/include"
127 AC_SUBST(PTLLNDCPPFLAGS)
133 # check if tunable tcp backoff is available/wanted
135 AC_DEFUN([LN_CONFIG_BACKOFF],
136 [AC_MSG_CHECKING([for tunable backoff TCP support])
137 AC_ARG_ENABLE([backoff],
138 AC_HELP_STRING([--disable-backoff],
139 [disable socknal tunable backoff]),
140 [],[enable_backoff='yes'])
141 if test x$enable_backoff = xno ; then
142 AC_MSG_RESULT([no (by request)])
144 BOCD="`grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h`"
145 if test "$BOCD" != 0 ; then
146 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
148 if grep rto_max $LINUX/include/linux/tcp.h|grep -q __u16; then
149 AC_DEFINE(SOCKNAL_BACKOFF_MS, 1, [tunable backoff TCP in ms])
152 AC_MSG_RESULT([no (no kernel support)])
161 # configure support for Portals LND
163 AC_DEFUN([LN_CONFIG_PTLLND],
165 if test -z "$ENABLEPORTALS"; then
169 AC_MSG_CHECKING([whether to build the kernel portals LND])
172 if test $ENABLEPORTALS -ne 0; then
184 # configure support for Portals LND
186 AC_DEFUN([LN_CONFIG_UPTLLND],
188 if test -z "$ENABLEPORTALS"; then
192 AC_MSG_CHECKING([whether to build the userspace portals LND])
195 if test $ENABLEPORTALS -ne 0; then
207 # configure support for userspace TCP/IP LND
209 AC_DEFUN([LN_CONFIG_USOCKLND],
210 [AC_MSG_CHECKING([whether to build usocklnd])
211 AC_ARG_ENABLE([usocklnd],
212 AC_HELP_STRING([--disable-usocklnd],
214 [],[enable_usocklnd='yes'])
216 if test x$enable_usocklnd = xyes ; then
217 if test "$ENABLE_LIBPTHREAD" = "yes" ; then
221 AC_MSG_RESULT([no (libpthread not present or disabled)])
225 AC_MSG_RESULT([no (disabled explicitly)])
234 # check if quadrics support is in this kernel
236 AC_DEFUN([LN_CONFIG_QUADRICS],
237 [AC_MSG_CHECKING([for QsNet sources])
239 AC_HELP_STRING([--with-qsnet=path],
240 [set path to qsnet source (default=$LINUX)]),
243 AC_MSG_RESULT([$QSNET])
245 AC_MSG_CHECKING([if quadrics kernel headers are present])
246 if test -d $QSNET/drivers/net/qsnet ; then
249 AC_MSG_CHECKING([for multirail EKC])
250 if test -f $QSNET/include/elan/epcomms.h; then
251 QSNET=$(readlink --canonicalize $QSNET)
252 AC_MSG_RESULT([supported])
253 QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
255 AC_MSG_RESULT([not supported])
256 AC_MSG_ERROR([Need multirail EKC])
259 if test x$QSNET = x$LINUX ; then
260 LB_LINUX_CONFIG([QSNET],[],[
261 LB_LINUX_CONFIG([QSNET_MODULE],[],[
262 AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswlnd.])
273 AC_SUBST(QSWCPPFLAGS)
281 AC_DEFUN([LN_CONFIG_MX],
282 [AC_MSG_CHECKING([whether to enable Myrinet MX support])
286 AC_HELP_STRING([--with-mx=path],
287 [build mxlnd against path]),
301 if test $ENABLEMX -eq 0; then
302 AC_MSG_RESULT([disabled])
303 elif test ! \( -f ${MXPATH}/include/myriexpress.h -a \
304 -f ${MXPATH}/include/mx_kernel_api.h -a \
305 -f ${MXPATH}/include/mx_pin.h \); then
309 2) AC_MSG_ERROR([Myrinet MX kernel headers not present]);;
310 3) AC_MSG_ERROR([bad --with-mx path]);;
311 *) AC_MSG_ERROR([internal error]);;
314 MXPATH=$(readlink --canonicalize $MXPATH)
315 MXCPPFLAGS="-I$MXPATH/include"
316 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
317 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
318 MXLIBS="-L$MXPATH/lib"
319 LB_LINUX_TRY_COMPILE([
321 #include <mx_extensions.h>
322 #include <myriexpress.h>
326 mx_request_t request;
330 mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
331 mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
332 mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
333 mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
342 2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]);;
343 3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]);;
344 *) AC_MSG_ERROR([internal error]);;
349 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
361 AC_DEFUN([LN_CONFIG_O2IB],[
363 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
366 AC_HELP_STRING([--with-o2ib=path],
367 [build o2iblnd against path]),
370 yes) O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
375 *) O2IBPATHS=$with_o2ib
380 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
383 if test $ENABLEO2IB -eq 0; then
384 AC_MSG_RESULT([disabled])
387 for O2IBPATH in $O2IBPATHS; do
388 if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
389 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
390 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
391 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
392 if test \( -d ${O2IBPATH}/kernel_patches -a \
393 -f ${O2IBPATH}/Makefile \); then
395 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%-*}])
401 if ! $o2ib_found; then
405 2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]);;
406 3) AC_MSG_ERROR([bad --with-o2ib path]);;
407 *) AC_MSG_ERROR([internal error]);;
410 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
411 O2IBCPPFLAGS="-I$O2IBPATH/include"
412 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
413 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $O2IBCPPFLAGS"
414 EXTRA_LNET_INCLUDE="$EXTRA_LNET_INCLUDE $O2IBCPPFLAGS"
416 LB_LINUX_TRY_COMPILE([
417 #include <linux/version.h>
418 #include <linux/pci.h>
419 #include <linux/gfp.h>
420 #include <rdma/rdma_cm.h>
421 #include <rdma/ib_cm.h>
422 #include <rdma/ib_verbs.h>
423 #include <rdma/ib_fmr_pool.h>
425 struct rdma_cm_id *cm_idi __attribute__ ((unused));
426 struct rdma_conn_param conn_param __attribute__ ((unused));
427 struct ib_device_attr device_attr __attribute__ ((unused));
428 struct ib_qp_attr qp_attr __attribute__ ((unused));
429 struct ib_pool_fmr pool_fmr __attribute__ ((unused));
430 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
432 rdma_destroy_id(NULL);
440 2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]);;
441 3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]);;
442 *) AC_MSG_ERROR([internal error]);;
447 # we know at this point that the found OFED source is good
449 if test $ENABLEO2IB -eq 3 ; then
450 # OFED default rpm not handle sles10 Modules.symvers name
451 for name in Module.symvers Modules.symvers; do
452 if test -f $O2IBPATH/$name; then
457 if test -n "$O2IB_SYMVER"; then
458 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
459 # strip out the existing symbols versions first
460 if test -f $PWD/$SYMVERFILE; then
461 egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
463 touch $PWD/$SYMVERFILE.old
465 cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
466 rm $PWD/$SYMVERFILE.old
468 AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
473 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
477 AC_SUBST(EXTRA_LNET_INCLUDE)
478 AC_SUBST(O2IBCPPFLAGS)
481 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
482 if test $ENABLEO2IB -ne 0; then
483 AC_MSG_CHECKING([if rdma_create_id wants four args])
484 LB_LINUX_TRY_COMPILE([
485 #include <rdma/rdma_cm.h>
487 rdma_create_id(NULL, NULL, 0, 0);
490 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
491 [rdma_create_id wants 4 args])
501 # check whether to use the RapidArray lnd
503 AC_DEFUN([LN_CONFIG_RALND],
505 AC_MSG_CHECKING([if RapidArray kernel headers are present])
507 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
508 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
509 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
510 LB_LINUX_TRY_COMPILE([
511 #include <linux/types.h>
515 RAP_PVOID dev_handle;
517 rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
519 return rc == RAP_SUCCESS ? 0 : 1;
528 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
536 # check whether to use the Gemini Network Interface lnd
538 AC_DEFUN([LN_CONFIG_GNILND],
539 [#### Gemini Network Interface
540 AC_MSG_CHECKING([whether to enable GNI lnd])
542 AC_HELP_STRING([--enable-gni],
544 [],[enable_gni='no'])
545 AC_MSG_RESULT([$enable_gni])
547 if test x$enable_gni = xyes ; then
548 AC_MSG_CHECKING([if GNI kernel headers are present])
550 # GNICPPFLAGS was set in spec file
551 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
552 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
553 LB_LINUX_TRY_COMPILE([
554 #include <linux/types.h>
557 gni_cdm_handle_t kgni_domain;
561 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
563 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
571 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
573 # at this point, we have gnilnd basic support, now check for extra features
574 AC_MSG_CHECKING([to use RCA in gnilnd])
575 LB_LINUX_TRY_COMPILE([
576 #include <linux/types.h>
578 #include <krca_lib.h>
580 gni_cdm_handle_t kgni_domain;
582 krca_ticket_t ticket = KRCA_NULL_TICKET;
584 __u32 nid = 0, nic_addr;
586 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
588 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
590 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
592 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
597 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
598 GNILNDRCA="gnilndrca"
602 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
604 AC_SUBST(GNICPPFLAGS)
612 # LN_CONFIG_USERSPACE
614 # This is defined but empty because it is called from
615 # build/autconf/lustre-build.m4 which is shared by all branches.
617 AC_DEFUN([LN_CONFIG_USERSPACE],
621 # See if sysctl proc_handler wants only 5 arguments (since 2.6.32)
622 AC_DEFUN([LN_5ARGS_SYSCTL_PROC_HANDLER],
623 [AC_MSG_CHECKING([if sysctl proc_handler wants 5 args])
624 LB_LINUX_TRY_COMPILE([
625 #include <linux/sysctl.h>
627 struct ctl_table *table = NULL;
629 void __user *buffer = NULL;
633 proc_handler *proc_handler = NULL;
634 proc_handler(table, write, buffer, lenp, ppos);
638 AC_DEFINE(HAVE_5ARGS_SYSCTL_PROC_HANDLER, 1,
639 [sysctl proc_handler wants 5 args])
646 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
648 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE],
649 [AC_MSG_CHECKING([if tcp_sendpage first parameter is socket])
650 tmp_flags="$EXTRA_KCFLAGS"
651 EXTRA_KCFLAGS="-Werror"
652 LB_LINUX_TRY_COMPILE([
653 #include <linux/net.h>
656 tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
659 AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
660 [tcp_sendpage use socket as first parameter])
664 EXTRA_KCFLAGS="$tmp_flags"
670 # LNet linux kernel checks
672 AC_DEFUN([LN_PROG_LINUX],
674 LN_FUNC_DEV_GET_BY_NAME_2ARG
684 LN_5ARGS_SYSCTL_PROC_HANDLER
686 LN_CONFIG_TCP_SENDPAGE
694 AC_DEFUN([LN_PROG_DARWIN],
695 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
701 # default paths for installed files
703 AC_DEFUN([LN_PATH_DEFAULTS],
710 # other configure checks
712 AC_DEFUN([LN_CONFIGURE],
713 [# lnet/utils/portals.c
714 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
715 AC_CHECK_FUNCS([gethostbyname socket connect])
718 AC_CHECK_HEADERS([linux/version.h])
720 # lnet/utils/wirecheck.c
721 AC_CHECK_FUNCS([strnlen])
723 # -------- Check for required packages --------------
728 # Build with readline
730 AC_MSG_CHECKING([whether to enable readline support])
731 AC_ARG_ENABLE(readline,
732 AC_HELP_STRING([--disable-readline],
733 [disable readline support]),
734 [],[enable_readline='yes'])
735 AC_MSG_RESULT([$enable_readline])
737 # -------- check for readline if enabled ----
738 if test x$enable_readline = xyes ; then
740 LIBS="-lncurses $LIBS"
741 AC_CHECK_LIB([readline],[readline],[
742 LIBREADLINE="-lreadline -lncurses"
743 AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
751 AC_SUBST(LIBREADLINE)
753 # -------- enable acceptor libwrap (TCP wrappers) support? -------
754 AC_MSG_CHECKING([if libwrap support is requested])
755 AC_ARG_ENABLE([libwrap],
756 AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
757 [case "${enableval}" in
758 yes) enable_libwrap=yes ;;
759 no) enable_libwrap=no ;;
760 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
761 esac],[enable_libwrap=no])
762 AC_MSG_RESULT([$enable_libwrap])
763 if test x$enable_libwrap = xyes ; then
765 AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
771 # ----------------------------------------
772 # some tests for catamount-like systems
773 # ----------------------------------------
774 AC_ARG_ENABLE([sysio_init],
775 AC_HELP_STRING([--disable-sysio-init],
776 [call sysio init functions when initializing liblustre]),
777 [],[enable_sysio_init=yes])
778 AC_MSG_CHECKING([whether to initialize libsysio])
779 AC_MSG_RESULT([$enable_sysio_init])
780 if test x$enable_sysio_init != xno ; then
781 AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
784 AC_ARG_ENABLE([urandom],
785 AC_HELP_STRING([--disable-urandom],
786 [disable use of /dev/urandom for liblustre]),
787 [],[enable_urandom=yes])
788 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
789 AC_MSG_RESULT([$enable_urandom])
790 if test x$enable_urandom != xno ; then
791 AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
794 # -------- check for -lcap support ----
795 if test x$enable_liblustre = xyes ; then
796 AC_CHECK_LIB([cap], [cap_get_proc],
799 AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
808 LN_CONFIG_MAX_PAYLOAD
816 # AM_CONDITOINAL defines for lnet
818 AC_DEFUN([LN_CONDITIONALS],
819 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
820 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
821 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
822 AM_CONDITIONAL(BUILD_RALND, test x$RALND = "xralnd")
823 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
824 AM_CONDITIONAL(BUILD_GNILND_RCA, test x$GNILNDRCA = "xgnilndrca")
825 AM_CONDITIONAL(BUILD_PTLLND, test x$PTLLND = "xptllnd")
826 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
832 # files that should be generated with AC_OUTPUT
834 AC_DEFUN([LN_CONFIG_FILES],
839 lnet/autoconf/Makefile
841 lnet/include/Makefile
842 lnet/include/lnet/Makefile
843 lnet/include/lnet/linux/Makefile
845 lnet/klnds/autoMakefile
846 lnet/klnds/mxlnd/autoMakefile
847 lnet/klnds/mxlnd/Makefile
848 lnet/klnds/o2iblnd/Makefile
849 lnet/klnds/o2iblnd/autoMakefile
850 lnet/klnds/qswlnd/Makefile
851 lnet/klnds/qswlnd/autoMakefile
852 lnet/klnds/ralnd/Makefile
853 lnet/klnds/ralnd/autoMakefile
854 lnet/klnds/gnilnd/Makefile
855 lnet/klnds/gnilnd/autoMakefile
856 lnet/klnds/socklnd/Makefile
857 lnet/klnds/socklnd/autoMakefile
858 lnet/klnds/ptllnd/Makefile
859 lnet/klnds/ptllnd/autoMakefile
861 lnet/lnet/autoMakefile
862 lnet/selftest/Makefile
863 lnet/selftest/autoMakefile
865 lnet/ulnds/autoMakefile
866 lnet/ulnds/socklnd/Makefile
868 lnet/include/lnet/darwin/Makefile