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