Whamcloud - gitweb
b=22745 Removed gmlnd from lnet.
[fs/lustre-release.git] / lnet / autoconf / lustre-lnet.m4
1 #
2 # LN_CONFIG_MAX_PAYLOAD
3 #
4 # configure maximum payload
5 #
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]),
11         [
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)"
15         ], [
16                 AC_MSG_RESULT([no])
17                 LNET_MAX_PAYLOAD="LNET_MTU"
18         ])
19         AC_DEFINE_UNQUOTED(LNET_MAX_PAYLOAD, $LNET_MAX_PAYLOAD,
20                            [Max LNET payload])
21 ])
22
23 #
24 # LN_CHECK_GCC_VERSION
25 #
26 # Check compiler version
27 #
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"
32 v2n() {
33         awk -F. '{printf "%d\n", (($ 1)*100+($ 2))*100+($ 3)}'
34 }
35 if test -z "$PTL_CC_VERSION" -o \
36         `echo $PTL_CC_VERSION | v2n` -ge `echo $PTL_MIN_CC_VERSION | v2n`; then
37         AC_MSG_RESULT([ok])
38 else
39         AC_MSG_RESULT([Buggy compiler found])
40         AC_MSG_ERROR([Need gcc version >= $PTL_MIN_CC_VERSION])
41 fi
42 ])
43
44 #
45 # LN_CONFIG_AFFINITY
46 #
47 # check if cpu affinity is available/wanted
48 #
49 AC_DEFUN([LN_CONFIG_AFFINITY],
50 [AC_ARG_ENABLE([affinity],
51         AC_HELP_STRING([--disable-affinity],
52                        [disable process/irq affinity]),
53         [],[enable_affinity='yes'])
54
55 AC_MSG_CHECKING([for CPU affinity support])
56 if test x$enable_affinity = xno ; then
57         AC_MSG_RESULT([no (by request)])
58 else
59         LB_LINUX_TRY_COMPILE([
60                 #include <linux/sched.h>
61         ],[
62                 struct task_struct t;
63                 #if HAVE_CPUMASK_T
64                 cpumask_t     m;
65                 #else
66                 unsigned long m;
67                 #endif
68                 set_cpus_allowed(&t, m);
69         ],[
70                 AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
71                 AC_MSG_RESULT([yes])
72         ],[
73                 AC_MSG_RESULT([no (no kernel support)])
74         ])
75 fi
76 ])
77
78 #
79 # LN_CONFIG_PORTALS
80 #
81 # configure support for Portals
82 #
83 AC_DEFUN([LN_CONFIG_PORTALS],
84 [AC_MSG_CHECKING([for portals])
85 AC_ARG_WITH([portals],
86         AC_HELP_STRING([--with-portals=path],
87                        [set path to portals]),
88         [
89                 case $with_portals in
90                         no)     ENABLEPORTALS=0
91                                 ;;
92                         *)      PORTALS="${with_portals}"
93                                 ENABLEPORTALS=1
94                                 ;;
95                 esac
96         ], [
97                 ENABLEPORTALS=0
98         ])
99 PTLLNDCPPFLAGS=""
100 if test $ENABLEPORTALS -eq 0; then
101         AC_MSG_RESULT([no])
102 elif test ! \( -f ${PORTALS}/include/portals/p30.h \); then
103         AC_MSG_RESULT([no])
104         AC_MSG_ERROR([bad --with-portals path])
105 else
106         AC_MSG_RESULT([$PORTALS])
107         PTLLNDCPPFLAGS="-I${PORTALS}/include"
108 fi
109 AC_SUBST(PTLLNDCPPFLAGS)
110 ])
111
112 #
113 # LN_CONFIG_BACKOFF
114 #
115 # check if tunable tcp backoff is available/wanted
116 #
117 AC_DEFUN([LN_CONFIG_BACKOFF],
118 [AC_MSG_CHECKING([for tunable backoff TCP support])
119 AC_ARG_ENABLE([backoff],
120        AC_HELP_STRING([--disable-backoff],
121                       [disable socknal tunable backoff]),
122        [],[enable_backoff='yes'])
123 if test x$enable_backoff = xno ; then
124        AC_MSG_RESULT([no (by request)])
125 else
126        BOCD="`grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h`"
127        if test "$BOCD" != 0 ; then
128                AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
129                AC_MSG_RESULT(yes)
130                if grep rto_max $LINUX/include/linux/tcp.h|grep -q __u16; then
131                    AC_DEFINE(SOCKNAL_BACKOFF_MS, 1, [tunable backoff TCP in ms])
132                fi
133        else
134                AC_MSG_RESULT([no (no kernel support)])
135        fi
136 fi
137 ])
138
139
140 #
141 # LN_CONFIG_PTLLND
142 #
143 # configure support for Portals LND
144 #
145 AC_DEFUN([LN_CONFIG_PTLLND],
146 [
147 if test -z "$ENABLEPORTALS"; then
148         LN_CONFIG_PORTALS
149 fi
150
151 AC_MSG_CHECKING([whether to build the kernel portals LND])
152
153 PTLLND=""
154 if test $ENABLEPORTALS -ne 0; then
155         AC_MSG_RESULT([yes])
156         PTLLND="ptllnd"
157 else
158         AC_MSG_RESULT([no])
159 fi
160 AC_SUBST(PTLLND)
161 ])
162
163 #
164 # LN_CONFIG_UPTLLND
165 #
166 # configure support for Portals LND
167 #
168 AC_DEFUN([LN_CONFIG_UPTLLND],
169 [
170 if test -z "$ENABLEPORTALS"; then
171         LN_CONFIG_PORTALS
172 fi
173
174 AC_MSG_CHECKING([whether to build the userspace portals LND])
175
176 UPTLLND=""
177 if test $ENABLEPORTALS -ne 0; then
178         AC_MSG_RESULT([yes])
179         UPTLLND="ptllnd"
180 else
181         AC_MSG_RESULT([no])
182 fi
183 AC_SUBST(UPTLLND)
184 ])
185
186 #
187 # LN_CONFIG_USOCKLND
188 #
189 # configure support for userspace TCP/IP LND
190 #
191 AC_DEFUN([LN_CONFIG_USOCKLND],
192 [AC_MSG_CHECKING([whether to build usocklnd])
193 AC_ARG_ENABLE([usocklnd],
194         AC_HELP_STRING([--disable-usocklnd],
195                         [disable usocklnd]),
196         [],[enable_usocklnd='yes'])
197
198 if test x$enable_usocklnd = xyes ; then
199         if test "$ax_pthread_ok" = "yes" ; then
200                 AC_MSG_RESULT([yes])
201                 USOCKLND="usocklnd"
202         else
203                 AC_MSG_RESULT([no (libpthread not present or disabled)])
204                 USOCKLND=""
205         fi
206 else
207         AC_MSG_RESULT([no (disabled explicitly)])
208         USOCKLND=""
209 fi
210 AC_SUBST(USOCKLND)
211 ])
212
213 #
214 # LN_CONFIG_QUADRICS
215 #
216 # check if quadrics support is in this kernel
217 #
218 AC_DEFUN([LN_CONFIG_QUADRICS],
219 [AC_MSG_CHECKING([for QsNet sources])
220 AC_ARG_WITH([qsnet],
221         AC_HELP_STRING([--with-qsnet=path],
222                        [set path to qsnet source (default=$LINUX)]),
223         [QSNET=$with_qsnet],
224         [QSNET=$LINUX])
225 AC_MSG_RESULT([$QSNET])
226
227 AC_MSG_CHECKING([if quadrics kernel headers are present])
228 if test -d $QSNET/drivers/net/qsnet ; then
229         AC_MSG_RESULT([yes])
230         QSWLND="qswlnd"
231         AC_MSG_CHECKING([for multirail EKC])
232         if test -f $QSNET/include/elan/epcomms.h; then
233                 AC_MSG_RESULT([supported])
234                 QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
235         else
236                 AC_MSG_RESULT([not supported])
237                 AC_MSG_ERROR([Need multirail EKC])
238         fi
239
240         if test x$QSNET = x$LINUX ; then
241                 LB_LINUX_CONFIG([QSNET],[],[
242                         LB_LINUX_CONFIG([QSNET_MODULE],[],[
243                                 AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswlnd.])
244                                 QSWLND=""
245                                 QSWCPPFLAGS=""
246                         ])
247                 ])
248         fi
249 else
250         AC_MSG_RESULT([no])
251         QSWLND=""
252         QSWCPPFLAGS=""
253 fi
254 AC_SUBST(QSWCPPFLAGS)
255 AC_SUBST(QSWLND)
256 ])
257
258
259 #
260 # LN_CONFIG_MX
261 #
262 AC_DEFUN([LN_CONFIG_MX],
263 [AC_MSG_CHECKING([whether to enable Myrinet MX support])
264 # set default
265 MXPATH="/opt/mx"
266 AC_ARG_WITH([mx],
267        AC_HELP_STRING([--with-mx=path],
268                       [build mxlnd against path]),
269        [
270                case $with_mx in
271                yes)    ENABLEMX=2
272                        ;;
273                no)     ENABLEMX=0
274                        ;;
275                *)      MXPATH=$with_mx
276                        ENABLEMX=3
277                        ;;
278                esac
279        ],[
280                ENABLEMX=1
281        ])
282 if test $ENABLEMX -eq 0; then
283        AC_MSG_RESULT([disabled])
284 elif test ! \( -f ${MXPATH}/include/myriexpress.h -a \
285               -f ${MXPATH}/include/mx_kernel_api.h -a \
286               -f ${MXPATH}/include/mx_pin.h \); then
287        AC_MSG_RESULT([no])
288        case $ENABLEMX in
289        1) ;;
290        2) AC_MSG_ERROR([Myrinet MX kernel headers not present]);;
291        3) AC_MSG_ERROR([bad --with-mx path]);;
292        *) AC_MSG_ERROR([internal error]);;
293        esac
294 else
295        MXCPPFLAGS="-I$MXPATH/include"
296        EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
297        EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
298        MXLIBS="-L$MXPATH/lib"
299        LB_LINUX_TRY_COMPILE([
300                #define MX_KERNEL 1
301                #include <mx_extensions.h>
302                #include <myriexpress.h>
303        ],[
304                mx_endpoint_t   end;
305                mx_status_t     status;
306                mx_request_t    request;
307                int             result;
308
309                mx_init();
310                mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
311                mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
312                mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
313                mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
314                return 0;
315        ],[
316                AC_MSG_RESULT([yes])
317                MXLND="mxlnd"
318        ],[
319                AC_MSG_RESULT([no])
320                case $ENABLEMX in
321                1) ;;
322                2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]);;
323                3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]);;
324                *) AC_MSG_ERROR([internal error]);;
325                esac
326                MXLND=""
327                MXCPPFLAGS=""
328        ])
329        EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
330 fi
331 AC_SUBST(MXCPPFLAGS)
332 AC_SUBST(MXLIBS)
333 AC_SUBST(MXLND)
334 ])
335
336
337
338 #
339 # LN_CONFIG_O2IB
340 #
341 AC_DEFUN([LN_CONFIG_O2IB],[
342 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
343 # set default
344 AC_ARG_WITH([o2ib],
345         AC_HELP_STRING([--with-o2ib=path],
346                        [build o2iblnd against path]),
347         [
348                 case $with_o2ib in
349                 yes)    O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
350                         ENABLEO2IB=2
351                         ;;
352                 no)     ENABLEO2IB=0
353                         ;;
354                 *)      O2IBPATHS=$with_o2ib
355                         ENABLEO2IB=3
356                         ;;
357                 esac
358         ],[
359                 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
360                 ENABLEO2IB=1
361         ])
362 if test $ENABLEO2IB -eq 0; then
363         AC_MSG_RESULT([disabled])
364 else
365         o2ib_found=false
366         for O2IBPATH in $O2IBPATHS; do
367                 if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
368                            -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
369                            -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
370                            -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
371                         if test \( -d ${O2IBPATH}/kernel_patches -a \
372                                    -f ${O2IBPATH}/Makefile \); then
373                                 AC_MSG_RESULT([no])
374                                 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%-*}])
375                         fi
376                         o2ib_found=true
377                         break
378                 fi
379         done
380         if ! $o2ib_found; then
381                 AC_MSG_RESULT([no])
382                 case $ENABLEO2IB in
383                         1) ;;
384                         2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]);;
385                         3) AC_MSG_ERROR([bad --with-o2ib path]);;
386                         *) AC_MSG_ERROR([internal error]);;
387                 esac
388         else
389                 O2IBCPPFLAGS="-I$O2IBPATH/include"
390                 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
391                 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $O2IBCPPFLAGS"
392                 EXTRA_LNET_INCLUDE="$EXTRA_LNET_INCLUDE $O2IBCPPFLAGS"
393
394                 LB_LINUX_TRY_COMPILE([
395                         #include <linux/version.h>
396                         #include <linux/pci.h>
397                         #if !HAVE_GFP_T
398                         typedef int gfp_t;
399                         #endif
400                         #include <rdma/rdma_cm.h>
401                         #include <rdma/ib_cm.h>
402                         #include <rdma/ib_verbs.h>
403                         #include <rdma/ib_fmr_pool.h>
404                 ],[
405                         struct rdma_cm_id          *cm_id;
406                         struct rdma_conn_param      conn_param;
407                         struct ib_device_attr       device_attr;
408                         struct ib_qp_attr           qp_attr;
409                         struct ib_pool_fmr          pool_fmr;
410                         enum   ib_cm_rej_reason     rej_reason;
411
412                         cm_id = rdma_create_id(NULL, NULL, RDMA_PS_TCP);
413                         return PTR_ERR(cm_id);
414                 ],[
415                         AC_MSG_RESULT([yes])
416                         O2IBLND="o2iblnd"
417                 ],[
418                         AC_MSG_RESULT([no])
419                         case $ENABLEO2IB in
420                         1) ;;
421                         2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]);;
422                         3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]);;
423                         *) AC_MSG_ERROR([internal error]);;
424                         esac
425                         O2IBLND=""
426                         O2IBCPPFLAGS=""
427                 ])
428                 # we know at this point that the found OFED source is good
429                 O2IB_SYMVER=""
430                 if test $ENABLEO2IB -eq 3 ; then
431                         # OFED default rpm not handle sles10 Modules.symvers name
432                         for name in Module.symvers Modules.symvers; do
433                                 if test -f $O2IBPATH/$name; then
434                                         O2IB_SYMVER=$name;
435                                         break;
436                                 fi
437                         done
438                         if test -n "$O2IB_SYMVER"; then
439                                 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
440                                 # strip out the existing symbols versions first
441                                 if test -f $PWD/$SYMVERFILE; then
442                                 egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
443                                 else
444                                     touch $PWD/$SYMVERFILE.old
445                                 fi
446                                 cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
447                                 rm $PWD/$SYMVERFILE.old
448                         else
449                                 AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
450                         fi
451                 fi
452
453                 LN_CONFIG_OFED_SPEC
454                 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
455         fi
456 fi
457
458 AC_SUBST(EXTRA_LNET_INCLUDE)
459 AC_SUBST(O2IBCPPFLAGS)
460 AC_SUBST(O2IBLND)
461 ])
462
463 #
464 # LN_CONFIG_OPENIB
465 #
466 # check for OpenIB in the kernel
467 AC_DEFUN([LN_CONFIG_OPENIB],[
468 AC_MSG_CHECKING([whether to enable OpenIB support])
469 # set default
470 OPENIBPATH="$LINUX/drivers/infiniband"
471 AC_ARG_WITH([openib],
472         AC_HELP_STRING([--with-openib=path],
473                        [build openiblnd against path]),
474         [
475                 case $with_openib in
476                 yes)    ENABLEOPENIB=2
477                         ;;
478                 no)     ENABLEOPENIB=0
479                         ;;
480                 *)      OPENIBPATH="$with_openib"
481                         ENABLEOPENIB=3
482                         ;;
483                 esac
484         ],[
485                 ENABLEOPENIB=1
486         ])
487 if test $ENABLEOPENIB -eq 0; then
488         AC_MSG_RESULT([disabled])
489 elif test ! \( -f ${OPENIBPATH}/include/ts_ib_core.h -a \
490                -f ${OPENIBPATH}/include/ts_ib_cm.h -a \
491                -f ${OPENIBPATH}/include/ts_ib_sa_client.h \); then
492         AC_MSG_RESULT([no])
493         case $ENABLEOPENIB in
494         1) ;;
495         2) AC_MSG_ERROR([kernel OpenIB headers not present]);;
496         3) AC_MSG_ERROR([bad --with-openib path]);;
497         *) AC_MSG_ERROR([internal error]);;
498         esac
499 else
500         case $ENABLEOPENIB in
501         1|2) OPENIBCPPFLAGS="-I$OPENIBPATH/include -DIN_TREE_BUILD";;
502         3)   OPENIBCPPFLAGS="-I$OPENIBPATH/include";;
503         *)   AC_MSG_RESULT([no])
504              AC_MSG_ERROR([internal error]);;
505         esac
506         OPENIBCPPFLAGS="$OPENIBCPPFLAGS -DIB_NTXRXPARAMS=4"
507         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
508         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $OPENIBCPPFLAGS"
509         LB_LINUX_TRY_COMPILE([
510                 #include <ts_ib_core.h>
511                 #include <ts_ib_cm.h>
512                 #include <ts_ib_sa_client.h>
513         ],[
514                 struct ib_device_properties dev_props;
515                 struct ib_cm_active_param   cm_active_params;
516                 tTS_IB_CLIENT_QUERY_TID     tid;
517                 int                         enum1 = IB_QP_ATTRIBUTE_STATE;
518                 int                         enum2 = IB_ACCESS_LOCAL_WRITE;
519                 int                         enum3 = IB_CQ_CALLBACK_INTERRUPT;
520                 int                         enum4 = IB_CQ_PROVIDER_REARM;
521                 return 0;
522         ],[
523                 AC_MSG_RESULT([yes])
524                 OPENIBLND="openiblnd"
525         ],[
526                 AC_MSG_RESULT([no])
527                 case $ENABLEOPENIB in
528                 1) ;;
529                 2) AC_MSG_ERROR([can't compile with kernel OpenIB headers]);;
530                 3) AC_MSG_ERROR([can't compile with OpenIB headers under $OPENIBPATH]);;
531                 *) AC_MSG_ERROR([internal error]);;
532                 esac
533                 OPENIBLND=""
534                 OPENIBCPPFLAGS=""
535         ])
536         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
537 fi
538 AC_SUBST(OPENIBCPPFLAGS)
539 AC_SUBST(OPENIBLND)
540 ])
541
542 #
543 # LN_CONFIG_CIBLND
544 #
545 AC_DEFUN([LN_CONFIG_CIB],[
546 AC_MSG_CHECKING([whether to enable Cisco/TopSpin IB support])
547 # set default
548 CIBPATH=""
549 CIBLND=""
550 AC_ARG_WITH([cib],
551         AC_HELP_STRING([--with-cib=path],
552                        [build ciblnd against path]),
553         [
554                 case $with_cib in
555                 no)     AC_MSG_RESULT([no]);;
556                 *)      CIBPATH="$with_cib"
557                         if test -d "$CIBPATH"; then
558                                 AC_MSG_RESULT([yes])
559                         else
560                                 AC_MSG_RESULT([no])
561                                 AC_MSG_ERROR([No directory $CIBPATH])
562                         fi;;
563                 esac
564         ],[
565                 AC_MSG_RESULT([no])
566         ])
567 if test -n "$CIBPATH"; then
568         CIBCPPFLAGS="-I${CIBPATH}/ib/ts_api_ng/include -I${CIBPATH}/all/kernel_services/include -DUSING_TSAPI"
569         CIBCPPFLAGS="$CIBCPPFLAGS -DIB_NTXRXPARAMS=3"
570         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
571         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $CIBCPPFLAGS"
572         LB_LINUX_TRY_COMPILE([
573                 #include <ts_ib_core.h>
574                 #include <ts_ib_cm.h>
575                 #include <ts_ib_sa_client.h>
576         ],[
577                 struct ib_device_properties dev_props;
578                 struct ib_cm_active_param   cm_active_params;
579                 tTS_IB_CLIENT_QUERY_TID     tid;
580                 int                         enum1 = TS_IB_QP_ATTRIBUTE_STATE;
581                 int                         enum2 = TS_IB_ACCESS_LOCAL_WRITE;
582                 int                         enum3 = TS_IB_CQ_CALLBACK_INTERRUPT;
583                 int                         enum4 = TS_IB_CQ_PROVIDER_REARM;
584                 return 0;
585         ],[
586                 CIBLND="ciblnd"
587         ],[
588                 AC_MSG_ERROR([can't compile ciblnd with given path])
589                 CIBCPPFLAGS=""
590         ])
591         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
592 fi
593 AC_SUBST(CIBCPPFLAGS)
594 AC_SUBST(CIBLND)
595 ])
596
597 #
598 # LN_CONFIG_IIB
599 #
600 # check for infinicon infiniband support
601 #
602 AC_DEFUN([LN_CONFIG_IIB],[
603 AC_MSG_CHECKING([whether to enable Infinicon support])
604 # set default
605 IIBPATH="/usr/include"
606 AC_ARG_WITH([iib],
607         AC_HELP_STRING([--with-iib=path],
608                        [build iiblnd against path]),
609         [
610                 case $with_iib in
611                 yes)    ENABLEIIB=2
612                         ;;
613                 no)     ENABLEIIB=0
614                         ;;
615                 *)      IIBPATH="${with_iib}/include"
616                         ENABLEIIB=3
617                         ;;
618                 esac
619         ],[
620                 ENABLEIIB=1
621         ])
622 if test $ENABLEIIB -eq 0; then
623         AC_MSG_RESULT([disabled])
624 elif test ! \( -f ${IIBPATH}/linux/iba/ibt.h \); then
625         AC_MSG_RESULT([no])
626         case $ENABLEIIB in
627         1) ;;
628         2) AC_MSG_ERROR([default Infinicon headers not present]);;
629         3) AC_MSG_ERROR([bad --with-iib path]);;
630         *) AC_MSG_ERROR([internal error]);;
631         esac
632 else
633         IIBCPPFLAGS="-I$IIBPATH"
634         if test $IIBPATH != "/usr/include"; then
635                 # we need /usr/include come what may
636                 IIBCPPFLAGS="$IIBCPPFLAGS -I/usr/include"
637         fi
638         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
639         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $IIBCPPFLAGS"
640         LB_LINUX_TRY_COMPILE([
641                 #include <linux/iba/ibt.h>
642         ],[
643                 IBT_INTERFACE_UNION interfaces;
644                 FSTATUS             rc;
645
646                  rc = IbtGetInterfaceByVersion(IBT_INTERFACE_VERSION_2,
647                                                &interfaces);
648
649                 return rc == FSUCCESS ? 0 : 1;
650         ],[
651                 AC_MSG_RESULT([yes])
652                 IIBLND="iiblnd"
653         ],[
654                 AC_MSG_RESULT([no])
655                 case $ENABLEIIB in
656                 1) ;;
657                 2) AC_MSG_ERROR([can't compile with default Infinicon headers]);;
658                 3) AC_MSG_ERROR([can't compile with Infinicon headers under $IIBPATH]);;
659                 *) AC_MSG_ERROR([internal error]);;
660                 esac
661                 IIBLND=""
662                 IIBCPPFLAGS=""
663         ])
664         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
665 fi
666 AC_SUBST(IIBCPPFLAGS)
667 AC_SUBST(IIBLND)
668 ])
669
670 #
671 # LN_CONFIG_VIB
672 #
673 # check for Voltaire infiniband support
674 #
675 AC_DEFUN([LN_CONFIG_VIB],
676 [AC_MSG_CHECKING([whether to enable Voltaire IB support])
677 VIBPATH=""
678 AC_ARG_WITH([vib],
679         AC_HELP_STRING([--with-vib=path],
680                        [build viblnd against path]),
681         [
682                 case $with_vib in
683                 no)     AC_MSG_RESULT([no]);;
684                 *)      VIBPATH="${with_vib}/src/nvigor/ib-code"
685                         if test -d "$with_vib" -a -d "$VIBPATH"; then
686                                 AC_MSG_RESULT([yes])
687                         else
688                                 AC_MSG_RESULT([no])
689                                 AC_MSG_ERROR([No directory $VIBPATH])
690                         fi;;
691                 esac
692         ],[
693                 AC_MSG_RESULT([no])
694         ])
695 if test -z "$VIBPATH"; then
696         VIBLND=""
697 else
698         VIBCPPFLAGS="-I${VIBPATH}/include -I${VIBPATH}/cm"
699         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
700         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
701         LB_LINUX_TRY_COMPILE([
702                 #include <linux/list.h>
703                 #include <asm/byteorder.h>
704                 #ifdef __BIG_ENDIAN
705                 # define CPU_BE 1
706                 # define CPU_LE 0
707                 #endif
708                 #ifdef __LITTLE_ENDIAN
709                 # define CPU_BE 0
710                 # define CPU_LE 1
711                 #endif
712                 #include <vverbs.h>
713                 #include <ib-cm.h>
714                 #include <ibat.h>
715         ],[
716                 vv_hca_h_t       kib_hca;
717                 vv_return_t      vvrc;
718                 cm_cep_handle_t  cep;
719                 ibat_arp_data_t  arp_data;
720                 ibat_stat_t      ibatrc;
721
722                 vvrc = vv_hca_open("ANY_HCA", NULL, &kib_hca);
723                 cep = cm_create_cep(cm_cep_transp_rc);
724                 ibatrc = ibat_get_ib_data((uint32_t)0, (uint32_t)0,
725                                           ibat_paths_primary, &arp_data,
726                                           (ibat_get_ib_data_reply_fn_t)NULL,
727                                           NULL, 0);
728                 return 0;
729         ],[
730                 VIBLND="viblnd"
731         ],[
732                 AC_MSG_ERROR([can't compile viblnd with given path])
733         ])
734         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
735 fi
736 if test -n "$VIBLND"; then
737         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
738         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
739         AC_MSG_CHECKING([if Voltaire still uses void * sg addresses])
740         LB_LINUX_TRY_COMPILE([
741                 #include <linux/list.h>
742                 #include <asm/byteorder.h>
743                 #ifdef __BIG_ENDIAN
744                 # define CPU_BE 1
745                 # define CPU_LE 0
746                 #endif
747                 #ifdef __LITTLE_ENDIAN
748                 # define CPU_BE 0
749                 # define CPU_LE 1
750                 #endif
751                 #include <vverbs.h>
752                 #include <ib-cm.h>
753                 #include <ibat.h>
754         ],[
755                 vv_scatgat_t  sg;
756
757                 return &sg.v_address[3] == NULL;
758         ],[
759                 AC_MSG_RESULT([yes])
760                 VIBCPPFLAGS="$VIBCPPFLAGS -DIBNAL_VOIDSTAR_SGADDR=1"
761         ],[
762                 AC_MSG_RESULT([no])
763         ])
764         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
765 fi
766 AC_SUBST(VIBCPPFLAGS)
767 AC_SUBST(VIBLND)
768 ])
769
770 #
771 # LN_CONFIG_RALND
772 #
773 # check whether to use the RapidArray lnd
774 #
775 AC_DEFUN([LN_CONFIG_RALND],
776 [#### Rapid Array
777 AC_MSG_CHECKING([if RapidArray kernel headers are present])
778 # placeholder
779 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
780 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
781 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
782 LB_LINUX_TRY_COMPILE([
783         #include <linux/types.h>
784         #include <rapl.h>
785 ],[
786         RAP_RETURN          rc;
787         RAP_PVOID           dev_handle;
788
789         rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
790
791         return rc == RAP_SUCCESS ? 0 : 1;
792 ],[
793         AC_MSG_RESULT([yes])
794         RALND="ralnd"
795 ],[
796         AC_MSG_RESULT([no])
797         RALND=""
798         RACPPFLAGS=""
799 ])
800 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
801 AC_SUBST(RACPPFLAGS)
802 AC_SUBST(RALND)
803 ])
804
805
806
807 #
808 #
809 # LN_CONFIG_USERSPACE
810 #
811 # This is defined but empty because it is called from 
812 # build/autconf/lustre-build.m4 which is shared by all branches.
813 #
814 AC_DEFUN([LN_CONFIG_USERSPACE],
815 [
816 ])
817
818 # See if sysctl proc_handler wants only 5 arguments (since 2.6.32)
819 AC_DEFUN([LN_5ARGS_SYSCTL_PROC_HANDLER],
820 [AC_MSG_CHECKING([if sysctl proc_handler wants 5 args])
821 LB_LINUX_TRY_COMPILE([
822        #include <linux/sysctl.h>
823 ],[
824         struct ctl_table *table = NULL;
825        int write = 1;
826        void __user *buffer = NULL;
827        size_t *lenp = NULL;
828        loff_t *ppos = NULL;
829
830        proc_handler *proc_handler;
831        proc_handler(table, write, buffer, lenp, ppos);
832
833 ],[
834         AC_MSG_RESULT(yes)
835         AC_DEFINE(HAVE_5ARGS_SYSCTL_PROC_HANDLER, 1,
836                   [sysctl proc_handler wants 5 args])
837 ],[
838         AC_MSG_RESULT(no)
839 ])
840 ])
841
842 #
843 # LN_PROG_LINUX
844 #
845 # LNet linux kernel checks
846 #
847 AC_DEFUN([LN_PROG_LINUX],
848 [
849 LN_CONFIG_AFFINITY
850 LN_CONFIG_BACKOFF
851 LN_CONFIG_QUADRICS
852 LN_CONFIG_OPENIB
853 LN_CONFIG_CIB
854 LN_CONFIG_VIB
855 LN_CONFIG_IIB
856 LN_CONFIG_O2IB
857 LN_CONFIG_RALND
858 LN_CONFIG_PTLLND
859 LN_CONFIG_MX
860 # 2.6.32
861 LN_5ARGS_SYSCTL_PROC_HANDLER
862 ])
863
864 #
865 # LN_PROG_DARWIN
866 #
867 # Darwin checks
868 #
869 AC_DEFUN([LN_PROG_DARWIN],
870 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
871 ])
872
873 #
874 # LN_PATH_DEFAULTS
875 #
876 # default paths for installed files
877 #
878 AC_DEFUN([LN_PATH_DEFAULTS],
879 [
880 ])
881
882 #
883 # LN_CONFIGURE
884 #
885 # other configure checks
886 #
887 AC_DEFUN([LN_CONFIGURE],
888 [# lnet/utils/portals.c
889 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
890 AC_CHECK_FUNCS([gethostbyname socket connect])
891
892 # lnet/utils/debug.c
893 AC_CHECK_HEADERS([linux/version.h])
894
895 AC_CHECK_TYPE([spinlock_t],
896         [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
897         [],
898         [#include <linux/spinlock.h>])
899
900 # lnet/utils/wirecheck.c
901 AC_CHECK_FUNCS([strnlen])
902
903 # --------  Check for required packages  --------------
904
905 #
906 # LC_CONFIG_READLINE
907 #
908 # Build with readline
909 #
910 AC_MSG_CHECKING([whether to enable readline support])
911 AC_ARG_ENABLE(readline,
912         AC_HELP_STRING([--disable-readline],
913                         [disable readline support]),
914         [],[enable_readline='yes'])
915 AC_MSG_RESULT([$enable_readline])
916
917 # -------- check for readline if enabled ----
918 if test x$enable_readline = xyes ; then
919         LIBS_save="$LIBS"
920         LIBS="-lncurses $LIBS"
921         AC_CHECK_LIB([readline],[readline],[
922         LIBREADLINE="-lreadline -lncurses"
923         AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
924         ],[
925         LIBREADLINE=""
926         ])
927         LIBS="$LIBS_save"
928 else
929         LIBREADLINE=""
930 fi
931 AC_SUBST(LIBREADLINE)
932
933 # -------- enable acceptor libwrap (TCP wrappers) support? -------
934 AC_MSG_CHECKING([if libwrap support is requested])
935 AC_ARG_ENABLE([libwrap],
936         AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
937         [case "${enableval}" in
938                 yes) enable_libwrap=yes ;;
939                 no) enable_libwrap=no ;;
940                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
941         esac],[enable_libwrap=no])
942 AC_MSG_RESULT([$enable_libwrap])
943 if test x$enable_libwrap = xyes ; then
944         LIBWRAP="-lwrap"
945         AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
946 else
947         LIBWRAP=""
948 fi
949 AC_SUBST(LIBWRAP)
950
951 # ----------------------------------------
952 # some tests for catamount-like systems
953 # ----------------------------------------
954 AC_ARG_ENABLE([sysio_init],
955         AC_HELP_STRING([--disable-sysio-init],
956                 [call sysio init functions when initializing liblustre]),
957         [],[enable_sysio_init=yes])
958 AC_MSG_CHECKING([whether to initialize libsysio])
959 AC_MSG_RESULT([$enable_sysio_init])
960 if test x$enable_sysio_init != xno ; then
961         AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
962 fi
963
964 AC_ARG_ENABLE([urandom],
965         AC_HELP_STRING([--disable-urandom],
966                 [disable use of /dev/urandom for liblustre]),
967         [],[enable_urandom=yes])
968 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
969 AC_MSG_RESULT([$enable_urandom])
970 if test x$enable_urandom != xno ; then
971         AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
972 fi
973
974 # -------- check for -lcap support ----
975 if test x$enable_liblustre = xyes ; then
976         AC_CHECK_LIB([cap], [cap_get_proc],
977                 [
978                         CAP_LIBS="-lcap"
979                         AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
980                 ],
981                 [
982                         CAP_LIBS=""
983                 ])
984         AC_SUBST(CAP_LIBS)
985
986 fi
987
988 LN_CONFIG_MAX_PAYLOAD
989 LN_CONFIG_UPTLLND
990 LN_CONFIG_USOCKLND
991 ])
992
993 #
994 # LN_CONDITIONALS
995 #
996 # AM_CONDITOINAL defines for lnet
997 #
998 AC_DEFUN([LN_CONDITIONALS],
999 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
1000 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
1001 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
1002 AM_CONDITIONAL(BUILD_OPENIBLND, test x$OPENIBLND = "xopeniblnd")
1003 AM_CONDITIONAL(BUILD_CIBLND, test x$CIBLND = "xciblnd")
1004 AM_CONDITIONAL(BUILD_IIBLND, test x$IIBLND = "xiiblnd")
1005 AM_CONDITIONAL(BUILD_VIBLND, test x$VIBLND = "xviblnd")
1006 AM_CONDITIONAL(BUILD_RALND, test x$RALND = "xralnd")
1007 AM_CONDITIONAL(BUILD_PTLLND, test x$PTLLND = "xptllnd")
1008 AM_CONDITIONAL(BUILD_UPTLLND, test x$UPTLLND = "xptllnd")
1009 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
1010 ])
1011
1012 #
1013 # LN_CONFIG_FILES
1014 #
1015 # files that should be generated with AC_OUTPUT
1016 #
1017 AC_DEFUN([LN_CONFIG_FILES],
1018 [AC_CONFIG_FILES([
1019 lnet/Kernelenv
1020 lnet/Makefile
1021 lnet/autoMakefile
1022 lnet/autoconf/Makefile
1023 lnet/doc/Makefile
1024 lnet/include/Makefile
1025 lnet/include/lnet/Makefile
1026 lnet/include/lnet/linux/Makefile
1027 lnet/klnds/Makefile
1028 lnet/klnds/autoMakefile
1029 lnet/klnds/mxlnd/autoMakefile
1030 lnet/klnds/mxlnd/Makefile
1031 lnet/klnds/openiblnd/Makefile
1032 lnet/klnds/openiblnd/autoMakefile
1033 lnet/klnds/o2iblnd/Makefile
1034 lnet/klnds/o2iblnd/autoMakefile
1035 lnet/klnds/ciblnd/Makefile
1036 lnet/klnds/ciblnd/autoMakefile
1037 lnet/klnds/iiblnd/Makefile
1038 lnet/klnds/iiblnd/autoMakefile
1039 lnet/klnds/viblnd/Makefile
1040 lnet/klnds/viblnd/autoMakefile
1041 lnet/klnds/qswlnd/Makefile
1042 lnet/klnds/qswlnd/autoMakefile
1043 lnet/klnds/ralnd/Makefile
1044 lnet/klnds/ralnd/autoMakefile
1045 lnet/klnds/socklnd/Makefile
1046 lnet/klnds/socklnd/autoMakefile
1047 lnet/klnds/ptllnd/Makefile
1048 lnet/klnds/ptllnd/autoMakefile
1049 lnet/lnet/Makefile
1050 lnet/lnet/autoMakefile
1051 lnet/selftest/Makefile
1052 lnet/selftest/autoMakefile
1053 lnet/ulnds/Makefile
1054 lnet/ulnds/autoMakefile
1055 lnet/ulnds/socklnd/Makefile
1056 lnet/ulnds/ptllnd/Makefile
1057 lnet/utils/Makefile
1058 lnet/utils/pthread/Makefile
1059 lnet/include/lnet/darwin/Makefile
1060 ])
1061 ])