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])
47 # whether to enable various libcfs debugs (CDEBUG, ENTRY/EXIT, LASSERT, etc.)
49 AC_DEFUN([LN_CONFIG_CDEBUG],
51 AC_MSG_CHECKING([whether to enable CDEBUG, CWARN])
52 AC_ARG_ENABLE([libcfs_cdebug],
53 AC_HELP_STRING([--disable-libcfs-cdebug],
54 [disable libcfs CDEBUG, CWARN]),
55 [],[enable_libcfs_cdebug='yes'])
56 AC_MSG_RESULT([$enable_libcfs_cdebug])
57 if test x$enable_libcfs_cdebug = xyes; then
58 AC_DEFINE(CDEBUG_ENABLED, 1, [enable libcfs CDEBUG, CWARN])
60 AC_DEFINE(CDEBUG_ENABLED, 0, [disable libcfs CDEBUG, CWARN])
63 AC_MSG_CHECKING([whether to enable ENTRY/EXIT])
64 AC_ARG_ENABLE([libcfs_trace],
65 AC_HELP_STRING([--disable-libcfs-trace],
66 [disable libcfs ENTRY/EXIT]),
67 [],[enable_libcfs_trace='yes'])
68 AC_MSG_RESULT([$enable_libcfs_trace])
69 if test x$enable_libcfs_trace = xyes; then
70 AC_DEFINE(CDEBUG_ENTRY_EXIT, 1, [enable libcfs ENTRY/EXIT])
72 AC_DEFINE(CDEBUG_ENTRY_EXIT, 0, [disable libcfs ENTRY/EXIT])
75 AC_MSG_CHECKING([whether to enable LASSERT, LASSERTF])
76 AC_ARG_ENABLE([libcfs_assert],
77 AC_HELP_STRING([--disable-libcfs-assert],
78 [disable libcfs LASSERT, LASSERTF]),
79 [],[enable_libcfs_assert='yes'])
80 AC_MSG_RESULT([$enable_libcfs_assert])
81 if test x$enable_libcfs_assert = xyes; then
82 AC_DEFINE(LIBCFS_DEBUG, 1, [enable libcfs LASSERT, LASSERTF])
89 # check if cpu affinity is available/wanted
91 AC_DEFUN([LN_CONFIG_AFFINITY],
92 [AC_ARG_ENABLE([affinity],
93 AC_HELP_STRING([--disable-affinity],
94 [disable process/irq affinity]),
95 [],[enable_affinity='yes'])
97 AC_MSG_CHECKING([for CPU affinity support])
98 if test x$enable_affinity = xno ; then
99 AC_MSG_RESULT([no (by request)])
101 LB_LINUX_TRY_COMPILE([
102 #include <linux/sched.h>
104 struct task_struct t;
110 set_cpus_allowed(&t, m);
112 AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
115 AC_MSG_RESULT([no (no kernel support)])
123 # configure support for Portals
125 AC_DEFUN([LN_CONFIG_PORTALS],
126 [AC_MSG_CHECKING([for portals])
127 AC_ARG_WITH([portals],
128 AC_HELP_STRING([--with-portals=path],
129 [set path to portals]),
131 case $with_portals in
134 *) PORTALS="${with_portals}"
142 if test $ENABLEPORTALS -eq 0; then
144 elif test ! \( -f ${PORTALS}/include/portals/p30.h \); then
146 AC_MSG_ERROR([bad --with-portals path])
148 AC_MSG_RESULT([$PORTALS])
149 PTLLNDCPPFLAGS="-I${PORTALS}/include"
151 AC_SUBST(PTLLNDCPPFLAGS)
157 # check if tunable tcp backoff is available/wanted
159 AC_DEFUN([LN_CONFIG_BACKOFF],
160 [AC_MSG_CHECKING([for tunable backoff TCP support])
161 AC_ARG_ENABLE([backoff],
162 AC_HELP_STRING([--disable-backoff],
163 [disable socknal tunable backoff]),
164 [],[enable_backoff='yes'])
165 if test x$enable_backoff = xno ; then
166 AC_MSG_RESULT([no (by request)])
168 BOCD="`grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h`"
169 if test "$BOCD" != 0 ; then
170 AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
173 AC_MSG_RESULT([no (no kernel support)])
179 # LN_CONFIG_PANIC_DUMPLOG
181 # check if tunable panic_dumplog is wanted
183 AC_DEFUN([LN_CONFIG_PANIC_DUMPLOG],
184 [AC_MSG_CHECKING([for tunable panic_dumplog support])
185 AC_ARG_ENABLE([panic_dumplog],
186 AC_HELP_STRING([--enable-panic_dumplog],
187 [enable panic_dumplog]),
188 [],[enable_panic_dumplog='no'])
189 if test x$enable_panic_dumplog = xyes ; then
190 AC_DEFINE(LNET_DUMP_ON_PANIC, 1, [use dumplog on panic])
191 AC_MSG_RESULT([yes (by request)])
200 # configure support for Portals LND
202 AC_DEFUN([LN_CONFIG_PTLLND],
204 if test -z "$ENABLEPORTALS"; then
208 AC_MSG_CHECKING([whether to build the kernel portals LND])
211 if test $ENABLEPORTALS -ne 0; then
223 # configure support for Portals LND
225 AC_DEFUN([LN_CONFIG_UPTLLND],
227 if test -z "$ENABLEPORTALS"; then
231 AC_MSG_CHECKING([whether to build the userspace portals LND])
234 if test $ENABLEPORTALS -ne 0; then
246 # configure support for userspace TCP/IP LND
248 AC_DEFUN([LN_CONFIG_USOCKLND],
249 [AC_MSG_CHECKING([whether to build usocklnd])
250 AC_ARG_ENABLE([usocklnd],
251 AC_HELP_STRING([--disable-usocklnd],
253 [],[enable_usocklnd='yes'])
255 if test x$enable_usocklnd = xyes ; then
256 if test "$ENABLE_LIBPTHREAD" = "yes" ; then
260 AC_MSG_RESULT([no (libpthread not present or disabled)])
264 AC_MSG_RESULT([no (disabled explicitly)])
273 # check if quadrics support is in this kernel
275 AC_DEFUN([LN_CONFIG_QUADRICS],
276 [AC_MSG_CHECKING([for QsNet sources])
278 AC_HELP_STRING([--with-qsnet=path],
279 [set path to qsnet source (default=$LINUX)]),
282 AC_MSG_RESULT([$QSNET])
284 AC_MSG_CHECKING([if quadrics kernel headers are present])
285 if test -d $QSNET/drivers/net/qsnet ; then
288 AC_MSG_CHECKING([for multirail EKC])
289 if test -f $QSNET/include/elan/epcomms.h; then
290 AC_MSG_RESULT([supported])
291 QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
293 AC_MSG_RESULT([not supported])
294 AC_MSG_ERROR([Need multirail EKC])
297 if test x$QSNET = x$LINUX ; then
298 LB_LINUX_CONFIG([QSNET],[],[
299 LB_LINUX_CONFIG([QSNET_MODULE],[],[
300 AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswlnd.])
311 AC_SUBST(QSWCPPFLAGS)
318 # check if GM support is available
320 AC_DEFUN([LN_CONFIG_GM],[
321 AC_MSG_CHECKING([whether to enable GM support])
323 AC_HELP_STRING([--with-gm=path-to-gm-source-tree],
324 [build gmlnd against path]),
336 AC_ARG_WITH([gm-install],
337 AC_HELP_STRING([--with-gm-install=path-to-gm-install-tree],
338 [say where GM has been installed]),
340 GM_INSTALL=$with_gm_install
344 if test $ENABLE_GM -eq 0; then
350 GMCPPFLAGS="-I$GM_SRC/include -I$GM_SRC/drivers -I$GM_SRC/drivers/linux/gm"
352 if test -f $GM_INSTALL/lib/libgm.a -o \
353 -f $GM_INSTALL/lib64/libgm.a; then
354 GMLIBS="-L$GM_INSTALL/lib -L$GM_INSTALL/lib64"
356 AC_MSG_ERROR([Cant find GM libraries under $GM_INSTALL])
359 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
360 EXTRA_KCFLAGS="$GMCPPFLAGS -DGM_KERNEL $EXTRA_KCFLAGS"
362 AC_MSG_CHECKING([that code using GM compiles with given path])
363 LB_LINUX_TRY_COMPILE([
364 #define GM_STRONG_TYPES 1
369 #include "gm_internal.h"
371 struct gm_port *port = NULL;
372 gm_recv_event_t *rxevent = gm_blocking_receive_no_spin(port);
378 AC_MSG_ERROR([Bad --with-gm path])
381 AC_MSG_CHECKING([that GM has gm_register_memory_ex_phys()])
382 LB_LINUX_TRY_COMPILE([
383 #define GM_STRONG_TYPES 1
388 #include "gm_internal.h"
391 struct gm_port *port = NULL;
395 gmrc = gm_register_memory_ex_phys(port, phys, 100, pvma);
401 Please patch the GM sources as follows...
403 patch -p0 < $PWD/lnet/klnds/gmlnd/gm-reg-phys.patch
404 ...then rebuild and re-install them])
405 AC_MSG_ERROR([Can't build GM without gm_register_memory_ex_phys()])
408 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
419 AC_DEFUN([LN_CONFIG_MX],
420 [AC_MSG_CHECKING([whether to enable Myrinet MX support])
424 AC_HELP_STRING([--with-mx=path],
425 [build mxlnd against path]),
439 if test $ENABLEMX -eq 0; then
440 AC_MSG_RESULT([disabled])
441 elif test ! \( -f ${MXPATH}/include/myriexpress.h -a \
442 -f ${MXPATH}/include/mx_kernel_api.h -a \
443 -f ${MXPATH}/include/mx_pin.h \); then
447 2) AC_MSG_ERROR([Myrinet MX kernel headers not present]);;
448 3) AC_MSG_ERROR([bad --with-mx path]);;
449 *) AC_MSG_ERROR([internal error]);;
452 MXCPPFLAGS="-I$MXPATH/include"
453 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
454 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
455 MXLIBS="-L$MXPATH/lib"
456 LB_LINUX_TRY_COMPILE([
458 #include <mx_extensions.h>
459 #include <myriexpress.h>
463 mx_request_t request;
467 mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
468 mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
469 mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
470 mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
479 2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]);;
480 3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]);;
481 *) AC_MSG_ERROR([internal error]);;
486 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
498 AC_DEFUN([LN_CONFIG_O2IB],[
499 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
502 AC_HELP_STRING([--with-o2ib=path],
503 [build o2iblnd against path]),
506 yes) O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
511 *) O2IBPATHS=$with_o2ib
516 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
519 if test $ENABLEO2IB -eq 0; then
520 AC_MSG_RESULT([disabled])
523 for O2IBPATH in $O2IBPATHS; do
524 if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
525 -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
526 -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
527 -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
532 if ! $o2ib_found; then
536 2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]);;
537 3) AC_MSG_ERROR([bad --with-o2ib path]);;
538 *) AC_MSG_ERROR([internal error]);;
541 O2IBCPPFLAGS="-I$O2IBPATH/include"
542 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
543 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $O2IBCPPFLAGS"
544 EXTRA_LNET_INCLUDE="$O2IBCPPFLAGS $EXTRA_LNET_INCLUDE"
545 LB_LINUX_TRY_COMPILE([
546 #include <linux/version.h>
547 #include <linux/pci.h>
551 #include <rdma/rdma_cm.h>
552 #include <rdma/ib_cm.h>
553 #include <rdma/ib_verbs.h>
554 #include <rdma/ib_fmr_pool.h>
556 struct rdma_cm_id *cm_id;
557 struct rdma_conn_param conn_param;
558 struct ib_device_attr device_attr;
559 struct ib_qp_attr qp_attr;
560 struct ib_pool_fmr pool_fmr;
561 enum ib_cm_rej_reason rej_reason;
563 cm_id = rdma_create_id(NULL, NULL, RDMA_PS_TCP);
564 return PTR_ERR(cm_id);
572 2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]);;
573 3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]);;
574 *) AC_MSG_ERROR([internal error]);;
580 # version checking is a hack and isn't reliable,
581 # we need verify it with each new ofed release
583 if grep -q ib_dma_map_single \
584 ${O2IBPATH}/include/rdma/ib_verbs.h; then
585 if grep -q comp_vector \
586 ${O2IBPATH}/include/rdma/ib_verbs.h; then
587 IBLND_OFED_VERSION="1025"
589 IBLND_OFED_VERSION="1020"
592 IBLND_OFED_VERSION="1010"
595 AC_DEFINE_UNQUOTED(IBLND_OFED_VERSION, $IBLND_OFED_VERSION,
598 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
602 AC_SUBST(EXTRA_LNET_INCLUDE)
603 AC_SUBST(O2IBCPPFLAGS)
610 # check for OpenIB in the kernel
611 AC_DEFUN([LN_CONFIG_OPENIB],[
612 AC_MSG_CHECKING([whether to enable OpenIB support])
614 OPENIBPATH="$LINUX/drivers/infiniband"
615 AC_ARG_WITH([openib],
616 AC_HELP_STRING([--with-openib=path],
617 [build openiblnd against path]),
624 *) OPENIBPATH="$with_openib"
631 if test $ENABLEOPENIB -eq 0; then
632 AC_MSG_RESULT([disabled])
633 elif test ! \( -f ${OPENIBPATH}/include/ts_ib_core.h -a \
634 -f ${OPENIBPATH}/include/ts_ib_cm.h -a\
635 -f ${OPENIBPATH}/include/ts_ib_sa_client.h \); then
637 case $ENABLEOPENIB in
639 2) AC_MSG_ERROR([kernel OpenIB headers not present]);;
640 3) AC_MSG_ERROR([bad --with-openib path]);;
641 *) AC_MSG_ERROR([internal error]);;
644 case $ENABLEOPENIB in
645 1|2) OPENIBCPPFLAGS="-I$OPENIBPATH/include -DIN_TREE_BUILD";;
646 3) OPENIBCPPFLAGS="-I$OPENIBPATH/include";;
647 *) AC_MSG_RESULT([no])
648 AC_MSG_ERROR([internal error]);;
650 OPENIBCPPFLAGS="$OPENIBCPPFLAGS -DIB_NTXRXPARAMS=4"
651 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
652 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $OPENIBCPPFLAGS"
653 LB_LINUX_TRY_COMPILE([
654 #include <ts_ib_core.h>
655 #include <ts_ib_cm.h>
656 #include <ts_ib_sa_client.h>
658 struct ib_device_properties dev_props;
659 struct ib_cm_active_param cm_active_params;
660 tTS_IB_CLIENT_QUERY_TID tid;
661 int enum1 = IB_QP_ATTRIBUTE_STATE;
662 int enum2 = IB_ACCESS_LOCAL_WRITE;
663 int enum3 = IB_CQ_CALLBACK_INTERRUPT;
664 int enum4 = IB_CQ_PROVIDER_REARM;
668 OPENIBLND="openiblnd"
671 case $ENABLEOPENIB in
673 2) AC_MSG_ERROR([can't compile with kernel OpenIB headers]);;
674 3) AC_MSG_ERROR([can't compile with OpenIB headers under $OPENIBPATH]);;
675 *) AC_MSG_ERROR([internal error]);;
680 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
682 AC_SUBST(OPENIBCPPFLAGS)
689 AC_DEFUN([LN_CONFIG_CIB],[
690 AC_MSG_CHECKING([whether to enable Cisco/TopSpin IB support])
695 AC_HELP_STRING([--with-cib=path],
696 [build ciblnd against path]),
699 no) AC_MSG_RESULT([no]);;
700 *) CIBPATH="$with_cib"
701 if test -d "$CIBPATH"; then
705 AC_MSG_ERROR([No directory $CIBPATH])
711 if test -n "$CIBPATH"; then
712 CIBCPPFLAGS="-I${CIBPATH}/ib/ts_api_ng/include -I${CIBPATH}/all/kernel_services/include -DUSING_TSAPI"
713 CIBCPPFLAGS="$CIBCPPFLAGS -DIB_NTXRXPARAMS=3"
714 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
715 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $CIBCPPFLAGS"
716 LB_LINUX_TRY_COMPILE([
717 #include <ts_ib_core.h>
718 #include <ts_ib_cm.h>
719 #include <ts_ib_sa_client.h>
721 struct ib_device_properties dev_props;
722 struct ib_cm_active_param cm_active_params;
723 tTS_IB_CLIENT_QUERY_TID tid;
724 int enum1 = TS_IB_QP_ATTRIBUTE_STATE;
725 int enum2 = TS_IB_ACCESS_LOCAL_WRITE;
726 int enum3 = TS_IB_CQ_CALLBACK_INTERRUPT;
727 int enum4 = TS_IB_CQ_PROVIDER_REARM;
732 AC_MSG_ERROR([can't compile ciblnd with given path])
735 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
737 AC_SUBST(CIBCPPFLAGS)
744 # check for infinicon infiniband support
746 AC_DEFUN([LN_CONFIG_IIB],[
747 AC_MSG_CHECKING([whether to enable Infinicon support])
749 IIBPATH="/usr/include"
751 AC_HELP_STRING([--with-iib=path],
752 [build iiblnd against path]),
759 *) IIBPATH="${with_iib}/include"
766 if test $ENABLEIIB -eq 0; then
767 AC_MSG_RESULT([disabled])
768 elif test ! \( -f ${IIBPATH}/linux/iba/ibt.h \); then
772 2) AC_MSG_ERROR([default Infinicon headers not present]);;
773 3) AC_MSG_ERROR([bad --with-iib path]);;
774 *) AC_MSG_ERROR([internal error]);;
777 IIBCPPFLAGS="-I$IIBPATH"
778 if test $IIBPATH != "/usr/include"; then
779 # we need /usr/include come what may
780 IIBCPPFLAGS="$IIBCPPFLAGS -I/usr/include"
782 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
783 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $IIBCPPFLAGS"
784 LB_LINUX_TRY_COMPILE([
785 #include <linux/iba/ibt.h>
787 IBT_INTERFACE_UNION interfaces;
790 rc = IbtGetInterfaceByVersion(IBT_INTERFACE_VERSION_2,
793 return rc == FSUCCESS ? 0 : 1;
801 2) AC_MSG_ERROR([can't compile with default Infinicon headers]);;
802 3) AC_MSG_ERROR([can't compile with Infinicon headers under $IIBPATH]);;
803 *) AC_MSG_ERROR([internal error]);;
808 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
810 AC_SUBST(IIBCPPFLAGS)
817 # check for Voltaire infiniband support
819 AC_DEFUN([LN_CONFIG_VIB],
820 [AC_MSG_CHECKING([whether to enable Voltaire IB support])
823 AC_HELP_STRING([--with-vib=path],
824 [build viblnd against path]),
827 no) AC_MSG_RESULT([no]);;
828 *) VIBPATH="${with_vib}/src/nvigor/ib-code"
829 if test -d "$with_vib" -a -d "$VIBPATH"; then
833 AC_MSG_ERROR([No directory $VIBPATH])
839 if test -z "$VIBPATH"; then
842 VIBCPPFLAGS="-I${VIBPATH}/include -I${VIBPATH}/cm"
843 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
844 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
845 LB_LINUX_TRY_COMPILE([
846 #include <linux/list.h>
847 #include <asm/byteorder.h>
852 #ifdef __LITTLE_ENDIAN
863 ibat_arp_data_t arp_data;
866 vvrc = vv_hca_open("ANY_HCA", NULL, &kib_hca);
867 cep = cm_create_cep(cm_cep_transp_rc);
868 ibatrc = ibat_get_ib_data((uint32_t)0, (uint32_t)0,
869 ibat_paths_primary, &arp_data,
870 (ibat_get_ib_data_reply_fn_t)NULL,
876 AC_MSG_ERROR([can't compile viblnd with given path])
878 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
880 if test -n "$VIBLND"; then
881 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
882 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
883 AC_MSG_CHECKING([if Voltaire still uses void * sg addresses])
884 LB_LINUX_TRY_COMPILE([
885 #include <linux/list.h>
886 #include <asm/byteorder.h>
891 #ifdef __LITTLE_ENDIAN
901 return &sg.v_address[3] == NULL;
904 VIBCPPFLAGS="$VIBCPPFLAGS -DIBNAL_VOIDSTAR_SGADDR=1"
908 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
910 AC_SUBST(VIBCPPFLAGS)
917 # check whether to use the RapidArray lnd
919 AC_DEFUN([LN_CONFIG_RALND],
921 AC_MSG_CHECKING([if RapidArray kernel headers are present])
923 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
924 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
925 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
926 LB_LINUX_TRY_COMPILE([
927 #include <linux/types.h>
931 RAP_PVOID dev_handle;
933 rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
935 return rc == RAP_SUCCESS ? 0 : 1;
944 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
950 # LN_STRUCT_PAGE_LIST
952 # 2.6.4 no longer has page->list
954 AC_DEFUN([LN_STRUCT_PAGE_LIST],
955 [AC_MSG_CHECKING([if struct page has a list field])
956 LB_LINUX_TRY_COMPILE([
957 #include <linux/mm.h>
963 AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
972 # red hat 2.4 adds sighand to struct task_struct
974 AC_DEFUN([LN_STRUCT_SIGHAND],
975 [AC_MSG_CHECKING([if task_struct has a sighand field])
976 LB_LINUX_TRY_COMPILE([
977 #include <linux/sched.h>
979 struct task_struct p;
982 AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
992 # cpu_online is different in rh 2.4, vanilla 2.4, and 2.6
994 AC_DEFUN([LN_FUNC_CPU_ONLINE],
995 [AC_MSG_CHECKING([if kernel defines cpu_online()])
996 LB_LINUX_TRY_COMPILE([
997 #include <linux/sched.h>
1001 AC_MSG_RESULT([yes])
1002 AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
1011 # check if gfp_t is typedef-ed
1013 AC_DEFUN([LN_TYPE_GFP_T],
1014 [AC_MSG_CHECKING([if kernel defines gfp_t])
1015 LB_LINUX_TRY_COMPILE([
1016 #include <linux/gfp.h>
1018 return sizeof(gfp_t);
1020 AC_MSG_RESULT([yes])
1021 AC_DEFINE(HAVE_GFP_T, 1, [gfp_t found])
1030 # same goes for cpumask_t
1032 AC_DEFUN([LN_TYPE_CPUMASK_T],
1033 [AC_MSG_CHECKING([if kernel defines cpumask_t])
1034 LB_LINUX_TRY_COMPILE([
1035 #include <linux/sched.h>
1037 return sizeof (cpumask_t);
1039 AC_MSG_RESULT([yes])
1040 AC_DEFINE(HAVE_CPUMASK_T, 1, [cpumask_t found])
1049 # we export show_task(), but not all kernels have it (yet)
1051 AC_DEFUN([LN_FUNC_SHOW_TASK],
1052 [LB_CHECK_SYMBOL_EXPORT([show_task],
1053 [kernel/ksyms.c kernel/sched.c],[
1054 AC_DEFINE(HAVE_SHOW_TASK, 1, [show_task is exported])
1059 # check userland __u64 type
1060 AC_DEFUN([LN_U64_LONG_LONG],
1061 [AC_MSG_CHECKING([check u64 is long long type])
1063 CFLAGS="$CFLAGS -Werror"
1065 #include <asm/types.h>
1067 unsigned long long *data1;
1074 AC_MSG_RESULT([yes])
1075 AC_DEFINE(HAVE_U64_LONG_LONG, 1,
1076 [__u64 is long long type])
1083 # 2.6.18 remove tasklist_lock export
1084 AC_DEFUN([LN_TASKLIST_LOCK],
1085 [LB_CHECK_SYMBOL_EXPORT([tasklist_lock],
1087 AC_DEFINE(HAVE_TASKLIST_LOCK, 1,
1088 [tasklist_lock exported])
1093 # 2.6.19 API changes
1094 # kmem_cache_destroy(cachep) return void instead of
1096 AC_DEFUN([LN_KMEM_CACHE_DESTROY_INT],
1097 [AC_MSG_CHECKING([kmem_cache_destroy(cachep) return int])
1098 LB_LINUX_TRY_COMPILE([
1099 #include <linux/slab.h>
1101 int i = kmem_cache_destroy(NULL);
1104 AC_DEFINE(HAVE_KMEM_CACHE_DESTROY_INT, 1,
1105 [kmem_cache_destroy(cachep) return int])
1112 #panic_notifier_list use atomic_notifier operations
1114 AC_DEFUN([LN_ATOMIC_PANIC_NOTIFIER],
1115 [AC_MSG_CHECKING([panic_notifier_list is atomic])
1116 LB_LINUX_TRY_COMPILE([
1117 #include <linux/notifier.h>
1118 #include <linux/kernel.h>
1120 struct atomic_notifier_head panic_notifier_list;
1123 AC_DEFINE(HAVE_ATOMIC_PANIC_NOTIFIER, 1,
1124 [panic_notifier_list is atomic_notifier_head])
1130 # 2.6.20 API change INIT_WORK use 2 args and not
1132 AC_DEFUN([LN_3ARGS_INIT_WORK],
1133 [AC_MSG_CHECKING([check INIT_WORK want 3 args])
1134 LB_LINUX_TRY_COMPILE([
1135 #include <linux/workqueue.h>
1137 struct work_struct work;
1139 INIT_WORK(&work, NULL, NULL);
1142 AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
1143 [INIT_WORK use 3 args and store data inside])
1149 # 2.6.21 api change. 'register_sysctl_table' use only one argument,
1150 # instead of more old which need two.
1151 AC_DEFUN([LN_2ARGS_REGISTER_SYSCTL],
1152 [AC_MSG_CHECKING([check register_sysctl_table want 2 args])
1153 LB_LINUX_TRY_COMPILE([
1154 #include <linux/sysctl.h>
1156 return register_sysctl_table(NULL,0);
1159 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
1160 [register_sysctl_table want 2 args])
1166 # 2.6.21 marks kmem_cache_t deprecated and uses struct kmem_cache
1168 AC_DEFUN([LN_KMEM_CACHE],
1169 [AC_MSG_CHECKING([check kernel has struct kmem_cache])
1170 tmp_flags="$EXTRA_KCFLAGS"
1171 EXTRA_KCFLAGS="-Werror"
1172 LB_LINUX_TRY_COMPILE([
1173 #include <linux/slab.h>
1174 typedef struct kmem_cache cache_t;
1176 cache_t *cachep = NULL;
1178 kmem_cache_alloc(cachep, 0);
1181 AC_DEFINE(HAVE_KMEM_CACHE, 1,
1182 [kernel has struct kmem_cache])
1186 EXTRA_KCFLAGS="$tmp_flags"
1188 # 2.6.23 lost dtor argument
1189 AC_DEFUN([LN_KMEM_CACHE_CREATE_DTOR],
1190 [AC_MSG_CHECKING([check kmem_cache_create has dtor argument])
1191 LB_LINUX_TRY_COMPILE([
1192 #include <linux/slab.h>
1194 kmem_cache_create(NULL, 0, 0, 0, NULL, NULL);
1197 AC_DEFINE(HAVE_KMEM_CACHE_CREATE_DTOR, 1,
1198 [kmem_cache_create has dtor argument])
1207 # LNet linux kernel checks
1209 AC_DEFUN([LN_PROG_LINUX],
1216 LN_CONFIG_PANIC_DUMPLOG
1235 LN_KMEM_CACHE_DESTROY_INT
1236 LN_ATOMIC_PANIC_NOTIFIER
1240 LN_2ARGS_REGISTER_SYSCTL
1243 LN_KMEM_CACHE_CREATE_DTOR
1251 AC_DEFUN([LN_PROG_DARWIN],
1252 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
1258 # default paths for installed files
1260 AC_DEFUN([LN_PATH_DEFAULTS],
1267 # other configure checks
1269 AC_DEFUN([LN_CONFIGURE],
1270 [# lnet/utils/portals.c
1271 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
1272 AC_CHECK_FUNCS([gethostbyname socket connect])
1274 # lnet/utils/debug.c
1275 AC_CHECK_HEADERS([linux/version.h])
1277 AC_CHECK_TYPE([spinlock_t],
1278 [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
1280 [#include <linux/spinlock.h>])
1282 # lnet/utils/wirecheck.c
1283 AC_CHECK_FUNCS([strnlen])
1285 # -------- Check for required packages --------------
1288 # LC_CONFIG_READLINE
1290 # Build with readline
1292 AC_MSG_CHECKING([whether to enable readline support])
1293 AC_ARG_ENABLE(readline,
1294 AC_HELP_STRING([--disable-readline],
1295 [disable readline support]),
1296 [],[enable_readline='yes'])
1297 AC_MSG_RESULT([$enable_readline])
1299 # -------- check for readline if enabled ----
1300 if test x$enable_readline = xyes ; then
1302 LIBS="-lncurses $LIBS"
1303 AC_CHECK_LIB([readline],[readline],[
1304 LIBREADLINE="-lreadline -lncurses"
1305 AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
1313 AC_SUBST(LIBREADLINE)
1315 AC_MSG_CHECKING([if efence debugging support is requested])
1316 AC_ARG_ENABLE(efence,
1317 AC_HELP_STRING([--enable-efence],
1318 [use efence library]),
1319 [],[enable_efence='no'])
1320 AC_MSG_RESULT([$enable_efence])
1321 if test "$enable_efence" = "yes" ; then
1322 LIBEFENCE="-lefence"
1323 AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
1329 # -------- enable acceptor libwrap (TCP wrappers) support? -------
1330 AC_MSG_CHECKING([if libwrap support is requested])
1331 AC_ARG_ENABLE([libwrap],
1332 AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
1333 [case "${enableval}" in
1334 yes) enable_libwrap=yes ;;
1335 no) enable_libwrap=no ;;
1336 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
1337 esac],[enable_libwrap=no])
1338 AC_MSG_RESULT([$enable_libwrap])
1339 if test x$enable_libwrap = xyes ; then
1341 AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
1347 # -------- check for -lpthread support ----
1348 AC_MSG_CHECKING([whether to use libpthread for lnet library])
1349 AC_ARG_ENABLE([libpthread],
1350 AC_HELP_STRING([--disable-libpthread],
1351 [disable libpthread]),
1352 [],[enable_libpthread=yes])
1353 if test "$enable_libpthread" = "yes" ; then
1354 AC_CHECK_LIB([pthread], [pthread_create],
1355 [ENABLE_LIBPTHREAD="yes"],
1356 [ENABLE_LIBPTHREAD="no"])
1357 if test "$ENABLE_LIBPTHREAD" = "yes" ; then
1358 AC_MSG_RESULT([$ENABLE_LIBPTHREAD])
1359 PTHREAD_LIBS="-lpthread"
1360 AC_DEFINE([HAVE_LIBPTHREAD], 1, [use libpthread])
1363 AC_MSG_RESULT([no libpthread is found])
1365 AC_SUBST(PTHREAD_LIBS)
1367 AC_MSG_RESULT([no (disabled explicitly)])
1368 ENABLE_LIBPTHREAD="no"
1370 AC_SUBST(ENABLE_LIBPTHREAD)
1372 # ----------------------------------------
1373 # some tests for catamount-like systems
1374 # ----------------------------------------
1375 AC_ARG_ENABLE([sysio_init],
1376 AC_HELP_STRING([--disable-sysio-init],
1377 [call sysio init functions when initializing liblustre]),
1378 [],[enable_sysio_init=yes])
1379 AC_MSG_CHECKING([whether to initialize libsysio])
1380 AC_MSG_RESULT([$enable_sysio_init])
1381 if test x$enable_sysio_init != xno ; then
1382 AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
1385 AC_ARG_ENABLE([urandom],
1386 AC_HELP_STRING([--disable-urandom],
1387 [disable use of /dev/urandom for liblustre]),
1388 [],[enable_urandom=yes])
1389 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
1390 AC_MSG_RESULT([$enable_urandom])
1391 if test x$enable_urandom != xno ; then
1392 AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
1395 # -------- check for -lcap support ----
1396 if test x$enable_liblustre = xyes ; then
1397 AC_CHECK_LIB([cap], [cap_get_proc],
1400 AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
1409 LN_CONFIG_MAX_PAYLOAD
1417 # AM_CONDITOINAL defines for lnet
1419 AC_DEFUN([LN_CONDITIONALS],
1420 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
1421 AM_CONDITIONAL(BUILD_GMLND, test x$GMLND = "xgmlnd")
1422 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
1423 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
1424 AM_CONDITIONAL(BUILD_OPENIBLND, test x$OPENIBLND = "xopeniblnd")
1425 AM_CONDITIONAL(BUILD_CIBLND, test x$CIBLND = "xciblnd")
1426 AM_CONDITIONAL(BUILD_IIBLND, test x$IIBLND = "xiiblnd")
1427 AM_CONDITIONAL(BUILD_VIBLND, test x$VIBLND = "xviblnd")
1428 AM_CONDITIONAL(BUILD_RALND, test x$RALND = "xralnd")
1429 AM_CONDITIONAL(BUILD_PTLLND, test x$PTLLND = "xptllnd")
1430 AM_CONDITIONAL(BUILD_UPTLLND, test x$UPTLLND = "xptllnd")
1431 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
1437 # files that should be generated with AC_OUTPUT
1439 AC_DEFUN([LN_CONFIG_FILES],
1444 lnet/autoconf/Makefile
1446 lnet/include/Makefile
1447 lnet/include/libcfs/Makefile
1448 lnet/include/libcfs/linux/Makefile
1449 lnet/include/lnet/Makefile
1450 lnet/include/lnet/linux/Makefile
1452 lnet/klnds/autoMakefile
1453 lnet/klnds/gmlnd/Makefile
1454 lnet/klnds/mxlnd/autoMakefile
1455 lnet/klnds/mxlnd/Makefile
1456 lnet/klnds/gmlnd/autoMakefile
1457 lnet/klnds/openiblnd/Makefile
1458 lnet/klnds/openiblnd/autoMakefile
1459 lnet/klnds/o2iblnd/Makefile
1460 lnet/klnds/o2iblnd/autoMakefile
1461 lnet/klnds/ciblnd/Makefile
1462 lnet/klnds/ciblnd/autoMakefile
1463 lnet/klnds/iiblnd/Makefile
1464 lnet/klnds/iiblnd/autoMakefile
1465 lnet/klnds/viblnd/Makefile
1466 lnet/klnds/viblnd/autoMakefile
1467 lnet/klnds/qswlnd/Makefile
1468 lnet/klnds/qswlnd/autoMakefile
1469 lnet/klnds/ralnd/Makefile
1470 lnet/klnds/ralnd/autoMakefile
1471 lnet/klnds/socklnd/Makefile
1472 lnet/klnds/socklnd/autoMakefile
1473 lnet/klnds/ptllnd/Makefile
1474 lnet/klnds/ptllnd/autoMakefile
1475 lnet/libcfs/Makefile
1476 lnet/libcfs/autoMakefile
1477 lnet/libcfs/linux/Makefile
1479 lnet/lnet/autoMakefile
1480 lnet/selftest/Makefile
1481 lnet/selftest/autoMakefile
1483 lnet/ulnds/autoMakefile
1484 lnet/ulnds/socklnd/Makefile
1485 lnet/ulnds/ptllnd/Makefile
1488 case $lb_target_os in
1491 lnet/include/libcfs/darwin/Makefile
1492 lnet/include/lnet/darwin/Makefile
1493 lnet/libcfs/darwin/Makefile