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 if test x$RHEL_KERNEL = xyes; then
343 case $RHEL_KERNEL_VERSION in
345 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4";;
347 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_5";;
349 elif test x$SUSE_KERNEL = xyes; then
350 SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
351 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
354 AC_MSG_CHECKING([whether to use any OFED backport headers])
355 if test -n "$BACKPORT_INCLUDES"; then
356 OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
357 EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
363 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
364 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
365 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include"
367 LB_LINUX_TRY_COMPILE([
368 #include <linux/version.h>
369 #include <linux/pci.h>
370 #include <linux/gfp.h>
371 #ifdef HAVE_COMPAT_RDMA
372 #include <linux/compat-2.6.h>
374 #include <rdma/rdma_cm.h>
375 #include <rdma/ib_cm.h>
376 #include <rdma/ib_verbs.h>
377 #include <rdma/ib_fmr_pool.h>
379 struct rdma_cm_id *cm_idi __attribute__ ((unused));
380 struct rdma_conn_param conn_param __attribute__ ((unused));
381 struct ib_device_attr device_attr __attribute__ ((unused));
382 struct ib_qp_attr qp_attr __attribute__ ((unused));
383 struct ib_pool_fmr pool_fmr __attribute__ ((unused));
384 enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
386 rdma_destroy_id(NULL);
394 2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]);;
395 3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]);;
396 *) AC_MSG_ERROR([internal error]);;
400 # we know at this point that the found OFED source is good
402 if test $ENABLEO2IB -eq 3 ; then
403 # OFED default rpm not handle sles10 Modules.symvers name
404 for name in Module.symvers Modules.symvers; do
405 if test -f $O2IBPATH/$name; then
410 if test -n "$O2IB_SYMVER"; then
411 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
412 # strip out the existing symbols versions first
413 if test -f $PWD/$SYMVERFILE; then
414 egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
416 touch $PWD/$SYMVERFILE.old
418 cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
419 rm $PWD/$SYMVERFILE.old
421 AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
429 AC_SUBST(EXTRA_OFED_INCLUDE)
432 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
433 if test $ENABLEO2IB -ne 0; then
434 AC_MSG_CHECKING([if rdma_create_id wants four args])
435 LB_LINUX_TRY_COMPILE([
436 #ifdef HAVE_COMPAT_RDMA
437 #include <linux/compat-2.6.h>
439 #include <rdma/rdma_cm.h>
441 rdma_create_id(NULL, NULL, 0, 0);
444 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
445 [rdma_create_id wants 4 args])
455 # check whether to use the RapidArray lnd
457 AC_DEFUN([LN_CONFIG_RALND],
459 AC_MSG_CHECKING([if RapidArray kernel headers are present])
461 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
462 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
463 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
464 LB_LINUX_TRY_COMPILE([
465 #include <linux/types.h>
469 RAP_PVOID dev_handle;
471 rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
473 return rc == RAP_SUCCESS ? 0 : 1;
482 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
490 # check whether to use the Gemini Network Interface lnd
492 AC_DEFUN([LN_CONFIG_GNILND],
493 [#### Gemini Network Interface
494 AC_MSG_CHECKING([whether to enable GNI lnd])
496 AC_HELP_STRING([--enable-gni],
498 [],[enable_gni='no'])
499 AC_MSG_RESULT([$enable_gni])
501 if test x$enable_gni = xyes ; then
502 AC_MSG_CHECKING([if GNI kernel headers are present])
504 # GNICPPFLAGS was set in spec file
505 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
506 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
507 LB_LINUX_TRY_COMPILE([
508 #include <linux/types.h>
511 gni_cdm_handle_t kgni_domain;
515 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
517 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
525 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
527 # at this point, we have gnilnd basic support, now check for extra features
528 AC_MSG_CHECKING([to use RCA in gnilnd])
529 LB_LINUX_TRY_COMPILE([
530 #include <linux/types.h>
532 #include <krca_lib.h>
534 gni_cdm_handle_t kgni_domain;
536 krca_ticket_t ticket = KRCA_NULL_TICKET;
538 __u32 nid = 0, nic_addr;
540 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
542 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
544 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
546 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
551 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
552 GNILNDRCA="gnilndrca"
556 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
558 AC_SUBST(GNICPPFLAGS)
566 # LN_CONFIG_USERSPACE
568 # This is defined but empty because it is called from
569 # build/autconf/lustre-build.m4 which is shared by all branches.
571 AC_DEFUN([LN_CONFIG_USERSPACE],
576 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
578 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE],
579 [AC_MSG_CHECKING([if tcp_sendpage first parameter is socket])
580 tmp_flags="$EXTRA_KCFLAGS"
581 EXTRA_KCFLAGS="-Werror"
582 LB_LINUX_TRY_COMPILE([
583 #include <linux/net.h>
586 tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
589 AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
590 [tcp_sendpage use socket as first parameter])
594 EXTRA_KCFLAGS="$tmp_flags"
600 # LNet linux kernel checks
602 AC_DEFUN([LN_PROG_LINUX],
604 LN_FUNC_DEV_GET_BY_NAME_2ARG
613 LN_CONFIG_TCP_SENDPAGE
621 AC_DEFUN([LN_PROG_DARWIN],
622 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
628 # default paths for installed files
630 AC_DEFUN([LN_PATH_DEFAULTS],
637 # other configure checks
639 AC_DEFUN([LN_CONFIGURE],
640 [# lnet/utils/portals.c
641 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
642 AC_CHECK_FUNCS([gethostbyname socket connect])
645 AC_CHECK_HEADERS([linux/version.h])
647 # lnet/utils/wirecheck.c
648 AC_CHECK_FUNCS([strnlen])
650 # -------- Check for required packages --------------
655 # Build with readline
657 AC_MSG_CHECKING([whether to enable readline support])
658 AC_ARG_ENABLE(readline,
659 AC_HELP_STRING([--disable-readline],
660 [disable readline support]),
661 [],[enable_readline='yes'])
662 AC_MSG_RESULT([$enable_readline])
664 # -------- check for readline if enabled ----
665 if test x$enable_readline = xyes ; then
667 LIBS="-lncurses $LIBS"
668 AC_CHECK_LIB([readline],[readline],[
669 LIBREADLINE="-lreadline -lncurses"
670 AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
678 AC_SUBST(LIBREADLINE)
680 # -------- enable acceptor libwrap (TCP wrappers) support? -------
681 AC_MSG_CHECKING([if libwrap support is requested])
682 AC_ARG_ENABLE([libwrap],
683 AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
684 [case "${enableval}" in
685 yes) enable_libwrap=yes ;;
686 no) enable_libwrap=no ;;
687 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
688 esac],[enable_libwrap=no])
689 AC_MSG_RESULT([$enable_libwrap])
690 if test x$enable_libwrap = xyes ; then
692 AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
698 # ----------------------------------------
699 # some tests for catamount-like systems
700 # ----------------------------------------
701 AC_ARG_ENABLE([sysio_init],
702 AC_HELP_STRING([--disable-sysio-init],
703 [call sysio init functions when initializing liblustre]),
704 [],[enable_sysio_init=yes])
705 AC_MSG_CHECKING([whether to initialize libsysio])
706 AC_MSG_RESULT([$enable_sysio_init])
707 if test x$enable_sysio_init != xno ; then
708 AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
711 AC_ARG_ENABLE([urandom],
712 AC_HELP_STRING([--disable-urandom],
713 [disable use of /dev/urandom for liblustre]),
714 [],[enable_urandom=yes])
715 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
716 AC_MSG_RESULT([$enable_urandom])
717 if test x$enable_urandom != xno ; then
718 AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
721 # -------- check for -lcap support ----
722 if test x$enable_liblustre = xyes ; then
723 AC_CHECK_LIB([cap], [cap_get_proc],
726 AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
735 LN_CONFIG_MAX_PAYLOAD
742 # AM_CONDITOINAL defines for lnet
744 AC_DEFUN([LN_CONDITIONALS],
745 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
746 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
747 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
748 AM_CONDITIONAL(BUILD_RALND, test x$RALND = "xralnd")
749 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
750 AM_CONDITIONAL(BUILD_GNILND_RCA, test x$GNILNDRCA = "xgnilndrca")
751 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
757 # files that should be generated with AC_OUTPUT
759 AC_DEFUN([LN_CONFIG_FILES],
764 lnet/autoconf/Makefile
766 lnet/include/Makefile
767 lnet/include/lnet/Makefile
768 lnet/include/lnet/linux/Makefile
770 lnet/klnds/autoMakefile
771 lnet/klnds/mxlnd/autoMakefile
772 lnet/klnds/mxlnd/Makefile
773 lnet/klnds/o2iblnd/Makefile
774 lnet/klnds/o2iblnd/autoMakefile
775 lnet/klnds/qswlnd/Makefile
776 lnet/klnds/qswlnd/autoMakefile
777 lnet/klnds/ralnd/Makefile
778 lnet/klnds/ralnd/autoMakefile
779 lnet/klnds/gnilnd/Makefile
780 lnet/klnds/gnilnd/autoMakefile
781 lnet/klnds/socklnd/Makefile
782 lnet/klnds/socklnd/autoMakefile
784 lnet/lnet/autoMakefile
785 lnet/selftest/Makefile
786 lnet/selftest/autoMakefile
788 lnet/ulnds/autoMakefile
789 lnet/ulnds/socklnd/Makefile
791 lnet/include/lnet/darwin/Makefile