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 CONFIG_LNET_MAX_PAYLOAD_MB=$with_max_payload_mb
14 CONFIG_LNET_MAX_PAYLOAD="(($with_max_payload_mb)<<20)"
17 CONFIG_LNET_MAX_PAYLOAD="LNET_MTU"
19 AC_DEFINE_UNQUOTED(CONFIG_LNET_MAX_PAYLOAD, $CONFIG_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>
79 struct task_struct *t;
85 set_cpus_allowed_ptr(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],
362 [AC_MSG_CHECKING([whether to use Compat RDMA])
365 AC_HELP_STRING([--with-o2ib=path],
366 [build o2iblnd against path]),
369 yes) O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
374 *) O2IBPATHS=$with_o2ib
379 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
382 if test $ENABLEO2IB -eq 0; then
386 for O2IBPATH in $O2IBPATHS; do
387 if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
388 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
389 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
390 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
391 if test \( -d ${O2IBPATH}/kernel_patches -a \
392 -f ${O2IBPATH}/Makefile \); then
394 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%-*}])
400 if ! $o2ib_found; then
404 2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]);;
405 3) AC_MSG_ERROR([bad --with-o2ib path]);;
406 *) AC_MSG_ERROR([internal error]);;
409 compatrdma_found=false
410 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
411 compatrdma_found=true
413 AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
417 if ! $compatrdma_found; then
418 if test -f $O2IBPATH/config.mk; then
419 . $O2IBPATH/config.mk
420 elif test -f $O2IBPATH/ofed_patch.mk; then
421 . $O2IBPATH/ofed_patch.mk
424 case $RHEL_KERNEL_VERSION in
426 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4";;
429 AC_MSG_CHECKING([whether to use any OFED backport headers])
430 if test -n "$BACKPORT_INCLUDES"; then
431 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
432 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
438 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
439 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
440 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include"
442 LB_LINUX_TRY_COMPILE([
443 #include <linux/version.h>
444 #include <linux/pci.h>
445 #include <linux/gfp.h>
446 #ifdef HAVE_COMPAT_RDMA
447 #include <linux/compat-2.6.h>
449 #include <rdma/rdma_cm.h>
450 #include <rdma/ib_cm.h>
451 #include <rdma/ib_verbs.h>
452 #include <rdma/ib_fmr_pool.h>
454 struct rdma_cm_id *cm_idi __attribute__ ((unused));
455 struct rdma_conn_param conn_param __attribute__ ((unused));
456 struct ib_device_attr device_attr __attribute__ ((unused));
457 struct ib_qp_attr qp_attr __attribute__ ((unused));
458 struct ib_pool_fmr pool_fmr __attribute__ ((unused));
459 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
461 rdma_destroy_id(NULL);
469 2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]);;
470 3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]);;
471 *) AC_MSG_ERROR([internal error]);;
475 # we know at this point that the found OFED source is good
477 if test $ENABLEO2IB -eq 3 ; then
478 # OFED default rpm not handle sles10 Modules.symvers name
479 for name in Module.symvers Modules.symvers; do
480 if test -f $O2IBPATH/$name; then
485 if test -n "$O2IB_SYMVER"; then
486 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
487 # strip out the existing symbols versions first
488 if test -f $PWD/$SYMVERFILE; then
489 egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
491 touch $PWD/$SYMVERFILE.old
493 cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
494 rm $PWD/$SYMVERFILE.old
496 AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
504 AC_SUBST(EXTRA_OFED_INCLUDE)
507 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
508 if test $ENABLEO2IB -ne 0; then
509 AC_MSG_CHECKING([if rdma_create_id wants four args])
510 LB_LINUX_TRY_COMPILE([
511 #ifdef HAVE_COMPAT_RDMA
512 #include <linux/compat-2.6.h>
514 #include <rdma/rdma_cm.h>
516 rdma_create_id(NULL, NULL, 0, 0);
519 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
520 [rdma_create_id wants 4 args])
530 # check whether to use the RapidArray lnd
532 AC_DEFUN([LN_CONFIG_RALND],
534 AC_MSG_CHECKING([if RapidArray kernel headers are present])
536 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
537 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
538 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
539 LB_LINUX_TRY_COMPILE([
540 #include <linux/types.h>
544 RAP_PVOID dev_handle;
546 rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
548 return rc == RAP_SUCCESS ? 0 : 1;
557 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
565 # check whether to use the Gemini Network Interface lnd
567 AC_DEFUN([LN_CONFIG_GNILND],
568 [#### Gemini Network Interface
569 AC_MSG_CHECKING([whether to enable GNI lnd])
571 AC_HELP_STRING([--enable-gni],
573 [],[enable_gni='no'])
574 AC_MSG_RESULT([$enable_gni])
576 if test x$enable_gni = xyes ; then
577 AC_MSG_CHECKING([if GNI kernel headers are present])
579 # GNICPPFLAGS was set in spec file
580 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
581 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
582 LB_LINUX_TRY_COMPILE([
583 #include <linux/types.h>
586 gni_cdm_handle_t kgni_domain;
590 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
592 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
600 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
602 # at this point, we have gnilnd basic support, now check for extra features
603 AC_MSG_CHECKING([to use RCA in gnilnd])
604 LB_LINUX_TRY_COMPILE([
605 #include <linux/types.h>
607 #include <krca_lib.h>
609 gni_cdm_handle_t kgni_domain;
611 krca_ticket_t ticket = KRCA_NULL_TICKET;
613 __u32 nid = 0, nic_addr;
615 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
617 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
619 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
621 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
626 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
627 GNILNDRCA="gnilndrca"
631 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
633 AC_SUBST(GNICPPFLAGS)
641 # LN_CONFIG_USERSPACE
643 # This is defined but empty because it is called from
644 # build/autconf/lustre-build.m4 which is shared by all branches.
646 AC_DEFUN([LN_CONFIG_USERSPACE],
651 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
653 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE],
654 [AC_MSG_CHECKING([if tcp_sendpage first parameter is socket])
655 tmp_flags="$EXTRA_KCFLAGS"
656 EXTRA_KCFLAGS="-Werror"
657 LB_LINUX_TRY_COMPILE([
658 #include <linux/net.h>
661 tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
664 AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
665 [tcp_sendpage use socket as first parameter])
669 EXTRA_KCFLAGS="$tmp_flags"
675 # LNet linux kernel checks
677 AC_DEFUN([LN_PROG_LINUX],
679 LN_FUNC_DEV_GET_BY_NAME_2ARG
689 LN_CONFIG_TCP_SENDPAGE
697 AC_DEFUN([LN_PROG_DARWIN],
698 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
704 # default paths for installed files
706 AC_DEFUN([LN_PATH_DEFAULTS],
713 # other configure checks
715 AC_DEFUN([LN_CONFIGURE],
716 [# lnet/utils/portals.c
717 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
718 AC_CHECK_FUNCS([gethostbyname socket connect])
721 AC_CHECK_HEADERS([linux/version.h])
723 # lnet/utils/wirecheck.c
724 AC_CHECK_FUNCS([strnlen])
726 # -------- Check for required packages --------------
731 # Build with readline
733 AC_MSG_CHECKING([whether to enable readline support])
734 AC_ARG_ENABLE(readline,
735 AC_HELP_STRING([--disable-readline],
736 [disable readline support]),
737 [],[enable_readline='yes'])
738 AC_MSG_RESULT([$enable_readline])
740 # -------- check for readline if enabled ----
741 if test x$enable_readline = xyes ; then
743 LIBS="-lncurses $LIBS"
744 AC_CHECK_LIB([readline],[readline],[
745 LIBREADLINE="-lreadline -lncurses"
746 AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
754 AC_SUBST(LIBREADLINE)
756 # -------- enable acceptor libwrap (TCP wrappers) support? -------
757 AC_MSG_CHECKING([if libwrap support is requested])
758 AC_ARG_ENABLE([libwrap],
759 AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
760 [case "${enableval}" in
761 yes) enable_libwrap=yes ;;
762 no) enable_libwrap=no ;;
763 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
764 esac],[enable_libwrap=no])
765 AC_MSG_RESULT([$enable_libwrap])
766 if test x$enable_libwrap = xyes ; then
768 AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
774 # ----------------------------------------
775 # some tests for catamount-like systems
776 # ----------------------------------------
777 AC_ARG_ENABLE([sysio_init],
778 AC_HELP_STRING([--disable-sysio-init],
779 [call sysio init functions when initializing liblustre]),
780 [],[enable_sysio_init=yes])
781 AC_MSG_CHECKING([whether to initialize libsysio])
782 AC_MSG_RESULT([$enable_sysio_init])
783 if test x$enable_sysio_init != xno ; then
784 AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
787 AC_ARG_ENABLE([urandom],
788 AC_HELP_STRING([--disable-urandom],
789 [disable use of /dev/urandom for liblustre]),
790 [],[enable_urandom=yes])
791 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
792 AC_MSG_RESULT([$enable_urandom])
793 if test x$enable_urandom != xno ; then
794 AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
797 # -------- check for -lcap support ----
798 if test x$enable_liblustre = xyes ; then
799 AC_CHECK_LIB([cap], [cap_get_proc],
802 AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
811 LN_CONFIG_MAX_PAYLOAD
819 # AM_CONDITOINAL defines for lnet
821 AC_DEFUN([LN_CONDITIONALS],
822 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
823 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
824 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
825 AM_CONDITIONAL(BUILD_RALND, test x$RALND = "xralnd")
826 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
827 AM_CONDITIONAL(BUILD_GNILND_RCA, test x$GNILNDRCA = "xgnilndrca")
828 AM_CONDITIONAL(BUILD_PTLLND, test x$PTLLND = "xptllnd")
829 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
835 # files that should be generated with AC_OUTPUT
837 AC_DEFUN([LN_CONFIG_FILES],
842 lnet/autoconf/Makefile
844 lnet/include/Makefile
845 lnet/include/lnet/Makefile
846 lnet/include/lnet/linux/Makefile
848 lnet/klnds/autoMakefile
849 lnet/klnds/mxlnd/autoMakefile
850 lnet/klnds/mxlnd/Makefile
851 lnet/klnds/o2iblnd/Makefile
852 lnet/klnds/o2iblnd/autoMakefile
853 lnet/klnds/qswlnd/Makefile
854 lnet/klnds/qswlnd/autoMakefile
855 lnet/klnds/ralnd/Makefile
856 lnet/klnds/ralnd/autoMakefile
857 lnet/klnds/gnilnd/Makefile
858 lnet/klnds/gnilnd/autoMakefile
859 lnet/klnds/socklnd/Makefile
860 lnet/klnds/socklnd/autoMakefile
861 lnet/klnds/ptllnd/Makefile
862 lnet/klnds/ptllnd/autoMakefile
864 lnet/lnet/autoMakefile
865 lnet/selftest/Makefile
866 lnet/selftest/autoMakefile
868 lnet/ulnds/autoMakefile
869 lnet/ulnds/socklnd/Makefile
871 lnet/include/lnet/darwin/Makefile