4 # Check compiler version
6 AC_DEFUN([LP_CHECK_GCC_VERSION],
7 [AC_MSG_CHECKING([compiler version])
8 PTL_CC_VERSION=`$CC --version | awk '/^gcc/{print $ 3}'`
9 PTL_MIN_CC_VERSION="3.2.2"
11 awk -F. '{printf "%d\n", (($ 1)*100+($ 2))*100+($ 3)}'
13 if test -z "$PTL_CC_VERSION" -o \
14 `echo $PTL_CC_VERSION | v2n` -ge `echo $PTL_MIN_CC_VERSION | v2n`; then
17 AC_MSG_RESULT([Buggy compiler found])
18 AC_MSG_ERROR([Need gcc version >= $PTL_MIN_CC_VERSION])
25 # check if zerocopy is available/wanted
27 AC_DEFUN([LP_CONFIG_ZEROCOPY],
28 [AC_MSG_CHECKING([for zero-copy TCP support])
29 AC_ARG_ENABLE([zerocopy],
30 AC_HELP_STRING([--disable-zerocopy],
31 [disable socknal zerocopy]),
32 [],[enable_zerocopy='yes'])
33 if test x$enable_zerocopy = xno ; then
34 AC_MSG_RESULT([no (by request)])
36 ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
37 if test "$ZCCD" != 0 ; then
38 AC_DEFINE(SOCKNAL_ZC, 1, [use zero-copy TCP])
41 AC_MSG_RESULT([no (no kernel support)])
49 # check if cpu affinity is available/wanted
51 AC_DEFUN([LP_CONFIG_AFFINITY],
52 [AC_ARG_ENABLE([affinity],
53 AC_HELP_STRING([--disable-affinity],
54 [disable process/irq affinity]),
55 [],[enable_affinity='yes'])
57 AC_MSG_CHECKING([for CPU affinity support])
58 if test x$enable_affinity = xno ; then
59 AC_MSG_RESULT([no (by request)])
61 LB_LINUX_TRY_COMPILE([
62 #include <linux/sched.h>
70 set_cpus_allowed(&t, m);
72 AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
75 AC_MSG_RESULT([no (no kernel support)])
83 # check if quadrics support is in this kernel
85 AC_DEFUN([LP_CONFIG_QUADRICS],
86 [AC_MSG_CHECKING([for QsNet sources])
88 AC_HELP_STRING([--with-qsnet=path],
89 [set path to qsnet source (default=$LINUX)]),
92 AC_MSG_RESULT([$QSNET])
94 AC_MSG_CHECKING([if quadrics kernel headers are present])
95 if test -d $QSNET/drivers/net/qsnet ; then
98 AC_MSG_CHECKING([for multirail EKC])
99 if test -f $QSNET/include/elan/epcomms.h; then
100 AC_MSG_RESULT([supported])
101 QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
103 AC_MSG_RESULT([not supported])
104 if test -d $QSNET/drivers/net/qsnet/include; then
105 QSWCPPFLAGS="-I$QSNET/drivers/net/qsnet/include"
107 QSWCPPFLAGS="-I$QSNET/include/linux"
111 if test x$QSNET = x$LINUX ; then
112 LB_LINUX_CONFIG([QSNET],[],[
113 LB_LINUX_CONFIG([QSNET_MODULE],[],[
114 AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswnal.])
125 AC_SUBST(QSWCPPFLAGS)
132 # check if GM support is available
134 AC_DEFUN([LP_CONFIG_GM],
135 [LB_ARG_LIBS_INCLUDES([Myrinet],[gm])
136 if test x$gm_includes != x ; then
137 GMCPPFLAGS="-I$gm_includes"
138 if test -d "$gm/drivers" ; then
139 GMCPPFLAGS="$GMCPPFLAGS -I$gm/drivers -I$gm/drivers/linux/gm"
144 if test x$gm_libs != x ; then
150 if test x$gm != x ; then
161 # check for OpenIB in the kernel
162 AC_DEFUN([LP_CONFIG_OPENIB],[
163 AC_MSG_CHECKING([whether to enable OpenIB support])
165 OPENIBPATH="$LINUX/drivers/infiniband"
166 AC_ARG_WITH([openib],
167 AC_HELP_STRING([--with-openib=path],
168 [build openibnal against path]),
175 *) OPENIBPATH="$with_openib"
182 if test $ENABLEOPENIB -eq 0; then
183 AC_MSG_RESULT([disabled])
184 elif test ! \( -f ${OPENIBPATH}/include/ts_ib_core.h -a \
185 -f ${OPENIBPATH}/include/ts_ib_cm.h -a\
186 -f ${OPENIBPATH}/include/ts_ib_sa_client.h \); then
188 case $ENABLEOPENIB in
190 2) AC_MSG_ERROR([kernel OpenIB headers not present]);;
191 3) AC_MSG_ERROR([bad --with-openib path]);;
192 *) AC_MSG_ERROR([internal error]);;
195 case $ENABLEOPENIB in
196 1|2) OPENIBCPPFLAGS="-I$OPENIBPATH/include -DIN_TREE_BUILD";;
197 3) OPENIBCPPFLAGS="-I$OPENIBPATH/include";;
198 *) AC_MSG_RESULT([no])
199 AC_MSG_ERROR([internal error]);;
201 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
202 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $OPENIBCPPFLAGS"
203 LB_LINUX_TRY_COMPILE([
204 #include <ts_ib_core.h>
205 #include <ts_ib_cm.h>
206 #include <ts_ib_sa_client.h>
208 struct ib_device_properties dev_props;
209 struct ib_cm_active_param cm_active_params;
210 tTS_IB_CLIENT_QUERY_TID tid;
211 int enum1 = IB_QP_ATTRIBUTE_STATE;
212 int enum2 = IB_ACCESS_LOCAL_WRITE;
213 int enum3 = IB_CQ_CALLBACK_INTERRUPT;
214 int enum4 = IB_CQ_PROVIDER_REARM;
218 OPENIBNAL="openibnal"
221 case $ENABLEOPENIB in
223 2) AC_MSG_ERROR([can't compile with kernel OpenIB headers]);;
224 3) AC_MSG_ERROR([can't compile with OpenIB headers under $OPENIBPATH]);;
225 *) AC_MSG_ERROR([internal error]);;
230 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
232 AC_SUBST(OPENIBCPPFLAGS)
239 # check for infinicon infiniband support
244 # check for infinicon infiniband support
246 AC_DEFUN([LP_CONFIG_IIB],[
247 AC_MSG_CHECKING([whether to enable Infinicon support])
249 IIBPATH="/usr/include"
251 AC_HELP_STRING([--with-iib=path],
252 [build iibnal against path]),
259 *) IIBPATH="${with_iib}/include"
266 if test $ENABLEIIB -eq 0; then
267 AC_MSG_RESULT([disabled])
268 elif test ! \( -f ${IIBPATH}/linux/iba/ibt.h \); then
272 2) AC_MSG_ERROR([default Infinicon headers not present]);;
273 3) AC_MSG_ERROR([bad --with-iib path]);;
274 *) AC_MSG_ERROR([internal error]);;
277 IIBCPPFLAGS="-I$IIBPATH"
278 if test $IIBPATH != "/usr/include"; then
279 # we need /usr/include come what may
280 IIBCPPFLAGS="$IIBCPPFLAGS -I/usr/include"
282 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
283 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $IIBCPPFLAGS"
284 LB_LINUX_TRY_COMPILE([
285 #include <linux/iba/ibt.h>
287 IBT_INTERFACE_UNION interfaces;
290 rc = IbtGetInterfaceByVersion(IBT_INTERFACE_VERSION_2,
293 return rc == FSUCCESS ? 0 : 1;
301 2) AC_MSG_ERROR([can't compile with default Infinicon headers]);;
302 3) AC_MSG_ERROR([can't compile with Infinicon headers under $IIBPATH]);;
303 *) AC_MSG_ERROR([internal error]);;
308 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
310 AC_SUBST(IIBCPPFLAGS)
317 # check for Voltaire infiniband support
319 AC_DEFUN([LP_CONFIG_VIB],
320 [AC_MSG_CHECKING([whether to enable Voltaire IB support])
323 AC_HELP_STRING([--with-vib=path],
324 [build vibnal against path]),
327 no) AC_MSG_RESULT([no]);;
328 *) VIBPATH="${with_vib}/src/nvigor/ib-code"
329 if test -d "$with_vib" -a -d "$VIBPATH"; then
333 AC_MSG_ERROR([No directory $VIBPATH])
339 if test -z "$VIBPATH"; then
342 VIBCPPFLAGS="-I${VIBPATH}/include -I${VIBPATH}/cm"
343 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
344 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
345 LB_LINUX_TRY_COMPILE([
346 #include <linux/list.h>
347 #include <asm/byteorder.h>
352 #ifdef __LITTLE_ENDIAN
363 ibat_arp_data_t arp_data;
366 vvrc = vv_hca_open("ANY_HCA", NULL, &kib_hca);
367 cep = cm_create_cep(cm_cep_transp_rc);
368 ibatrc = ibat_get_ib_data((uint32_t)0, (uint32_t)0,
369 ibat_paths_primary, &arp_data,
370 (ibat_get_ib_data_reply_fn_t)NULL,
376 AC_MSG_ERROR([can't compile vibnal with given path])
378 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
380 if test -n "$VIBNAL"; then
381 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
382 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
383 AC_MSG_CHECKING([if Voltaire still uses void * sg addresses])
384 LB_LINUX_TRY_COMPILE([
385 #include <linux/list.h>
386 #include <asm/byteorder.h>
391 #ifdef __LITTLE_ENDIAN
401 return &sg.v_address[3] == NULL;
404 VIBCPPFLAGS="$VIBCPPFLAGS -DIBNAL_VOIDSTAR_SGADDR=1"
408 AC_MSG_CHECKING([if page_to_phys() must avoid sign extension])
409 LB_LINUX_TRY_COMPILE([
410 #include <linux/kernel.h>
411 #include <linux/mm.h>
412 #include <linux/unistd.h>
413 #include <asm/system.h>
420 case (sizeof(typeof(page_to_phys(&p))) < 8):
425 VIBCPPFLAGS="$VIBCPPFLAGS -DIBNAL_32BIT_PAGE2PHYS=1"
429 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
431 AC_SUBST(VIBCPPFLAGS)
438 # check whether to use the RapidArray nal
440 AC_DEFUN([LP_CONFIG_RANAL],
442 AC_MSG_CHECKING([if RapidArray kernel headers are present])
444 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
445 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
446 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
447 LB_LINUX_TRY_COMPILE([
448 #include <linux/types.h>
452 RAP_PVOID dev_handle;
454 rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
456 return rc == RAP_SUCCESS ? 0 : 1;
465 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
471 # LP_STRUCT_PAGE_LIST
473 # 2.6.4 no longer has page->list
475 AC_DEFUN([LP_STRUCT_PAGE_LIST],
476 [AC_MSG_CHECKING([if struct page has a list field])
477 LB_LINUX_TRY_COMPILE([
478 #include <linux/mm.h>
484 AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
493 # red hat 2.4 adds sighand to struct task_struct
495 AC_DEFUN([LP_STRUCT_SIGHAND],
496 [AC_MSG_CHECKING([if task_struct has a sighand field])
497 LB_LINUX_TRY_COMPILE([
498 #include <linux/sched.h>
500 struct task_struct p;
503 AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
513 # cpu_online is different in rh 2.4, vanilla 2.4, and 2.6
515 AC_DEFUN([LP_FUNC_CPU_ONLINE],
516 [AC_MSG_CHECKING([if kernel defines cpu_online()])
517 LB_LINUX_TRY_COMPILE([
518 #include <linux/sched.h>
523 AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
532 # same goes for cpumask_t
534 AC_DEFUN([LP_TYPE_CPUMASK_T],
535 [AC_MSG_CHECKING([if kernel defines cpumask_t])
536 LB_LINUX_TRY_COMPILE([
537 #include <linux/sched.h>
539 return sizeof (cpumask_t);
542 AC_DEFINE(HAVE_CPUMASK_T, 1, [cpumask_t found])
551 # we export show_task(), but not all kernels have it (yet)
553 AC_DEFUN([LP_FUNC_SHOW_TASK],
554 [AC_MSG_CHECKING([if kernel exports show_task])
556 for file in ksyms sched ; do
557 if grep -q "EXPORT_SYMBOL(show_task)" \
558 "$LINUX/kernel/$file.c" 2>/dev/null ; then
563 if test x$have_show_task = x1 ; then
564 AC_DEFINE(HAVE_SHOW_TASK, 1, [show_task is exported])
574 # Portals linux kernel checks
576 AC_DEFUN([LP_PROG_LINUX],
598 AC_DEFUN([LP_PROG_DARWIN],
599 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
605 # default paths for installed files
607 AC_DEFUN([LP_PATH_DEFAULTS],
614 # other configure checks
616 AC_DEFUN([LP_CONFIGURE],
617 [# portals/utils/portals.c
618 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
619 AC_CHECK_FUNCS([gethostbyname socket connect])
621 # portals/utils/debug.c
622 AC_CHECK_HEADERS([linux/version.h])
624 AC_CHECK_TYPE([spinlock_t],
625 [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
627 [#include <linux/spinlock.h>])
629 # portals/utils/wirecheck.c
630 AC_CHECK_FUNCS([strnlen])
632 # -------- Check for required packages --------------
635 LIBS="-lncurses $LIBS"
636 AC_CHECK_LIB([readline],[readline],[
637 LIBREADLINE="-lreadline -lncurses"
638 AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
643 AC_SUBST(LIBREADLINE)
645 AC_MSG_CHECKING([if efence debugging support is requested])
646 AC_ARG_ENABLE(efence,
647 AC_HELP_STRING([--enable-efence],
648 [use efence library]),
649 [],[enable_efence='no'])
650 AC_MSG_RESULT([$enable_efence])
651 if test "$enable_efence" = "yes" ; then
653 AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
659 # -------- enable acceptor libwrap (TCP wrappers) support? -------
660 AC_MSG_CHECKING([if libwrap support is requested])
661 AC_ARG_ENABLE([libwrap],
662 AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
663 [case "${enableval}" in
664 yes) enable_libwrap=yes ;;
665 no) enable_libwrap=no ;;
666 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
667 esac],[enable_libwrap=no])
668 AC_MSG_RESULT([$enable_libwrap])
669 if test x$enable_libwrap = xyes ; then
671 AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
677 # ----------------------------------------
678 # some tests for catamount-like systems
679 # ----------------------------------------
680 AC_ARG_ENABLE([sysio_init],
681 AC_HELP_STRING([--disable-sysio-init],
682 [call sysio init functions when initializing liblustre]),
683 [],[enable_sysio_init=yes])
684 AC_MSG_CHECKING([whether to initialize libsysio])
685 AC_MSG_RESULT([$enable_sysio_init])
686 if test x$enable_sysio_init != xno ; then
687 AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
690 AC_ARG_ENABLE([urandom],
691 AC_HELP_STRING([--disable-urandom],
692 [disable use of /dev/urandom for liblustre]),
693 [],[enable_urandom=yes])
694 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
695 AC_MSG_RESULT([$enable_urandom])
696 if test x$enable_urandom != xno ; then
697 AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
700 # -------- check for -lcap and -lpthread ----
701 if test x$enable_liblustre = xyes ; then
702 AC_CHECK_LIB([cap], [cap_get_proc],
705 AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
709 AC_CHECK_LIB([pthread], [pthread_create],
711 PTHREAD_LIBS="-lpthread"
712 AC_DEFINE([HAVE_LIBPTHREAD], 1, [use libpthread])
715 AC_SUBST(PTHREAD_LIBS)
722 # AM_CONDITOINAL defines for portals
724 AC_DEFUN([LP_CONDITIONALS],
725 [AM_CONDITIONAL(BUILD_QSWNAL, test x$QSWNAL = "xqswnal")
726 AM_CONDITIONAL(BUILD_GMNAL, test x$GMNAL = "xgmnal")
727 AM_CONDITIONAL(BUILD_OPENIBNAL, test x$OPENIBNAL = "xopenibnal")
728 AM_CONDITIONAL(BUILD_IIBNAL, test x$IIBNAL = "xiibnal")
729 AM_CONDITIONAL(BUILD_VIBNAL, test x$VIBNAL = "xvibnal")
730 AM_CONDITIONAL(BUILD_RANAL, test x$RANAL = "xranal")
736 # files that should be generated with AC_OUTPUT
738 AC_DEFUN([LP_CONFIG_FILES],
743 portals/autoconf/Makefile
745 portals/include/Makefile
746 portals/include/libcfs/Makefile
747 portals/include/libcfs/linux/Makefile
748 portals/include/portals/Makefile
749 portals/include/portals/linux/Makefile
750 portals/knals/Makefile
751 portals/knals/autoMakefile
752 portals/knals/gmnal/Makefile
753 portals/knals/gmnal/autoMakefile
754 portals/knals/openibnal/Makefile
755 portals/knals/openibnal/autoMakefile
756 portals/knals/iibnal/Makefile
757 portals/knals/iibnal/autoMakefile
758 portals/knals/vibnal/Makefile
759 portals/knals/vibnal/autoMakefile
760 portals/knals/lonal/Makefile
761 portals/knals/lonal/autoMakefile
762 portals/knals/qswnal/Makefile
763 portals/knals/qswnal/autoMakefile
764 portals/knals/ranal/Makefile
765 portals/knals/ranal/autoMakefile
766 portals/knals/socknal/Makefile
767 portals/knals/socknal/autoMakefile
768 portals/libcfs/Makefile
769 portals/libcfs/autoMakefile
770 portals/libcfs/linux/Makefile
771 portals/portals/Makefile
772 portals/portals/autoMakefile
773 portals/router/Makefile
774 portals/router/autoMakefile
775 portals/tests/Makefile
776 portals/tests/autoMakefile
777 portals/unals/Makefile
778 portals/utils/Makefile
780 case $lb_target_os in
783 portals/include/libcfs/darwin/Makefile
784 portals/include/portals/darwin/Makefile
785 portals/libcfs/darwin/Makefile