Whamcloud - gitweb
Landing b_hd_newconfig on HEAD
[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_ZEROCOPY
46 #
47 # check if zerocopy is available/wanted
48 #
49 AC_DEFUN([LN_CONFIG_ZEROCOPY],
50 [AC_ARG_ENABLE([zerocopy],
51         AC_HELP_STRING([--disable-zerocopy],
52                        [disable socklnd zerocopy]),
53         [],[enable_zerocopy='yes'])
54 AC_MSG_CHECKING([for zero-copy TCP support])
55 if test x$enable_zerocopy = xno ; then
56         AC_MSG_RESULT([no (by request)])
57 else
58         ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
59         if test "$ZCCD" = 0 ; then
60                 AC_MSG_RESULT([no (no kernel support)])
61         else
62                 AC_MSG_RESULT([yes])
63                 AC_MSG_CHECKING([for up-to-date tcp zero-copy patch])
64                 LB_LINUX_TRY_COMPILE([
65                         #include <linux/config.h>
66                         #include <linux/kernel.h>
67                         #include <linux/sched.h>
68                         #include <linux/types.h>
69                         #include <linux/in.h>
70                         #include <linux/string.h>
71                         #include <linux/init.h>
72                         #include <linux/errno.h>
73                         #include <linux/interrupt.h>
74                         #include <linux/netdevice.h>
75                         #include <linux/skbuff.h>
76                 ],[
77                         struct zccd zc = {0};
78
79                         return atomic_read(&zc.zccd_refcount);
80                 ],[
81                         AC_MSG_RESULT([yes])
82                         AC_DEFINE(SOCKNAL_ZC, 1, [enable zero-copy support])
83                 ],[
84                         AC_MSG_RESULT([no])
85                         AC_MSG_ERROR([old TCP zero-copy in kernel (bug 10889) - use --disable-zerocopy to continue ])
86                 ])
87         fi
88 fi
89 ])
90
91 #
92 # LN_CONFIG_AFFINITY
93 #
94 # check if cpu affinity is available/wanted
95 #
96 AC_DEFUN([LN_CONFIG_AFFINITY],
97 [AC_ARG_ENABLE([affinity],
98         AC_HELP_STRING([--disable-affinity],
99                        [disable process/irq affinity]),
100         [],[enable_affinity='yes'])
101
102 AC_MSG_CHECKING([for CPU affinity support])
103 if test x$enable_affinity = xno ; then
104         AC_MSG_RESULT([no (by request)])
105 else
106         LB_LINUX_TRY_COMPILE([
107                 #include <linux/sched.h>
108         ],[
109                 struct task_struct t;
110                 #if HAVE_CPUMASK_T
111                 cpumask_t     m;
112                 #else
113                 unsigned long m;
114                 #endif
115                 set_cpus_allowed(&t, m);
116         ],[
117                 AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
118                 AC_MSG_RESULT([yes])
119         ],[
120                 AC_MSG_RESULT([no (no kernel support)])
121         ])
122 fi
123 ])
124
125 #
126 # LN_CONFIG_PORTALS
127 #
128 # configure support for Portals
129 #
130 AC_DEFUN([LN_CONFIG_PORTALS],
131 [AC_MSG_CHECKING([for portals])
132 AC_ARG_WITH([portals],
133         AC_HELP_STRING([--with-portals=path],
134                        [set path to portals]),
135         [
136                 case $with_portals in
137                         no)     ENABLEPORTALS=0
138                                 ;;
139                         *)      PORTALS="${with_portals}"
140                                 ENABLEPORTALS=1
141                                 ;;
142                 esac
143                 
144         ], [
145                 ENABLEPORTALS=0
146         ])
147 PTLLNDCPPFLAGS=""
148 if test $ENABLEPORTALS -eq 0; then
149         AC_MSG_RESULT([no])
150 elif test ! \( -f ${PORTALS}/include/portals/p30.h \); then
151         AC_MSG_RESULT([no])
152         AC_MSG_ERROR([bad --with-portals path])
153 else
154         AC_MSG_RESULT([$PORTALS])
155         PTLLNDCPPFLAGS="-I${PORTALS}/include"
156 fi
157 AC_SUBST(PTLLNDCPPFLAGS)
158 ])
159
160 #
161 # LN_CONFIG_BACKOFF
162 #
163 # check if tunable tcp backoff is available/wanted
164 #
165 AC_DEFUN([LN_CONFIG_BACKOFF],
166 [AC_MSG_CHECKING([for tunable backoff TCP support])
167 AC_ARG_ENABLE([backoff],
168        AC_HELP_STRING([--disable-backoff],
169                       [disable socknal tunable backoff]),
170        [],[enable_backoff='yes'])
171 if test x$enable_backoff = xno ; then
172        AC_MSG_RESULT([no (by request)])
173 else
174        BOCD="`grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h`"
175        if test "$BOCD" != 0 ; then
176                AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
177                AC_MSG_RESULT(yes)
178        else
179                AC_MSG_RESULT([no (no kernel support)])
180        fi
181 fi
182 ])
183
184 #
185 # LN_CONFIG_PANIC_DUMPLOG
186 #
187 # check if tunable panic_dumplog is wanted
188 #
189 AC_DEFUN([LN_CONFIG_PANIC_DUMPLOG],
190 [AC_MSG_CHECKING([for tunable panic_dumplog support])
191 AC_ARG_ENABLE([panic_dumplog],
192        AC_HELP_STRING([--enable-panic_dumplog],
193                       [enable panic_dumplog]),
194        [],[enable_panic_dumplog='no'])
195 if test x$enable_panic_dumplog = xyes ; then
196        AC_DEFINE(LNET_DUMP_ON_PANIC, 1, [use dumplog on panic])
197        AC_MSG_RESULT([yes (by request)])
198 else
199        AC_MSG_RESULT([no])
200 fi
201 ])
202
203 #
204 # LN_CONFIG_PTLLND
205 #
206 # configure support for Portals LND
207 #
208 AC_DEFUN([LN_CONFIG_PTLLND],
209 [
210 if test -z "$ENABLEPORTALS"; then
211         LN_CONFIG_PORTALS
212 fi
213
214 AC_MSG_CHECKING([whether to build the kernel portals LND])
215
216 PTLLND=""
217 if test $ENABLEPORTALS -ne 0; then
218         AC_MSG_RESULT([yes])
219         PTLLND="ptllnd"
220 else
221         AC_MSG_RESULT([no])
222 fi
223 AC_SUBST(PTLLND)
224 ])
225
226 #
227 # LN_CONFIG_UPTLLND
228 #
229 # configure support for Portals LND
230 #
231 AC_DEFUN([LN_CONFIG_UPTLLND],
232 [
233 if test -z "$ENABLEPORTALS"; then
234         LN_CONFIG_PORTALS
235 fi
236
237 AC_MSG_CHECKING([whether to build the userspace portals LND])
238
239 UPTLLND=""
240 if test $ENABLEPORTALS -ne 0; then
241         AC_MSG_RESULT([yes])
242         UPTLLND="ptllnd"
243 else
244         AC_MSG_RESULT([no])
245 fi
246 AC_SUBST(UPTLLND)
247 ])
248
249 #
250 # LN_CONFIG_USOCKLND
251 #
252 # configure support for userspace TCP/IP LND
253 #
254 AC_DEFUN([LN_CONFIG_USOCKLND],
255 [AC_MSG_CHECKING([whether to build usocklnd])
256 AC_ARG_ENABLE([usocklnd],
257         AC_HELP_STRING([--disable-usocklnd],
258                         [disable usocklnd]),
259         [],[enable_usocklnd='yes'])
260
261 if test x$enable_usocklnd = xyes ; then
262         if test "$ENABLE_LIBPTHREAD" = "yes" ; then
263                 AC_MSG_RESULT([yes])
264                 USOCKLND="usocklnd"
265         else
266                 AC_MSG_RESULT([no (libpthread not present or disabled)])
267                 USOCKLND=""
268         fi
269 else
270         AC_MSG_RESULT([no (disabled explicitly)])
271         USOCKLND=""
272 fi
273 AC_SUBST(USOCKLND)
274 ])
275
276 #
277 # LN_CONFIG_QUADRICS
278 #
279 # check if quadrics support is in this kernel
280 #
281 AC_DEFUN([LN_CONFIG_QUADRICS],
282 [AC_MSG_CHECKING([for QsNet sources])
283 AC_ARG_WITH([qsnet],
284         AC_HELP_STRING([--with-qsnet=path],
285                        [set path to qsnet source (default=$LINUX)]),
286         [QSNET=$with_qsnet],
287         [QSNET=$LINUX])
288 AC_MSG_RESULT([$QSNET])
289
290 AC_MSG_CHECKING([if quadrics kernel headers are present])
291 if test -d $QSNET/drivers/net/qsnet ; then
292         AC_MSG_RESULT([yes])
293         QSWLND="qswlnd"
294         AC_MSG_CHECKING([for multirail EKC])
295         if test -f $QSNET/include/elan/epcomms.h; then
296                 AC_MSG_RESULT([supported])
297                 QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
298         else
299                 AC_MSG_RESULT([not supported])
300                 AC_MSG_ERROR([Need multirail EKC])
301         fi
302
303         if test x$QSNET = x$LINUX ; then
304                 LB_LINUX_CONFIG([QSNET],[],[
305                         LB_LINUX_CONFIG([QSNET_MODULE],[],[
306                                 AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswlnd.])
307                                 QSWLND=""
308                                 QSWCPPFLAGS=""
309                         ])
310                 ])
311         fi
312 else
313         AC_MSG_RESULT([no])
314         QSWLND=""
315         QSWCPPFLAGS=""
316 fi
317 AC_SUBST(QSWCPPFLAGS)
318 AC_SUBST(QSWLND)
319 ])
320
321 #
322 # LN_CONFIG_GM
323 #
324 # check if GM support is available
325 #
326 AC_DEFUN([LN_CONFIG_GM],[
327 AC_MSG_CHECKING([whether to enable GM support])
328 AC_ARG_WITH([gm],
329         AC_HELP_STRING([--with-gm=path-to-gm-source-tree],
330                        [build gmlnd against path]),
331         [
332                 case $with_gm in
333                 no)    ENABLE_GM=0
334                        ;;
335                 *)     ENABLE_GM=1
336                        GM_SRC="$with_gm"
337                        ;;
338                 esac
339         ],[
340                 ENABLE_GM=0
341         ])
342 AC_ARG_WITH([gm-install],
343         AC_HELP_STRING([--with-gm-install=path-to-gm-install-tree],
344                        [say where GM has been installed]),
345         [
346                 GM_INSTALL=$with_gm_install
347         ],[
348                 GM_INSTALL="/opt/gm"
349         ])
350 if test $ENABLE_GM -eq 0; then
351         AC_MSG_RESULT([no])
352 else
353         AC_MSG_RESULT([yes])
354
355         GMLND="gmlnd"
356         GMCPPFLAGS="-I$GM_SRC/include -I$GM_SRC/drivers -I$GM_SRC/drivers/linux/gm"
357
358         if test -f $GM_INSTALL/lib/libgm.a -o \
359                 -f $GM_INSTALL/lib64/libgm.a; then
360                 GMLIBS="-L$GM_INSTALL/lib -L$GM_INSTALL/lib64"
361         else
362                 AC_MSG_ERROR([Cant find GM libraries under $GM_INSTALL])
363         fi
364
365         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
366         EXTRA_KCFLAGS="$GMCPPFLAGS -DGM_KERNEL $EXTRA_KCFLAGS"
367
368         AC_MSG_CHECKING([that code using GM compiles with given path])
369         LB_LINUX_TRY_COMPILE([
370                 #define GM_STRONG_TYPES 1
371                 #ifdef VERSION
372                 #undef VERSION
373                 #endif
374                 #include "gm.h"
375                 #include "gm_internal.h"
376         ],[
377                 struct gm_port *port = NULL;
378                 gm_recv_event_t *rxevent = gm_blocking_receive_no_spin(port);
379                 return 0;
380         ],[
381                 AC_MSG_RESULT([yes])
382         ],[
383                 AC_MSG_RESULT([no])
384                 AC_MSG_ERROR([Bad --with-gm path])
385         ])
386
387         AC_MSG_CHECKING([that GM has gm_register_memory_ex_phys()])
388         LB_LINUX_TRY_COMPILE([
389                 #define GM_STRONG_TYPES 1
390                 #ifdef VERSION
391                 #undef VERSION
392                 #endif
393                 #include "gm.h"
394                 #include "gm_internal.h"
395         ],[
396                 gm_status_t     gmrc;
397                 struct gm_port *port = NULL;
398                 gm_u64_t        phys = 0;
399                 gm_up_t         pvma = 0;
400
401                 gmrc = gm_register_memory_ex_phys(port, phys, 100, pvma);
402                 return 0;
403         ],[
404                 AC_MSG_RESULT([yes])
405         ],[
406                 AC_MSG_RESULT([no.
407 Please patch the GM sources as follows...
408     cd $GM_SRC
409     patch -p0 < $PWD/lnet/klnds/gmlnd/gm-reg-phys.patch
410 ...then rebuild and re-install them])
411                 AC_MSG_ERROR([Can't build GM without gm_register_memory_ex_phys()])
412         ])
413
414         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
415 fi
416 AC_SUBST(GMCPPFLAGS)
417 AC_SUBST(GMLIBS)
418 AC_SUBST(GMLND)
419 ])
420
421
422 #
423 # LN_CONFIG_MX
424 #
425 AC_DEFUN([LN_CONFIG_MX],
426 [AC_MSG_CHECKING([whether to enable Myrinet MX support])
427 # set default
428 MXPATH="/opt/mx"
429 AC_ARG_WITH([mx],
430        AC_HELP_STRING([--with-mx=path],
431                       [build mxlnd against path]),
432        [
433                case $with_mx in
434                yes)    ENABLEMX=2
435                        ;;
436                no)     ENABLEMX=0
437                        ;;
438                *)      MXPATH=$with_mx
439                        ENABLEMX=3
440                        ;;
441                esac
442        ],[
443                ENABLEMX=1
444        ])
445 if test $ENABLEMX -eq 0; then
446        AC_MSG_RESULT([disabled])
447 elif test ! \( -f ${MXPATH}/include/myriexpress.h -a \
448               -f ${MXPATH}/include/mx_kernel_api.h -a \
449               -f ${MXPATH}/include/mx_pin.h \); then
450        AC_MSG_RESULT([no])
451        case $ENABLEMX in
452        1) ;;
453        2) AC_MSG_ERROR([Myrinet MX kernel headers not present]);;
454        3) AC_MSG_ERROR([bad --with-mx path]);;
455        *) AC_MSG_ERROR([internal error]);;
456        esac
457 else
458        MXCPPFLAGS="-I$MXPATH/include"
459        EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
460        EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
461        MXLIBS="-L$MXPATH/lib"
462        LB_LINUX_TRY_COMPILE([
463                #define MX_KERNEL 1
464                #include <mx_extensions.h>
465                #include <myriexpress.h>
466        ],[
467                mx_endpoint_t   end;
468                mx_status_t     status;
469                mx_request_t    request;
470                int             result;
471
472                mx_init();
473                mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
474                mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
475                mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
476                mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
477                return 0;
478        ],[
479                AC_MSG_RESULT([yes])
480                MXLND="mxlnd"
481        ],[
482                AC_MSG_RESULT([no])
483                case $ENABLEMX in
484                1) ;;
485                2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]);;
486                3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]);;
487                *) AC_MSG_ERROR([internal error]);;
488                esac
489                MXLND=""
490                MXCPPFLAGS=""
491        ])
492        EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
493 fi
494 AC_SUBST(MXCPPFLAGS)
495 AC_SUBST(MXLIBS)
496 AC_SUBST(MXLND)
497 ])
498
499
500
501 #
502 # LN_CONFIG_O2IB
503 #
504 AC_DEFUN([LN_CONFIG_O2IB],[
505 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
506 # set default
507 O2IBPATH="$LINUX/drivers/infiniband"
508 AC_ARG_WITH([o2ib],
509         AC_HELP_STRING([--with-o2ib=path],
510                        [build o2iblnd against path]),
511         [
512                 case $with_o2ib in
513                 yes)    ENABLEO2IB=2
514                         ;;
515                 no)     ENABLEO2IB=0
516                         ;;
517                 *)      O2IBPATH=$with_o2ib
518                         ENABLEO2IB=3
519                         ;;
520                 esac
521         ],[
522                 ENABLEO2IB=1
523         ])
524 if test $ENABLEO2IB -eq 0; then
525         AC_MSG_RESULT([disabled])
526 elif test ! \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
527                -f ${O2IBPATH}/include/rdma/ib_cm.h -a\
528                -f ${O2IBPATH}/include/rdma/ib_verbs.h -a\
529                -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
530         AC_MSG_RESULT([no])
531         case $ENABLEO2IB in
532         1) ;;
533         2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]);;
534         3) AC_MSG_ERROR([bad --with-o2ib path]);;
535         *) AC_MSG_ERROR([internal error]);;
536         esac
537 else
538         O2IBCPPFLAGS="-I$O2IBPATH/include"
539         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
540         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $O2IBCPPFLAGS"
541         LB_LINUX_TRY_COMPILE([
542                 #include <linux/version.h>
543                 #if !HAVE_GFP_T
544                 typedef int gfp_t;
545                 #endif
546                 #include <rdma/rdma_cm.h>
547                 #include <rdma/ib_cm.h>
548                 #include <rdma/ib_verbs.h>
549                 #include <rdma/ib_fmr_pool.h>
550         ],[
551                 struct rdma_cm_id          *cm_id;
552                 struct rdma_conn_param      conn_param;
553                 struct ib_device_attr       device_attr;
554                 struct ib_qp_attr           qp_attr;
555                 struct ib_pool_fmr          pool_fmr;           
556                 enum   ib_cm_rej_reason     rej_reason;
557
558                 cm_id = rdma_create_id(NULL, NULL, RDMA_PS_TCP);
559                 return PTR_ERR(cm_id);
560         ],[
561                 AC_MSG_RESULT([yes])
562                 O2IBLND="o2iblnd"
563         ],[
564                 AC_MSG_RESULT([no])
565                 case $ENABLEO2IB in
566                 1) ;;
567                 2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]);;
568                 3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]);;
569                 *) AC_MSG_ERROR([internal error]);;
570                 esac
571                 O2IBLND=""
572                 O2IBCPPFLAGS=""
573         ])
574         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
575 fi
576 AC_SUBST(O2IBCPPFLAGS)
577 AC_SUBST(O2IBLND)
578 ])
579
580 #
581 # LN_CONFIG_OPENIB
582 #
583 # check for OpenIB in the kernel
584 AC_DEFUN([LN_CONFIG_OPENIB],[
585 AC_MSG_CHECKING([whether to enable OpenIB support])
586 # set default
587 OPENIBPATH="$LINUX/drivers/infiniband"
588 AC_ARG_WITH([openib],
589         AC_HELP_STRING([--with-openib=path],
590                        [build openiblnd against path]),
591         [
592                 case $with_openib in
593                 yes)    ENABLEOPENIB=2
594                         ;;
595                 no)     ENABLEOPENIB=0
596                         ;;
597                 *)      OPENIBPATH="$with_openib"
598                         ENABLEOPENIB=3
599                         ;;
600                 esac
601         ],[
602                 ENABLEOPENIB=1
603         ])
604 if test $ENABLEOPENIB -eq 0; then
605         AC_MSG_RESULT([disabled])
606 elif test ! \( -f ${OPENIBPATH}/include/ts_ib_core.h -a \
607                -f ${OPENIBPATH}/include/ts_ib_cm.h -a\
608                -f ${OPENIBPATH}/include/ts_ib_sa_client.h \); then
609         AC_MSG_RESULT([no])
610         case $ENABLEOPENIB in
611         1) ;;
612         2) AC_MSG_ERROR([kernel OpenIB headers not present]);;
613         3) AC_MSG_ERROR([bad --with-openib path]);;
614         *) AC_MSG_ERROR([internal error]);;
615         esac
616 else
617         case $ENABLEOPENIB in
618         1|2) OPENIBCPPFLAGS="-I$OPENIBPATH/include -DIN_TREE_BUILD";;
619         3)   OPENIBCPPFLAGS="-I$OPENIBPATH/include";;
620         *)   AC_MSG_RESULT([no])
621              AC_MSG_ERROR([internal error]);;
622         esac
623         OPENIBCPPFLAGS="$OPENIBCPPFLAGS -DIB_NTXRXPARAMS=4"
624         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
625         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $OPENIBCPPFLAGS"
626         LB_LINUX_TRY_COMPILE([
627                 #include <ts_ib_core.h>
628                 #include <ts_ib_cm.h>
629                 #include <ts_ib_sa_client.h>
630         ],[
631                 struct ib_device_properties dev_props;
632                 struct ib_cm_active_param   cm_active_params;
633                 tTS_IB_CLIENT_QUERY_TID     tid;
634                 int                         enum1 = IB_QP_ATTRIBUTE_STATE;
635                 int                         enum2 = IB_ACCESS_LOCAL_WRITE;
636                 int                         enum3 = IB_CQ_CALLBACK_INTERRUPT;
637                 int                         enum4 = IB_CQ_PROVIDER_REARM;
638                 return 0;
639         ],[
640                 AC_MSG_RESULT([yes])
641                 OPENIBLND="openiblnd"
642         ],[
643                 AC_MSG_RESULT([no])
644                 case $ENABLEOPENIB in
645                 1) ;;
646                 2) AC_MSG_ERROR([can't compile with kernel OpenIB headers]);;
647                 3) AC_MSG_ERROR([can't compile with OpenIB headers under $OPENIBPATH]);;
648                 *) AC_MSG_ERROR([internal error]);;
649                 esac
650                 OPENIBLND=""
651                 OPENIBCPPFLAGS=""
652         ])
653         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
654 fi
655 AC_SUBST(OPENIBCPPFLAGS)
656 AC_SUBST(OPENIBLND)
657 ])
658
659 #
660 # LN_CONFIG_CIBLND
661 #
662 AC_DEFUN([LN_CONFIG_CIB],[
663 AC_MSG_CHECKING([whether to enable Cisco/TopSpin IB support])
664 # set default
665 CIBPATH=""
666 CIBLND=""
667 AC_ARG_WITH([cib],
668         AC_HELP_STRING([--with-cib=path],
669                        [build ciblnd against path]),
670         [
671                 case $with_cib in
672                 no)     AC_MSG_RESULT([no]);;
673                 *)      CIBPATH="$with_cib"
674                         if test -d "$CIBPATH"; then
675                                 AC_MSG_RESULT([yes])
676                         else
677                                 AC_MSG_RESULT([no])
678                                 AC_MSG_ERROR([No directory $CIBPATH])
679                         fi;;
680                 esac
681         ],[
682                 AC_MSG_RESULT([no])
683         ])
684 if test -n "$CIBPATH"; then
685         CIBCPPFLAGS="-I${CIBPATH}/ib/ts_api_ng/include -I${CIBPATH}/all/kernel_services/include -DUSING_TSAPI"
686         CIBCPPFLAGS="$CIBCPPFLAGS -DIB_NTXRXPARAMS=3"
687         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
688         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $CIBCPPFLAGS"
689         LB_LINUX_TRY_COMPILE([
690                 #include <ts_ib_core.h>
691                 #include <ts_ib_cm.h>
692                 #include <ts_ib_sa_client.h>
693         ],[
694                 struct ib_device_properties dev_props;
695                 struct ib_cm_active_param   cm_active_params;
696                 tTS_IB_CLIENT_QUERY_TID     tid;
697                 int                         enum1 = TS_IB_QP_ATTRIBUTE_STATE;
698                 int                         enum2 = TS_IB_ACCESS_LOCAL_WRITE;
699                 int                         enum3 = TS_IB_CQ_CALLBACK_INTERRUPT;
700                 int                         enum4 = TS_IB_CQ_PROVIDER_REARM;
701                 return 0;
702         ],[
703                 CIBLND="ciblnd"
704         ],[
705                 AC_MSG_ERROR([can't compile ciblnd with given path])
706                 CIBCPPFLAGS=""
707         ])
708         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
709 fi
710 AC_SUBST(CIBCPPFLAGS)
711 AC_SUBST(CIBLND)
712 ])
713
714 #
715 # LN_CONFIG_IIB
716 #
717 # check for infinicon infiniband support
718 #
719 AC_DEFUN([LN_CONFIG_IIB],[
720 AC_MSG_CHECKING([whether to enable Infinicon support])
721 # set default
722 IIBPATH="/usr/include"
723 AC_ARG_WITH([iib],
724         AC_HELP_STRING([--with-iib=path],
725                        [build iiblnd against path]),
726         [
727                 case $with_iib in
728                 yes)    ENABLEIIB=2
729                         ;;
730                 no)     ENABLEIIB=0
731                         ;;
732                 *)      IIBPATH="${with_iib}/include"
733                         ENABLEIIB=3
734                         ;;
735                 esac
736         ],[
737                 ENABLEIIB=1
738         ])
739 if test $ENABLEIIB -eq 0; then
740         AC_MSG_RESULT([disabled])
741 elif test ! \( -f ${IIBPATH}/linux/iba/ibt.h \); then
742         AC_MSG_RESULT([no])
743         case $ENABLEIIB in
744         1) ;;
745         2) AC_MSG_ERROR([default Infinicon headers not present]);;
746         3) AC_MSG_ERROR([bad --with-iib path]);;
747         *) AC_MSG_ERROR([internal error]);;
748         esac
749 else
750         IIBCPPFLAGS="-I$IIBPATH"
751         if test $IIBPATH != "/usr/include"; then
752                 # we need /usr/include come what may
753                 IIBCPPFLAGS="$IIBCPPFLAGS -I/usr/include"
754         fi
755         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
756         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $IIBCPPFLAGS"
757         LB_LINUX_TRY_COMPILE([
758                 #include <linux/iba/ibt.h>
759         ],[
760                 IBT_INTERFACE_UNION interfaces;
761                 FSTATUS             rc;
762
763                  rc = IbtGetInterfaceByVersion(IBT_INTERFACE_VERSION_2,
764                                                &interfaces);
765
766                 return rc == FSUCCESS ? 0 : 1;
767         ],[
768                 AC_MSG_RESULT([yes])
769                 IIBLND="iiblnd"
770         ],[
771                 AC_MSG_RESULT([no])
772                 case $ENABLEIIB in
773                 1) ;;
774                 2) AC_MSG_ERROR([can't compile with default Infinicon headers]);;
775                 3) AC_MSG_ERROR([can't compile with Infinicon headers under $IIBPATH]);;
776                 *) AC_MSG_ERROR([internal error]);;
777                 esac
778                 IIBLND=""
779                 IIBCPPFLAGS=""
780         ])
781         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
782 fi
783 AC_SUBST(IIBCPPFLAGS)
784 AC_SUBST(IIBLND)
785 ])
786
787 #
788 # LN_CONFIG_VIB
789 #
790 # check for Voltaire infiniband support
791 #
792 AC_DEFUN([LN_CONFIG_VIB],
793 [AC_MSG_CHECKING([whether to enable Voltaire IB support])
794 VIBPATH=""
795 AC_ARG_WITH([vib],
796         AC_HELP_STRING([--with-vib=path],
797                        [build viblnd against path]),
798         [
799                 case $with_vib in
800                 no)     AC_MSG_RESULT([no]);;
801                 *)      VIBPATH="${with_vib}/src/nvigor/ib-code"
802                         if test -d "$with_vib" -a -d "$VIBPATH"; then
803                                 AC_MSG_RESULT([yes])
804                         else
805                                 AC_MSG_RESULT([no])
806                                 AC_MSG_ERROR([No directory $VIBPATH])
807                         fi;;
808                 esac
809         ],[
810                 AC_MSG_RESULT([no])
811         ])
812 if test -z "$VIBPATH"; then
813         VIBLND=""
814 else
815         VIBCPPFLAGS="-I${VIBPATH}/include -I${VIBPATH}/cm"
816         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
817         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
818         LB_LINUX_TRY_COMPILE([
819                 #include <linux/list.h>
820                 #include <asm/byteorder.h>
821                 #ifdef __BIG_ENDIAN
822                 # define CPU_BE 1
823                 # define CPU_LE 0
824                 #endif
825                 #ifdef __LITTLE_ENDIAN
826                 # define CPU_BE 0
827                 # define CPU_LE 1
828                 #endif
829                 #include <vverbs.h>
830                 #include <ib-cm.h>
831                 #include <ibat.h>
832         ],[
833                 vv_hca_h_t       kib_hca;
834                 vv_return_t      vvrc;
835                 cm_cep_handle_t  cep;
836                 ibat_arp_data_t  arp_data;
837                 ibat_stat_t      ibatrc;
838
839                 vvrc = vv_hca_open("ANY_HCA", NULL, &kib_hca);
840                 cep = cm_create_cep(cm_cep_transp_rc);
841                 ibatrc = ibat_get_ib_data((uint32_t)0, (uint32_t)0,
842                                           ibat_paths_primary, &arp_data,
843                                           (ibat_get_ib_data_reply_fn_t)NULL,
844                                           NULL, 0);
845                 return 0;
846         ],[
847                 VIBLND="viblnd"
848         ],[
849                 AC_MSG_ERROR([can't compile viblnd with given path])
850         ])
851         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
852 fi
853 if test -n "$VIBLND"; then
854         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
855         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
856         AC_MSG_CHECKING([if Voltaire still uses void * sg addresses])
857         LB_LINUX_TRY_COMPILE([
858                 #include <linux/list.h>
859                 #include <asm/byteorder.h>
860                 #ifdef __BIG_ENDIAN
861                 # define CPU_BE 1
862                 # define CPU_LE 0
863                 #endif
864                 #ifdef __LITTLE_ENDIAN
865                 # define CPU_BE 0
866                 # define CPU_LE 1
867                 #endif
868                 #include <vverbs.h>
869                 #include <ib-cm.h>
870                 #include <ibat.h>
871         ],[
872                 vv_scatgat_t  sg;
873
874                 return &sg.v_address[3] == NULL;
875         ],[
876                 AC_MSG_RESULT([yes])
877                 VIBCPPFLAGS="$VIBCPPFLAGS -DIBNAL_VOIDSTAR_SGADDR=1"
878         ],[
879                 AC_MSG_RESULT([no])
880         ])
881         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
882 fi
883 AC_SUBST(VIBCPPFLAGS)
884 AC_SUBST(VIBLND)
885 ])
886
887 #
888 # LN_CONFIG_RALND
889 #
890 # check whether to use the RapidArray lnd
891 #
892 AC_DEFUN([LN_CONFIG_RALND],
893 [#### Rapid Array
894 AC_MSG_CHECKING([if RapidArray kernel headers are present])
895 # placeholder
896 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
897 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
898 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
899 LB_LINUX_TRY_COMPILE([
900         #include <linux/types.h>
901         #include <rapl.h>
902 ],[
903         RAP_RETURN          rc;
904         RAP_PVOID           dev_handle;
905
906         rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
907
908         return rc == RAP_SUCCESS ? 0 : 1;
909 ],[
910         AC_MSG_RESULT([yes])
911         RALND="ralnd"
912 ],[
913         AC_MSG_RESULT([no])
914         RALND=""
915         RACPPFLAGS=""
916 ])
917 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
918 AC_SUBST(RACPPFLAGS)
919 AC_SUBST(RALND)
920 ])
921
922 #
923 # LN_STRUCT_PAGE_LIST
924 #
925 # 2.6.4 no longer has page->list
926 #
927 AC_DEFUN([LN_STRUCT_PAGE_LIST],
928 [AC_MSG_CHECKING([if struct page has a list field])
929 LB_LINUX_TRY_COMPILE([
930         #include <linux/mm.h>
931 ],[
932         struct page page;
933         &page.list;
934 ],[
935         AC_MSG_RESULT([yes])
936         AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
937 ],[
938         AC_MSG_RESULT([no])
939 ])
940 ])
941
942 #
943 # LN_STRUCT_SIGHAND
944 #
945 # red hat 2.4 adds sighand to struct task_struct
946 #
947 AC_DEFUN([LN_STRUCT_SIGHAND],
948 [AC_MSG_CHECKING([if task_struct has a sighand field])
949 LB_LINUX_TRY_COMPILE([
950         #include <linux/sched.h>
951 ],[
952         struct task_struct p;
953         p.sighand = NULL;
954 ],[
955         AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
956         AC_MSG_RESULT([yes])
957 ],[
958         AC_MSG_RESULT([no])
959 ])
960 ])
961
962 #
963 # LN_FUNC_CPU_ONLINE
964 #
965 # cpu_online is different in rh 2.4, vanilla 2.4, and 2.6
966 #
967 AC_DEFUN([LN_FUNC_CPU_ONLINE],
968 [AC_MSG_CHECKING([if kernel defines cpu_online()])
969 LB_LINUX_TRY_COMPILE([
970         #include <linux/sched.h>
971 ],[
972         cpu_online(0);
973 ],[
974         AC_MSG_RESULT([yes])
975         AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
976 ],[
977         AC_MSG_RESULT([no])
978 ])
979 ])
980
981 #
982 # LN_TYPE_GFP_T
983 #
984 # check if gfp_t is typedef-ed
985 #
986 AC_DEFUN([LN_TYPE_GFP_T],
987 [AC_MSG_CHECKING([if kernel defines gfp_t])
988 LB_LINUX_TRY_COMPILE([
989         #include <linux/gfp.h>
990 ],[
991         return sizeof(gfp_t);
992 ],[
993         AC_MSG_RESULT([yes])
994         AC_DEFINE(HAVE_GFP_T, 1, [gfp_t found])
995 ],[
996         AC_MSG_RESULT([no])
997 ])
998 ])
999
1000 #
1001 # LN_TYPE_CPUMASK_T
1002 #
1003 # same goes for cpumask_t
1004 #
1005 AC_DEFUN([LN_TYPE_CPUMASK_T],
1006 [AC_MSG_CHECKING([if kernel defines cpumask_t])
1007 LB_LINUX_TRY_COMPILE([
1008         #include <linux/sched.h>
1009 ],[
1010         return sizeof (cpumask_t);
1011 ],[
1012         AC_MSG_RESULT([yes])
1013         AC_DEFINE(HAVE_CPUMASK_T, 1, [cpumask_t found])
1014 ],[
1015         AC_MSG_RESULT([no])
1016 ])
1017 ])
1018
1019 #
1020 # LN_FUNC_SHOW_TASK
1021 #
1022 # we export show_task(), but not all kernels have it (yet)
1023 #
1024 AC_DEFUN([LN_FUNC_SHOW_TASK],
1025 [AC_MSG_CHECKING([if kernel exports show_task])
1026 have_show_task=0
1027 for file in ksyms sched ; do
1028         if grep -q "EXPORT_SYMBOL(show_task)" \
1029                  "$LINUX/kernel/$file.c" 2>/dev/null ; then
1030                 have_show_task=1
1031                 break
1032         fi
1033 done
1034 if test x$have_show_task = x1 ; then
1035         AC_DEFINE(HAVE_SHOW_TASK, 1, [show_task is exported])
1036         AC_MSG_RESULT([yes])
1037 else
1038         AC_MSG_RESULT([no])
1039 fi
1040 ])
1041
1042 # LN_TASKLIST_LOCK
1043 # 2.6.18 remove tasklist_lock export
1044 AC_DEFUN([LN_TASKLIST_LOCK],
1045 [AC_MSG_CHECKING([kernel export tasklist_lock])
1046         if grep -q "EXPORT_SYMBOL(tasklist_lock)" \
1047                  "$LINUX/kernel/fork.c" 2>/dev/null ; then
1048                 AC_DEFINE(HAVE_TASKLIST_LOCK, 1,
1049                           [tasklist_lock exported])
1050                 AC_MSG_RESULT([yes])
1051         else
1052                 AC_MSG_RESULT([no])
1053         fi
1054 ])
1055
1056 # 2.6.19 API changes
1057 # kmem_cache_destroy(cachep) return void instead of 
1058 # int
1059 AC_DEFUN([LN_KMEM_CACHE_DESTROY_INT],
1060 [AC_MSG_CHECKING([kmem_cache_destroy(cachep) return int])
1061 LB_LINUX_TRY_COMPILE([
1062         #include <linux/slab.h>
1063 ],[
1064         int i = kmem_cache_destroy(NULL);
1065 ],[
1066         AC_MSG_RESULT(yes)
1067         AC_DEFINE(HAVE_KMEM_CACHE_DESTROY_INT, 1,
1068                 [kmem_cache_destroy(cachep) return int])
1069 ],[
1070         AC_MSG_RESULT(NO)
1071 ])
1072 ])
1073
1074 #2.6.19 API change
1075 #panic_notifier_list use atomic_notifier operations
1076 #
1077 AC_DEFUN([LN_ATOMIC_PANIC_NOTIFIER],
1078 [AC_MSG_CHECKING([panic_notifier_list is atomic])
1079 LB_LINUX_TRY_COMPILE([
1080         #include <linux/notifier.h>
1081         #include <linux/kernel.h>       
1082 ],[
1083         struct atomic_notifier_head panic_notifier_list;
1084 ],[
1085         AC_MSG_RESULT(yes)
1086         AC_DEFINE(HAVE_ATOMIC_PANIC_NOTIFIER, 1,
1087                 [panic_notifier_list is atomic_notifier_head])
1088 ],[
1089         AC_MSG_RESULT(NO)
1090 ])
1091 ])
1092
1093 #
1094 # LN_PROG_LINUX
1095 #
1096 # LNet linux kernel checks
1097 #
1098 AC_DEFUN([LN_PROG_LINUX],
1099 [LN_CONFIG_ZEROCOPY
1100 LN_FUNC_CPU_ONLINE
1101 LN_TYPE_GFP_T
1102 LN_TYPE_CPUMASK_T
1103 LN_CONFIG_AFFINITY
1104 LN_CONFIG_BACKOFF
1105 LN_CONFIG_PANIC_DUMPLOG
1106 LN_CONFIG_QUADRICS
1107 LN_CONFIG_GM
1108 LN_CONFIG_OPENIB
1109 LN_CONFIG_CIB
1110 LN_CONFIG_VIB
1111 LN_CONFIG_IIB
1112 LN_CONFIG_O2IB
1113 LN_CONFIG_RALND
1114 LN_CONFIG_PTLLND
1115 LN_CONFIG_MX
1116
1117 LN_STRUCT_PAGE_LIST
1118 LN_STRUCT_SIGHAND
1119 LN_FUNC_SHOW_TASK
1120 # 2.6.18
1121 LN_TASKLIST_LOCK
1122 # 2.6.19
1123 LN_KMEM_CACHE_DESTROY_INT
1124 LN_ATOMIC_PANIC_NOTIFIER
1125 ])
1126
1127 #
1128 # LN_PROG_DARWIN
1129 #
1130 # Darwin checks
1131 #
1132 AC_DEFUN([LN_PROG_DARWIN],
1133 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
1134 ])
1135
1136 #
1137 # LN_PATH_DEFAULTS
1138 #
1139 # default paths for installed files
1140 #
1141 AC_DEFUN([LN_PATH_DEFAULTS],
1142 [
1143 ])
1144
1145 #
1146 # LN_CONFIGURE
1147 #
1148 # other configure checks
1149 #
1150 AC_DEFUN([LN_CONFIGURE],
1151 [# lnet/utils/portals.c
1152 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
1153 AC_CHECK_FUNCS([gethostbyname socket connect])
1154
1155 # lnet/utils/debug.c
1156 AC_CHECK_HEADERS([linux/version.h])
1157
1158 AC_CHECK_TYPE([spinlock_t],
1159         [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
1160         [],
1161         [#include <linux/spinlock.h>])
1162
1163 # lnet/utils/wirecheck.c
1164 AC_CHECK_FUNCS([strnlen])
1165
1166 # --------  Check for required packages  --------------
1167
1168 #
1169 # LC_CONFIG_READLINE
1170 #
1171 # Build with readline
1172 #
1173 AC_MSG_CHECKING([whether to enable readline support])
1174 AC_ARG_ENABLE(readline,
1175         AC_HELP_STRING([--disable-readline],
1176                         [disable readline support]),
1177         [],[enable_readline='yes'])
1178 AC_MSG_RESULT([$enable_readline])
1179
1180 # -------- check for readline if enabled ----
1181 if test x$enable_readline = xyes ; then
1182         LIBS_save="$LIBS"
1183         LIBS="-lncurses $LIBS"
1184         AC_CHECK_LIB([readline],[readline],[
1185         LIBREADLINE="-lreadline -lncurses"
1186         AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
1187         ],[
1188         LIBREADLINE=""
1189         ])
1190         LIBS="$LIBS_save"
1191 else
1192         LIBREADLINE=""
1193 fi
1194 AC_SUBST(LIBREADLINE)
1195
1196 AC_MSG_CHECKING([if efence debugging support is requested])
1197 AC_ARG_ENABLE(efence,
1198         AC_HELP_STRING([--enable-efence],
1199                         [use efence library]),
1200         [],[enable_efence='no'])
1201 AC_MSG_RESULT([$enable_efence])
1202 if test "$enable_efence" = "yes" ; then
1203         LIBEFENCE="-lefence"
1204         AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
1205 else
1206         LIBEFENCE=""
1207 fi
1208 AC_SUBST(LIBEFENCE)
1209
1210 # -------- enable acceptor libwrap (TCP wrappers) support? -------
1211 AC_MSG_CHECKING([if libwrap support is requested])
1212 AC_ARG_ENABLE([libwrap],
1213         AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
1214         [case "${enableval}" in
1215                 yes) enable_libwrap=yes ;;
1216                 no) enable_libwrap=no ;;
1217                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
1218         esac],[enable_libwrap=no])
1219 AC_MSG_RESULT([$enable_libwrap])
1220 if test x$enable_libwrap = xyes ; then
1221         LIBWRAP="-lwrap"
1222         AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
1223 else
1224         LIBWRAP=""
1225 fi
1226 AC_SUBST(LIBWRAP)
1227
1228 # -------- check for -lpthread support ----
1229 AC_MSG_CHECKING([whether to use libpthread for lnet library])
1230 AC_ARG_ENABLE([libpthread],
1231         AC_HELP_STRING([--disable-libpthread],
1232                 [disable libpthread]),
1233         [],[enable_libpthread=yes])
1234 if test "$enable_libpthread" = "yes" ; then
1235         AC_CHECK_LIB([pthread], [pthread_create],
1236                 [ENABLE_LIBPTHREAD="yes"],
1237                 [ENABLE_LIBPTHREAD="no"])
1238         if test "$ENABLE_LIBPTHREAD" = "yes" ; then
1239                 AC_MSG_RESULT([$ENABLE_LIBPTHREAD])
1240                 PTHREAD_LIBS="-lpthread"
1241                 AC_DEFINE([HAVE_LIBPTHREAD], 1, [use libpthread])
1242         else
1243                 PTHREAD_LIBS=""
1244                 AC_MSG_RESULT([no libpthread is found])
1245         fi
1246         AC_SUBST(PTHREAD_LIBS)
1247 else
1248         AC_MSG_RESULT([no (disabled explicitly)])
1249         ENABLE_LIBPTHREAD="no"
1250 fi
1251 AC_SUBST(ENABLE_LIBPTHREAD)
1252
1253 # ----------------------------------------
1254 # some tests for catamount-like systems
1255 # ----------------------------------------
1256 AC_ARG_ENABLE([sysio_init],
1257         AC_HELP_STRING([--disable-sysio-init],
1258                 [call sysio init functions when initializing liblustre]),
1259         [],[enable_sysio_init=yes])
1260 AC_MSG_CHECKING([whether to initialize libsysio])
1261 AC_MSG_RESULT([$enable_sysio_init])
1262 if test x$enable_sysio_init != xno ; then
1263         AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
1264 fi
1265
1266 AC_ARG_ENABLE([urandom],
1267         AC_HELP_STRING([--disable-urandom],
1268                 [disable use of /dev/urandom for liblustre]),
1269         [],[enable_urandom=yes])
1270 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
1271 AC_MSG_RESULT([$enable_urandom])
1272 if test x$enable_urandom != xno ; then
1273         AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
1274 fi
1275
1276 # -------- check for -lcap support ----
1277 if test x$enable_liblustre = xyes ; then
1278         AC_CHECK_LIB([cap], [cap_get_proc],
1279                 [
1280                         CAP_LIBS="-lcap"
1281                         AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
1282                 ],
1283                 [
1284                         CAP_LIBS=""
1285                 ])
1286         AC_SUBST(CAP_LIBS)
1287
1288 fi
1289
1290 LN_CONFIG_MAX_PAYLOAD
1291 LN_CONFIG_UPTLLND
1292 LN_CONFIG_USOCKLND
1293 ])
1294
1295 #
1296 # LN_CONDITIONALS
1297 #
1298 # AM_CONDITOINAL defines for lnet
1299 #
1300 AC_DEFUN([LN_CONDITIONALS],
1301 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
1302 AM_CONDITIONAL(BUILD_GMLND, test x$GMLND = "xgmlnd")
1303 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
1304 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
1305 AM_CONDITIONAL(BUILD_OPENIBLND, test x$OPENIBLND = "xopeniblnd")
1306 AM_CONDITIONAL(BUILD_CIBLND, test x$CIBLND = "xciblnd")
1307 AM_CONDITIONAL(BUILD_IIBLND, test x$IIBLND = "xiiblnd")
1308 AM_CONDITIONAL(BUILD_VIBLND, test x$VIBLND = "xviblnd")
1309 AM_CONDITIONAL(BUILD_RALND, test x$RALND = "xralnd")
1310 AM_CONDITIONAL(BUILD_PTLLND, test x$PTLLND = "xptllnd")
1311 AM_CONDITIONAL(BUILD_UPTLLND, test x$UPTLLND = "xptllnd")
1312 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
1313 ])
1314
1315 #
1316 # LN_CONFIG_FILES
1317 #
1318 # files that should be generated with AC_OUTPUT
1319 #
1320 AC_DEFUN([LN_CONFIG_FILES],
1321 [AC_CONFIG_FILES([
1322 lnet/Kernelenv
1323 lnet/Makefile
1324 lnet/autoMakefile
1325 lnet/autoconf/Makefile
1326 lnet/doc/Makefile
1327 lnet/include/Makefile
1328 lnet/include/libcfs/Makefile
1329 lnet/include/libcfs/linux/Makefile
1330 lnet/include/lnet/Makefile
1331 lnet/include/lnet/linux/Makefile
1332 lnet/klnds/Makefile
1333 lnet/klnds/autoMakefile
1334 lnet/klnds/gmlnd/Makefile
1335 lnet/klnds/mxlnd/autoMakefile
1336 lnet/klnds/mxlnd/Makefile
1337 lnet/klnds/gmlnd/autoMakefile
1338 lnet/klnds/openiblnd/Makefile
1339 lnet/klnds/openiblnd/autoMakefile
1340 lnet/klnds/o2iblnd/Makefile
1341 lnet/klnds/o2iblnd/autoMakefile
1342 lnet/klnds/ciblnd/Makefile
1343 lnet/klnds/ciblnd/autoMakefile
1344 lnet/klnds/iiblnd/Makefile
1345 lnet/klnds/iiblnd/autoMakefile
1346 lnet/klnds/viblnd/Makefile
1347 lnet/klnds/viblnd/autoMakefile
1348 lnet/klnds/qswlnd/Makefile
1349 lnet/klnds/qswlnd/autoMakefile
1350 lnet/klnds/ralnd/Makefile
1351 lnet/klnds/ralnd/autoMakefile
1352 lnet/klnds/socklnd/Makefile
1353 lnet/klnds/socklnd/autoMakefile
1354 lnet/klnds/ptllnd/Makefile
1355 lnet/klnds/ptllnd/autoMakefile
1356 lnet/libcfs/Makefile
1357 lnet/libcfs/autoMakefile
1358 lnet/libcfs/linux/Makefile
1359 lnet/lnet/Makefile
1360 lnet/lnet/autoMakefile
1361 lnet/tests/Makefile
1362 lnet/tests/autoMakefile
1363 lnet/ulnds/Makefile
1364 lnet/ulnds/autoMakefile
1365 lnet/ulnds/socklnd/Makefile
1366 lnet/ulnds/ptllnd/Makefile
1367 lnet/utils/Makefile
1368 ])
1369 case $lb_target_os in
1370         darwin)
1371                 AC_CONFIG_FILES([
1372 lnet/include/libcfs/darwin/Makefile
1373 lnet/include/lnet/darwin/Makefile
1374 lnet/libcfs/darwin/Makefile
1375 ])
1376                 ;;
1377 esac
1378 ])