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 # check if tunable tcp backoff is available/wanted
100 AC_DEFUN([LN_CONFIG_BACKOFF],
101 [AC_MSG_CHECKING([for tunable backoff TCP support])
102 AC_ARG_ENABLE([backoff],
103 AC_HELP_STRING([--disable-backoff],
104 [disable socknal tunable backoff]),
105 [],[enable_backoff='yes'])
106 if test x$enable_backoff = xno ; then
107 AC_MSG_RESULT([no (by request)])
109 BOCD="`grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h`"
110 if test "$BOCD" != 0 ; then
111 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
113 if grep rto_max $LINUX/include/linux/tcp.h|grep -q __u16; then
114 AC_DEFINE(SOCKNAL_BACKOFF_MS, 1, [tunable backoff TCP in ms])
117 AC_MSG_RESULT([no (no kernel support)])
125 # configure support for userspace TCP/IP LND
127 AC_DEFUN([LN_CONFIG_USOCKLND],
128 [AC_MSG_CHECKING([whether to build usocklnd])
129 AC_ARG_ENABLE([usocklnd],
130 AC_HELP_STRING([--disable-usocklnd],
132 [],[enable_usocklnd='yes'])
134 if test x$enable_usocklnd = xyes ; then
135 if test "$ENABLE_LIBPTHREAD" = "yes" ; then
139 AC_MSG_RESULT([no (libpthread not present or disabled)])
143 AC_MSG_RESULT([no (disabled explicitly)])
152 # check if quadrics support is in this kernel
154 AC_DEFUN([LN_CONFIG_QUADRICS],
155 [AC_MSG_CHECKING([for QsNet sources])
157 AC_HELP_STRING([--with-qsnet=path],
158 [set path to qsnet source (default=$LINUX)]),
161 AC_MSG_RESULT([$QSNET])
163 AC_MSG_CHECKING([if quadrics kernel headers are present])
164 if test -d $QSNET/drivers/net/qsnet ; then
167 AC_MSG_CHECKING([for multirail EKC])
168 if test -f $QSNET/include/elan/epcomms.h; then
169 QSNET=$(readlink --canonicalize $QSNET)
170 AC_MSG_RESULT([supported])
171 QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
173 AC_MSG_RESULT([not supported])
174 AC_MSG_ERROR([Need multirail EKC])
177 if test x$QSNET = x$LINUX ; then
178 LB_LINUX_CONFIG([QSNET],[],[
179 LB_LINUX_CONFIG([QSNET_MODULE],[],[
180 AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswlnd.])
191 AC_SUBST(QSWCPPFLAGS)
199 AC_DEFUN([LN_CONFIG_MX],
200 [AC_MSG_CHECKING([whether to enable Myrinet MX support])
204 AC_HELP_STRING([--with-mx=path],
205 [build mxlnd against path]),
219 if test $ENABLEMX -eq 0; then
220 AC_MSG_RESULT([disabled])
221 elif test ! \( -f ${MXPATH}/include/myriexpress.h -a \
222 -f ${MXPATH}/include/mx_kernel_api.h -a \
223 -f ${MXPATH}/include/mx_pin.h \); then
227 2) AC_MSG_ERROR([Myrinet MX kernel headers not present]);;
228 3) AC_MSG_ERROR([bad --with-mx path]);;
229 *) AC_MSG_ERROR([internal error]);;
232 MXPATH=$(readlink --canonicalize $MXPATH)
233 MXCPPFLAGS="-I$MXPATH/include"
234 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
235 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
236 MXLIBS="-L$MXPATH/lib"
237 LB_LINUX_TRY_COMPILE([
239 #include <mx_extensions.h>
240 #include <myriexpress.h>
244 mx_request_t request;
248 mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
249 mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
250 mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
251 mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
260 2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]);;
261 3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]);;
262 *) AC_MSG_ERROR([internal error]);;
267 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
279 AC_DEFUN([LN_CONFIG_O2IB],
280 [AC_MSG_CHECKING([whether to use Compat RDMA])
283 AC_HELP_STRING([--with-o2ib=path],
284 [build o2iblnd against path]),
287 yes) O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
292 *) O2IBPATHS=$with_o2ib
297 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
300 if test $ENABLEO2IB -eq 0; then
304 for O2IBPATH in $O2IBPATHS; do
305 if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
306 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
307 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
308 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
309 if test \( -d ${O2IBPATH}/kernel_patches -a \
310 -f ${O2IBPATH}/Makefile \); then
312 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%-*}])
318 if ! $o2ib_found; then
322 2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]);;
323 3) AC_MSG_ERROR([bad --with-o2ib path]);;
324 *) AC_MSG_ERROR([internal error]);;
327 compatrdma_found=false
328 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
329 compatrdma_found=true
331 AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
335 if ! $compatrdma_found; then
336 if test -f $O2IBPATH/config.mk; then
337 . $O2IBPATH/config.mk
338 elif test -f $O2IBPATH/ofed_patch.mk; then
339 . $O2IBPATH/ofed_patch.mk
342 case $RHEL_KERNEL_VERSION in
344 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4";;
347 AC_MSG_CHECKING([whether to use any OFED backport headers])
348 if test -n "$BACKPORT_INCLUDES"; then
349 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
350 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
356 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
357 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
358 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include"
360 LB_LINUX_TRY_COMPILE([
361 #include <linux/version.h>
362 #include <linux/pci.h>
363 #include <linux/gfp.h>
364 #ifdef HAVE_COMPAT_RDMA
365 #include <linux/compat-2.6.h>
367 #include <rdma/rdma_cm.h>
368 #include <rdma/ib_cm.h>
369 #include <rdma/ib_verbs.h>
370 #include <rdma/ib_fmr_pool.h>
372 struct rdma_cm_id *cm_idi __attribute__ ((unused));
373 struct rdma_conn_param conn_param __attribute__ ((unused));
374 struct ib_device_attr device_attr __attribute__ ((unused));
375 struct ib_qp_attr qp_attr __attribute__ ((unused));
376 struct ib_pool_fmr pool_fmr __attribute__ ((unused));
377 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
379 rdma_destroy_id(NULL);
387 2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]);;
388 3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]);;
389 *) AC_MSG_ERROR([internal error]);;
393 # we know at this point that the found OFED source is good
395 if test $ENABLEO2IB -eq 3 ; then
396 # OFED default rpm not handle sles10 Modules.symvers name
397 for name in Module.symvers Modules.symvers; do
398 if test -f $O2IBPATH/$name; then
403 if test -n "$O2IB_SYMVER"; then
404 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
405 # strip out the existing symbols versions first
406 if test -f $PWD/$SYMVERFILE; then
407 egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
409 touch $PWD/$SYMVERFILE.old
411 cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
412 rm $PWD/$SYMVERFILE.old
414 AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
422 AC_SUBST(EXTRA_OFED_INCLUDE)
425 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
426 if test $ENABLEO2IB -ne 0; then
427 AC_MSG_CHECKING([if rdma_create_id wants four args])
428 LB_LINUX_TRY_COMPILE([
429 #ifdef HAVE_COMPAT_RDMA
430 #include <linux/compat-2.6.h>
432 #include <rdma/rdma_cm.h>
434 rdma_create_id(NULL, NULL, 0, 0);
437 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
438 [rdma_create_id wants 4 args])
448 # check whether to use the RapidArray lnd
450 AC_DEFUN([LN_CONFIG_RALND],
452 AC_MSG_CHECKING([if RapidArray kernel headers are present])
454 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
455 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
456 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
457 LB_LINUX_TRY_COMPILE([
458 #include <linux/types.h>
462 RAP_PVOID dev_handle;
464 rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
466 return rc == RAP_SUCCESS ? 0 : 1;
475 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
483 # check whether to use the Gemini Network Interface lnd
485 AC_DEFUN([LN_CONFIG_GNILND],
486 [#### Gemini Network Interface
487 AC_MSG_CHECKING([whether to enable GNI lnd])
489 AC_HELP_STRING([--enable-gni],
491 [],[enable_gni='no'])
492 AC_MSG_RESULT([$enable_gni])
494 if test x$enable_gni = xyes ; then
495 AC_MSG_CHECKING([if GNI kernel headers are present])
497 # GNICPPFLAGS was set in spec file
498 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
499 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
500 LB_LINUX_TRY_COMPILE([
501 #include <linux/types.h>
504 gni_cdm_handle_t kgni_domain;
508 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
510 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
518 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
520 # at this point, we have gnilnd basic support, now check for extra features
521 AC_MSG_CHECKING([to use RCA in gnilnd])
522 LB_LINUX_TRY_COMPILE([
523 #include <linux/types.h>
525 #include <krca_lib.h>
527 gni_cdm_handle_t kgni_domain;
529 krca_ticket_t ticket = KRCA_NULL_TICKET;
531 __u32 nid = 0, nic_addr;
533 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
535 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
537 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
539 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
544 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
545 GNILNDRCA="gnilndrca"
549 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
551 AC_SUBST(GNICPPFLAGS)
559 # LN_CONFIG_USERSPACE
561 # This is defined but empty because it is called from
562 # build/autconf/lustre-build.m4 which is shared by all branches.
564 AC_DEFUN([LN_CONFIG_USERSPACE],
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_CONFIG_TCP_SENDPAGE
614 AC_DEFUN([LN_PROG_DARWIN],
615 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
621 # default paths for installed files
623 AC_DEFUN([LN_PATH_DEFAULTS],
630 # other configure checks
632 AC_DEFUN([LN_CONFIGURE],
633 [# lnet/utils/portals.c
634 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
635 AC_CHECK_FUNCS([gethostbyname socket connect])
638 AC_CHECK_HEADERS([linux/version.h])
640 # lnet/utils/wirecheck.c
641 AC_CHECK_FUNCS([strnlen])
643 # -------- Check for required packages --------------
648 # Build with readline
650 AC_MSG_CHECKING([whether to enable readline support])
651 AC_ARG_ENABLE(readline,
652 AC_HELP_STRING([--disable-readline],
653 [disable readline support]),
654 [],[enable_readline='yes'])
655 AC_MSG_RESULT([$enable_readline])
657 # -------- check for readline if enabled ----
658 if test x$enable_readline = xyes ; then
660 LIBS="-lncurses $LIBS"
661 AC_CHECK_LIB([readline],[readline],[
662 LIBREADLINE="-lreadline -lncurses"
663 AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
671 AC_SUBST(LIBREADLINE)
673 # -------- enable acceptor libwrap (TCP wrappers) support? -------
674 AC_MSG_CHECKING([if libwrap support is requested])
675 AC_ARG_ENABLE([libwrap],
676 AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
677 [case "${enableval}" in
678 yes) enable_libwrap=yes ;;
679 no) enable_libwrap=no ;;
680 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
681 esac],[enable_libwrap=no])
682 AC_MSG_RESULT([$enable_libwrap])
683 if test x$enable_libwrap = xyes ; then
685 AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
691 # ----------------------------------------
692 # some tests for catamount-like systems
693 # ----------------------------------------
694 AC_ARG_ENABLE([sysio_init],
695 AC_HELP_STRING([--disable-sysio-init],
696 [call sysio init functions when initializing liblustre]),
697 [],[enable_sysio_init=yes])
698 AC_MSG_CHECKING([whether to initialize libsysio])
699 AC_MSG_RESULT([$enable_sysio_init])
700 if test x$enable_sysio_init != xno ; then
701 AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
704 AC_ARG_ENABLE([urandom],
705 AC_HELP_STRING([--disable-urandom],
706 [disable use of /dev/urandom for liblustre]),
707 [],[enable_urandom=yes])
708 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
709 AC_MSG_RESULT([$enable_urandom])
710 if test x$enable_urandom != xno ; then
711 AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
714 # -------- check for -lcap support ----
715 if test x$enable_liblustre = xyes ; then
716 AC_CHECK_LIB([cap], [cap_get_proc],
719 AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
728 LN_CONFIG_MAX_PAYLOAD
735 # AM_CONDITOINAL defines for lnet
737 AC_DEFUN([LN_CONDITIONALS],
738 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
739 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
740 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
741 AM_CONDITIONAL(BUILD_RALND, test x$RALND = "xralnd")
742 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
743 AM_CONDITIONAL(BUILD_GNILND_RCA, test x$GNILNDRCA = "xgnilndrca")
744 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
750 # files that should be generated with AC_OUTPUT
752 AC_DEFUN([LN_CONFIG_FILES],
757 lnet/autoconf/Makefile
759 lnet/include/Makefile
760 lnet/include/lnet/Makefile
761 lnet/include/lnet/linux/Makefile
763 lnet/klnds/autoMakefile
764 lnet/klnds/mxlnd/autoMakefile
765 lnet/klnds/mxlnd/Makefile
766 lnet/klnds/o2iblnd/Makefile
767 lnet/klnds/o2iblnd/autoMakefile
768 lnet/klnds/qswlnd/Makefile
769 lnet/klnds/qswlnd/autoMakefile
770 lnet/klnds/ralnd/Makefile
771 lnet/klnds/ralnd/autoMakefile
772 lnet/klnds/gnilnd/Makefile
773 lnet/klnds/gnilnd/autoMakefile
774 lnet/klnds/socklnd/Makefile
775 lnet/klnds/socklnd/autoMakefile
777 lnet/lnet/autoMakefile
778 lnet/selftest/Makefile
779 lnet/selftest/autoMakefile
781 lnet/ulnds/autoMakefile
782 lnet/ulnds/socklnd/Makefile
784 lnet/include/lnet/darwin/Makefile