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";;
346 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_5";;
349 AC_MSG_CHECKING([whether to use any OFED backport headers])
350 if test -n "$BACKPORT_INCLUDES"; then
351 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
352 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
358 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
359 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
360 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include"
362 LB_LINUX_TRY_COMPILE([
363 #include <linux/version.h>
364 #include <linux/pci.h>
365 #include <linux/gfp.h>
366 #ifdef HAVE_COMPAT_RDMA
367 #include <linux/compat-2.6.h>
369 #include <rdma/rdma_cm.h>
370 #include <rdma/ib_cm.h>
371 #include <rdma/ib_verbs.h>
372 #include <rdma/ib_fmr_pool.h>
374 struct rdma_cm_id *cm_idi __attribute__ ((unused));
375 struct rdma_conn_param conn_param __attribute__ ((unused));
376 struct ib_device_attr device_attr __attribute__ ((unused));
377 struct ib_qp_attr qp_attr __attribute__ ((unused));
378 struct ib_pool_fmr pool_fmr __attribute__ ((unused));
379 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
381 rdma_destroy_id(NULL);
389 2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]);;
390 3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]);;
391 *) AC_MSG_ERROR([internal error]);;
395 # we know at this point that the found OFED source is good
397 if test $ENABLEO2IB -eq 3 ; then
398 # OFED default rpm not handle sles10 Modules.symvers name
399 for name in Module.symvers Modules.symvers; do
400 if test -f $O2IBPATH/$name; then
405 if test -n "$O2IB_SYMVER"; then
406 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
407 # strip out the existing symbols versions first
408 if test -f $PWD/$SYMVERFILE; then
409 egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
411 touch $PWD/$SYMVERFILE.old
413 cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
414 rm $PWD/$SYMVERFILE.old
416 AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
424 AC_SUBST(EXTRA_OFED_INCLUDE)
427 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
428 if test $ENABLEO2IB -ne 0; then
429 AC_MSG_CHECKING([if rdma_create_id wants four args])
430 LB_LINUX_TRY_COMPILE([
431 #ifdef HAVE_COMPAT_RDMA
432 #include <linux/compat-2.6.h>
434 #include <rdma/rdma_cm.h>
436 rdma_create_id(NULL, NULL, 0, 0);
439 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
440 [rdma_create_id wants 4 args])
450 # check whether to use the RapidArray lnd
452 AC_DEFUN([LN_CONFIG_RALND],
454 AC_MSG_CHECKING([if RapidArray kernel headers are present])
456 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
457 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
458 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
459 LB_LINUX_TRY_COMPILE([
460 #include <linux/types.h>
464 RAP_PVOID dev_handle;
466 rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
468 return rc == RAP_SUCCESS ? 0 : 1;
477 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
485 # check whether to use the Gemini Network Interface lnd
487 AC_DEFUN([LN_CONFIG_GNILND],
488 [#### Gemini Network Interface
489 AC_MSG_CHECKING([whether to enable GNI lnd])
491 AC_HELP_STRING([--enable-gni],
493 [],[enable_gni='no'])
494 AC_MSG_RESULT([$enable_gni])
496 if test x$enable_gni = xyes ; then
497 AC_MSG_CHECKING([if GNI kernel headers are present])
499 # GNICPPFLAGS was set in spec file
500 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
501 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
502 LB_LINUX_TRY_COMPILE([
503 #include <linux/types.h>
506 gni_cdm_handle_t kgni_domain;
510 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
512 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
520 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
522 # at this point, we have gnilnd basic support, now check for extra features
523 AC_MSG_CHECKING([to use RCA in gnilnd])
524 LB_LINUX_TRY_COMPILE([
525 #include <linux/types.h>
527 #include <krca_lib.h>
529 gni_cdm_handle_t kgni_domain;
531 krca_ticket_t ticket = KRCA_NULL_TICKET;
533 __u32 nid = 0, nic_addr;
535 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
537 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
539 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
541 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
546 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
547 GNILNDRCA="gnilndrca"
551 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
553 AC_SUBST(GNICPPFLAGS)
561 # LN_CONFIG_USERSPACE
563 # This is defined but empty because it is called from
564 # build/autconf/lustre-build.m4 which is shared by all branches.
566 AC_DEFUN([LN_CONFIG_USERSPACE],
571 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
573 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE],
574 [AC_MSG_CHECKING([if tcp_sendpage first parameter is socket])
575 tmp_flags="$EXTRA_KCFLAGS"
576 EXTRA_KCFLAGS="-Werror"
577 LB_LINUX_TRY_COMPILE([
578 #include <linux/net.h>
581 tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
584 AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
585 [tcp_sendpage use socket as first parameter])
589 EXTRA_KCFLAGS="$tmp_flags"
595 # LNet linux kernel checks
597 AC_DEFUN([LN_PROG_LINUX],
599 LN_FUNC_DEV_GET_BY_NAME_2ARG
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 # lnet/utils/wirecheck.c
643 AC_CHECK_FUNCS([strnlen])
645 # -------- Check for required packages --------------
650 # Build with readline
652 AC_MSG_CHECKING([whether to enable readline support])
653 AC_ARG_ENABLE(readline,
654 AC_HELP_STRING([--disable-readline],
655 [disable readline support]),
656 [],[enable_readline='yes'])
657 AC_MSG_RESULT([$enable_readline])
659 # -------- check for readline if enabled ----
660 if test x$enable_readline = xyes ; then
662 LIBS="-lncurses $LIBS"
663 AC_CHECK_LIB([readline],[readline],[
664 LIBREADLINE="-lreadline -lncurses"
665 AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
673 AC_SUBST(LIBREADLINE)
675 # -------- enable acceptor libwrap (TCP wrappers) support? -------
676 AC_MSG_CHECKING([if libwrap support is requested])
677 AC_ARG_ENABLE([libwrap],
678 AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
679 [case "${enableval}" in
680 yes) enable_libwrap=yes ;;
681 no) enable_libwrap=no ;;
682 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
683 esac],[enable_libwrap=no])
684 AC_MSG_RESULT([$enable_libwrap])
685 if test x$enable_libwrap = xyes ; then
687 AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
693 # ----------------------------------------
694 # some tests for catamount-like systems
695 # ----------------------------------------
696 AC_ARG_ENABLE([sysio_init],
697 AC_HELP_STRING([--disable-sysio-init],
698 [call sysio init functions when initializing liblustre]),
699 [],[enable_sysio_init=yes])
700 AC_MSG_CHECKING([whether to initialize libsysio])
701 AC_MSG_RESULT([$enable_sysio_init])
702 if test x$enable_sysio_init != xno ; then
703 AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
706 AC_ARG_ENABLE([urandom],
707 AC_HELP_STRING([--disable-urandom],
708 [disable use of /dev/urandom for liblustre]),
709 [],[enable_urandom=yes])
710 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
711 AC_MSG_RESULT([$enable_urandom])
712 if test x$enable_urandom != xno ; then
713 AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
716 # -------- check for -lcap support ----
717 if test x$enable_liblustre = xyes ; then
718 AC_CHECK_LIB([cap], [cap_get_proc],
721 AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
730 LN_CONFIG_MAX_PAYLOAD
737 # AM_CONDITOINAL defines for lnet
739 AC_DEFUN([LN_CONDITIONALS],
740 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
741 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
742 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
743 AM_CONDITIONAL(BUILD_RALND, test x$RALND = "xralnd")
744 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
745 AM_CONDITIONAL(BUILD_GNILND_RCA, test x$GNILNDRCA = "xgnilndrca")
746 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
752 # files that should be generated with AC_OUTPUT
754 AC_DEFUN([LN_CONFIG_FILES],
759 lnet/autoconf/Makefile
761 lnet/include/Makefile
762 lnet/include/lnet/Makefile
763 lnet/include/lnet/linux/Makefile
765 lnet/klnds/autoMakefile
766 lnet/klnds/mxlnd/autoMakefile
767 lnet/klnds/mxlnd/Makefile
768 lnet/klnds/o2iblnd/Makefile
769 lnet/klnds/o2iblnd/autoMakefile
770 lnet/klnds/qswlnd/Makefile
771 lnet/klnds/qswlnd/autoMakefile
772 lnet/klnds/ralnd/Makefile
773 lnet/klnds/ralnd/autoMakefile
774 lnet/klnds/gnilnd/Makefile
775 lnet/klnds/gnilnd/autoMakefile
776 lnet/klnds/socklnd/Makefile
777 lnet/klnds/socklnd/autoMakefile
779 lnet/lnet/autoMakefile
780 lnet/selftest/Makefile
781 lnet/selftest/autoMakefile
783 lnet/ulnds/autoMakefile
784 lnet/ulnds/socklnd/Makefile
786 lnet/include/lnet/darwin/Makefile