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