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"
115 AC_SUBST(QSWCPPFLAGS)
122 # check if GM support is available
124 AC_DEFUN([LP_CONFIG_GM],
125 [LB_ARG_LIBS_INCLUDES([Myrinet],[gm])
126 if test x$gm_includes != x ; then
127 GMCPPFLAGS="-I$gm_includes"
128 if test -d "$gm/drivers" ; then
129 GMCPPFLAGS="$GMCPPFLAGS -I$gm/drivers -I$gm/drivers/linux/gm"
134 if test x$gm_libs != x ; then
140 if test x$gm != x ; then
151 # check for OpenIB in the kernel
152 AC_DEFUN([LP_CONFIG_OPENIB],[
153 AC_MSG_CHECKING([whether to enable OpenIB support])
155 OPENIBPATH="$LINUX/drivers/infiniband"
156 AC_ARG_WITH([openib],
157 AC_HELP_STRING([--with-openib=path],
158 [build openibnal against path]),
165 *) OPENIBPATH="$with_openib"
172 if test $ENABLEOPENIB -eq 0; then
173 AC_MSG_RESULT([disabled])
174 elif test ! \( -f ${OPENIBPATH}/include/ts_ib_core.h -a \
175 -f ${OPENIBPATH}/include/ts_ib_cm.h -a\
176 -f ${OPENIBPATH}/include/ts_ib_sa_client.h \); then
178 case $ENABLEOPENIB in
180 2) AC_MSG_ERROR([kernel OpenIB headers not present]);;
181 3) AC_MSG_ERROR([bad --with-openib path]);;
182 *) AC_MSG_ERROR([internal error]);;
185 case $ENABLEOPENIB in
186 1|2) OPENIBCPPFLAGS="-I$OPENIBPATH/include -DIN_TREE_BUILD";;
187 3) OPENIBCPPFLAGS="-I$OPENIBPATH/include";;
188 *) AC_MSG_RESULT([no])
189 AC_MSG_ERROR([internal error]);;
191 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
192 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $OPENIBCPPFLAGS"
193 LB_LINUX_TRY_COMPILE([
194 #include <ts_ib_core.h>
195 #include <ts_ib_cm.h>
196 #include <ts_ib_sa_client.h>
198 struct ib_device_properties dev_props;
199 struct ib_cm_active_param cm_active_params;
200 tTS_IB_CLIENT_QUERY_TID tid;
201 int enum1 = IB_QP_ATTRIBUTE_STATE;
202 int enum2 = IB_ACCESS_LOCAL_WRITE;
203 int enum3 = IB_CQ_CALLBACK_INTERRUPT;
204 int enum4 = IB_CQ_PROVIDER_REARM;
208 OPENIBNAL="openibnal"
211 case $ENABLEOPENIB in
213 2) AC_MSG_ERROR([can't compile with kernel OpenIB headers]);;
214 3) AC_MSG_ERROR([can't compile with OpenIB headers under $OPENIBPATH]);;
215 *) AC_MSG_ERROR([internal error]);;
220 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
222 AC_SUBST(OPENIBCPPFLAGS)
229 # check for infinicon infiniband support
231 AC_DEFUN([LP_CONFIG_IIB],
232 [AC_MSG_CHECKING([if Infinicon IB kernel headers are present])
233 # for how the only infinicon ib build has headers in /usr/include/iba
234 IIBCPPFLAGS="-I/usr/include -DIN_TREE_BUILD"
235 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
236 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $IIBCPPFLAGS"
237 LB_LINUX_TRY_COMPILE([
238 #include <linux/iba/ibt.h>
240 IBT_INTERFACE_UNION interfaces;
243 rc = IbtGetInterfaceByVersion(IBT_INTERFACE_VERSION_2,
246 return rc == FSUCCESS ? 0 : 1;
255 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
256 AC_SUBST(IIBCPPFLAGS)
263 # check for Voltaire infiniband support
265 AC_DEFUN([LP_CONFIG_VIB],
266 [AC_MSG_CHECKING([whether to enable Voltaire IB support])
269 AC_HELP_STRING([--with-vib=path],
270 [build vibnal against path]),
273 no) AC_MSG_RESULT([no]);;
274 *) VIBPATH="${with_vib}/src/nvigor/ib-code"
275 if test -d "$with_vib" -a -d "$VIBPATH"; then
279 AC_MSG_ERROR([No directory $VIBPATH])
285 if test -z "$VIBPATH"; then
288 VIBCPPFLAGS="-I${VIBPATH}/include -I${VIBPATH}/cm"
289 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
290 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
291 LB_LINUX_TRY_COMPILE([
292 #include <linux/list.h>
293 #include <asm/byteorder.h>
298 #ifdef __LITTLE_ENDIAN
309 ibat_arp_data_t arp_data;
312 vvrc = vv_hca_open("ANY_HCA", NULL, &kib_hca);
313 cep = cm_create_cep(cm_cep_transp_rc);
314 ibatrc = ibat_get_ib_data((uint32_t)0, (uint32_t)0,
315 ibat_paths_primary, &arp_data,
316 (ibat_get_ib_data_reply_fn_t)NULL,
322 AC_MSG_ERROR([can't compile vibnal with given path])
324 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
326 AC_SUBST(VIBCPPFLAGS)
333 # check whether to use the RapidArray nal
335 AC_DEFUN([LP_CONFIG_RANAL],
337 AC_MSG_CHECKING([if RapidArray kernel headers are present])
339 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
340 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
341 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
342 LB_LINUX_TRY_COMPILE([
343 #include <linux/types.h>
347 RAP_PVOID dev_handle;
349 rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
351 return rc == RAP_SUCCESS ? 0 : 1;
360 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
366 # LP_STRUCT_PAGE_LIST
368 # 2.6.4 no longer has page->list
370 AC_DEFUN([LP_STRUCT_PAGE_LIST],
371 [AC_MSG_CHECKING([if struct page has a list field])
372 LB_LINUX_TRY_COMPILE([
373 #include <linux/mm.h>
379 AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
388 # red hat 2.4 adds sighand to struct task_struct
390 AC_DEFUN([LP_STRUCT_SIGHAND],
391 [AC_MSG_CHECKING([if task_struct has a sighand field])
392 LB_LINUX_TRY_COMPILE([
393 #include <linux/sched.h>
395 struct task_struct p;
398 AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
408 # cpu_online is different in rh 2.4, vanilla 2.4, and 2.6
410 AC_DEFUN([LP_FUNC_CPU_ONLINE],
411 [AC_MSG_CHECKING([if kernel defines cpu_online()])
412 LB_LINUX_TRY_COMPILE([
413 #include <linux/sched.h>
418 AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
427 # same goes for cpumask_t
429 AC_DEFUN([LP_TYPE_CPUMASK_T],
430 [AC_MSG_CHECKING([if kernel defines cpumask_t])
431 LB_LINUX_TRY_COMPILE([
432 #include <linux/sched.h>
434 return sizeof (cpumask_t);
437 AC_DEFINE(HAVE_CPUMASK_T, 1, [cpumask_t found])
446 # we export show_task(), but not all kernels have it (yet)
448 AC_DEFUN([LP_FUNC_SHOW_TASK],
449 [AC_MSG_CHECKING([if kernel exports show_task])
451 for file in ksyms sched ; do
452 if grep -q "EXPORT_SYMBOL(show_task)" \
453 "$LINUX/kernel/$file.c" 2>/dev/null ; then
458 if test x$have_show_task = x1 ; then
459 AC_DEFINE(HAVE_SHOW_TASK, 1, [show_task is exported])
469 # Portals linux kernel checks
471 AC_DEFUN([LP_PROG_LINUX],
472 [LP_CHECK_GCC_VERSION
495 AC_DEFUN([LP_PROG_DARWIN],
496 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
502 # default paths for installed files
504 AC_DEFUN([LP_PATH_DEFAULTS],
511 # other configure checks
513 AC_DEFUN([LP_CONFIGURE],
514 [# portals/utils/portals.c
515 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h])
516 AC_CHECK_FUNCS([gethostbyname socket connect])
518 # portals/utils/debug.c
519 AC_CHECK_HEADERS([linux/version.h])
521 AC_CHECK_TYPE([spinlock_t],
522 [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
524 [#include <linux/spinlock.h>])
526 # portals/utils/wirecheck.c
527 AC_CHECK_FUNCS([strnlen])
529 # -------- Check for required packages --------------
532 LIBS="-lncurses $LIBS"
533 AC_CHECK_LIB([readline],[readline],[
534 LIBREADLINE="-lreadline -lncurses"
535 AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
540 AC_SUBST(LIBREADLINE)
542 AC_MSG_CHECKING([if efence debugging support is requested])
543 AC_ARG_ENABLE(efence,
544 AC_HELP_STRING([--enable-efence],
545 [use efence library]),
546 [],[enable_efence='no'])
547 AC_MSG_RESULT([$enable_efence])
548 if test "$enable_efence" = "yes" ; then
550 AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
556 # -------- enable acceptor libwrap (TCP wrappers) support? -------
557 AC_MSG_CHECKING([if libwrap support is requested])
558 AC_ARG_ENABLE([libwrap],
559 AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
560 [case "${enableval}" in
561 yes) enable_libwrap=yes ;;
562 no) enable_libwrap=no ;;
563 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
564 esac],[enable_libwrap=no])
565 AC_MSG_RESULT([$enable_libwrap])
566 if test x$enable_libwrap = xyes ; then
568 AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
574 # ----------------------------------------
575 # some tests for catamount-like systems
576 # ----------------------------------------
577 AC_ARG_ENABLE([sysio_init],
578 AC_HELP_STRING([--disable-sysio-init],
579 [call sysio init functions when initializing liblustre]),
580 [],[enable_sysio_init=yes])
581 AC_MSG_CHECKING([whether to initialize libsysio])
582 AC_MSG_RESULT([$enable_sysio_init])
583 if test x$enable_sysio_init != xno ; then
584 AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
587 AC_ARG_ENABLE([urandom],
588 AC_HELP_STRING([--disable-urandom],
589 [disable use of /dev/urandom for liblustre]),
590 [],[enable_urandom=yes])
591 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
592 AC_MSG_RESULT([$enable_urandom])
593 if test x$enable_urandom != xno ; then
594 AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
597 # -------- check for -lcap and -lpthread ----
598 if test x$enable_liblustre = xyes ; then
599 AC_CHECK_LIB([cap], [cap_get_proc],
602 AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
606 AC_CHECK_LIB([pthread], [pthread_create],
608 PTHREAD_LIBS="-lpthread"
609 AC_DEFINE([HAVE_LIBPTHREAD], 1, [use libpthread])
612 AC_SUBST(PTHREAD_LIBS)
619 # AM_CONDITOINAL defines for portals
621 AC_DEFUN([LP_CONDITIONALS],
622 [AM_CONDITIONAL(BUILD_QSWNAL, test x$QSWNAL = "xqswnal")
623 AM_CONDITIONAL(BUILD_GMNAL, test x$GMNAL = "xgmnal")
624 AM_CONDITIONAL(BUILD_OPENIBNAL, test x$OPENIBNAL = "xopenibnal")
625 AM_CONDITIONAL(BUILD_IIBNAL, test x$IIBNAL = "xiibnal")
626 AM_CONDITIONAL(BUILD_VIBNAL, test x$VIBNAL = "xvibnal")
627 AM_CONDITIONAL(BUILD_RANAL, test x$RANAL = "xranal")
633 # files that should be generated with AC_OUTPUT
635 AC_DEFUN([LP_CONFIG_FILES],
640 portals/autoconf/Makefile
642 portals/include/Makefile
643 portals/include/libcfs/Makefile
644 portals/include/libcfs/linux/Makefile
645 portals/include/portals/Makefile
646 portals/include/portals/linux/Makefile
647 portals/knals/Makefile
648 portals/knals/autoMakefile
649 portals/knals/gmnal/Makefile
650 portals/knals/gmnal/autoMakefile
651 portals/knals/openibnal/Makefile
652 portals/knals/openibnal/autoMakefile
653 portals/knals/iibnal/Makefile
654 portals/knals/iibnal/autoMakefile
655 portals/knals/vibnal/Makefile
656 portals/knals/vibnal/autoMakefile
657 portals/knals/lonal/Makefile
658 portals/knals/lonal/autoMakefile
659 portals/knals/qswnal/Makefile
660 portals/knals/qswnal/autoMakefile
661 portals/knals/ranal/Makefile
662 portals/knals/ranal/autoMakefile
663 portals/knals/socknal/Makefile
664 portals/knals/socknal/autoMakefile
665 portals/libcfs/Makefile
666 portals/libcfs/autoMakefile
667 portals/libcfs/linux/Makefile
668 portals/portals/Makefile
669 portals/portals/autoMakefile
670 portals/router/Makefile
671 portals/router/autoMakefile
672 portals/tests/Makefile
673 portals/tests/autoMakefile
674 portals/unals/Makefile
675 portals/utils/Makefile
677 case $lb_target_os in
680 portals/include/libcfs/darwin/Makefile
681 portals/include/portals/darwin/Makefile
682 portals/libcfs/darwin/Makefile