Whamcloud - gitweb
LU-709 build: cleanup lustre-lnet.m4 and ofed.m4
[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_FUNC_DEV_GET_BY_NAME_2ARG
46 #
47 AC_DEFUN([LN_FUNC_DEV_GET_BY_NAME_2ARG],
48 [AC_MSG_CHECKING([if dev_get_by_name has two args])
49 LB_LINUX_TRY_COMPILE([
50         #include <linux/netdevice.h>
51 ],[
52         dev_get_by_name(NULL, NULL);
53 ],[
54         AC_MSG_RESULT([yes])
55         AC_DEFINE(HAVE_DEV_GET_BY_NAME_2ARG, 1, [dev_get_by_name has 2 args])
56 ],[
57         AC_MSG_RESULT([no])
58 ])
59 ])
60
61 #
62 # LN_CONFIG_AFFINITY
63 #
64 # check if cpu affinity is available/wanted
65 #
66 AC_DEFUN([LN_CONFIG_AFFINITY],
67 [AC_ARG_ENABLE([affinity],
68         AC_HELP_STRING([--disable-affinity],
69                        [disable process/irq affinity]),
70         [],[enable_affinity='yes'])
71
72 AC_MSG_CHECKING([for CPU affinity support])
73 if test x$enable_affinity = xno ; then
74         AC_MSG_RESULT([no (by request)])
75 else
76         LB_LINUX_TRY_COMPILE([
77                 #include <linux/sched.h>
78         ],[
79                 struct task_struct t;
80                 #if HAVE_CPUMASK_T
81                 cpumask_t     m;
82                 #else
83                 unsigned long m;
84                 #endif
85                 set_cpus_allowed(&t, m);
86         ],[
87                 AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
88                 AC_MSG_RESULT([yes])
89         ],[
90                 AC_MSG_RESULT([no (no kernel support)])
91         ])
92 fi
93 ])
94
95 #
96 # LN_CONFIG_PORTALS
97 #
98 # configure support for Portals
99 #
100 AC_DEFUN([LN_CONFIG_PORTALS],
101 [AC_MSG_CHECKING([for portals])
102 AC_ARG_WITH([portals],
103         AC_HELP_STRING([--with-portals=path],
104                        [set path to portals]),
105         [
106                 case $with_portals in
107                         no)     ENABLEPORTALS=0
108                                 ;;
109                         *)      PORTALS="${with_portals}"
110                                 ENABLEPORTALS=1
111                                 ;;
112                 esac
113         ], [
114                 ENABLEPORTALS=0
115         ])
116 PTLLNDCPPFLAGS=""
117 if test $ENABLEPORTALS -eq 0; then
118         AC_MSG_RESULT([no])
119 elif test ! \( -f ${PORTALS}/include/portals/p30.h \); then
120         AC_MSG_RESULT([no])
121         AC_MSG_ERROR([bad --with-portals path])
122 else
123         AC_MSG_RESULT([$PORTALS])
124         PTLLNDCPPFLAGS="-I${PORTALS}/include"
125 fi
126 AC_SUBST(PTLLNDCPPFLAGS)
127 ])
128
129 #
130 # LN_CONFIG_BACKOFF
131 #
132 # check if tunable tcp backoff is available/wanted
133 #
134 AC_DEFUN([LN_CONFIG_BACKOFF],
135 [AC_MSG_CHECKING([for tunable backoff TCP support])
136 AC_ARG_ENABLE([backoff],
137        AC_HELP_STRING([--disable-backoff],
138                       [disable socknal tunable backoff]),
139        [],[enable_backoff='yes'])
140 if test x$enable_backoff = xno ; then
141        AC_MSG_RESULT([no (by request)])
142 else
143        BOCD="`grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h`"
144        if test "$BOCD" != 0 ; then
145                AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
146                AC_MSG_RESULT(yes)
147                if grep rto_max $LINUX/include/linux/tcp.h|grep -q __u16; then
148                    AC_DEFINE(SOCKNAL_BACKOFF_MS, 1, [tunable backoff TCP in ms])
149                fi
150        else
151                AC_MSG_RESULT([no (no kernel support)])
152        fi
153 fi
154 ])
155
156
157 #
158 # LN_CONFIG_PTLLND
159 #
160 # configure support for Portals LND
161 #
162 AC_DEFUN([LN_CONFIG_PTLLND],
163 [
164 if test -z "$ENABLEPORTALS"; then
165         LN_CONFIG_PORTALS
166 fi
167
168 AC_MSG_CHECKING([whether to build the kernel portals LND])
169
170 PTLLND=""
171 if test $ENABLEPORTALS -ne 0; then
172         AC_MSG_RESULT([yes])
173         PTLLND="ptllnd"
174 else
175         AC_MSG_RESULT([no])
176 fi
177 AC_SUBST(PTLLND)
178 ])
179
180 #
181 # LN_CONFIG_UPTLLND
182 #
183 # configure support for Portals LND
184 #
185 AC_DEFUN([LN_CONFIG_UPTLLND],
186 [
187 if test -z "$ENABLEPORTALS"; then
188         LN_CONFIG_PORTALS
189 fi
190
191 AC_MSG_CHECKING([whether to build the userspace portals LND])
192
193 UPTLLND=""
194 if test $ENABLEPORTALS -ne 0; then
195         AC_MSG_RESULT([yes])
196         UPTLLND="ptllnd"
197 else
198         AC_MSG_RESULT([no])
199 fi
200 AC_SUBST(UPTLLND)
201 ])
202
203 #
204 # LN_CONFIG_USOCKLND
205 #
206 # configure support for userspace TCP/IP LND
207 #
208 AC_DEFUN([LN_CONFIG_USOCKLND],
209 [AC_MSG_CHECKING([whether to build usocklnd])
210 AC_ARG_ENABLE([usocklnd],
211         AC_HELP_STRING([--disable-usocklnd],
212                         [disable usocklnd]),
213         [],[enable_usocklnd='yes'])
214
215 if test x$enable_usocklnd = xyes ; then
216         if test "$ENABLE_LIBPTHREAD" = "yes" ; then
217                 AC_MSG_RESULT([yes])
218                 USOCKLND="usocklnd"
219         else
220                 AC_MSG_RESULT([no (libpthread not present or disabled)])
221                 USOCKLND=""
222         fi
223 else
224         AC_MSG_RESULT([no (disabled explicitly)])
225         USOCKLND=""
226 fi
227 AC_SUBST(USOCKLND)
228 ])
229
230 #
231 # LN_CONFIG_QUADRICS
232 #
233 # check if quadrics support is in this kernel
234 #
235 AC_DEFUN([LN_CONFIG_QUADRICS],
236 [AC_MSG_CHECKING([for QsNet sources])
237 AC_ARG_WITH([qsnet],
238         AC_HELP_STRING([--with-qsnet=path],
239                        [set path to qsnet source (default=$LINUX)]),
240         [QSNET=$with_qsnet],
241         [QSNET=$LINUX])
242 AC_MSG_RESULT([$QSNET])
243
244 AC_MSG_CHECKING([if quadrics kernel headers are present])
245 if test -d $QSNET/drivers/net/qsnet ; then
246         AC_MSG_RESULT([yes])
247         QSWLND="qswlnd"
248         AC_MSG_CHECKING([for multirail EKC])
249         if test -f $QSNET/include/elan/epcomms.h; then
250                 AC_MSG_RESULT([supported])
251                 QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
252         else
253                 AC_MSG_RESULT([not supported])
254                 AC_MSG_ERROR([Need multirail EKC])
255         fi
256
257         if test x$QSNET = x$LINUX ; then
258                 LB_LINUX_CONFIG([QSNET],[],[
259                         LB_LINUX_CONFIG([QSNET_MODULE],[],[
260                                 AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswlnd.])
261                                 QSWLND=""
262                                 QSWCPPFLAGS=""
263                         ])
264                 ])
265         fi
266 else
267         AC_MSG_RESULT([no])
268         QSWLND=""
269         QSWCPPFLAGS=""
270 fi
271 AC_SUBST(QSWCPPFLAGS)
272 AC_SUBST(QSWLND)
273 ])
274
275
276 #
277 # LN_CONFIG_MX
278 #
279 AC_DEFUN([LN_CONFIG_MX],
280 [AC_MSG_CHECKING([whether to enable Myrinet MX support])
281 # set default
282 MXPATH="/opt/mx"
283 AC_ARG_WITH([mx],
284        AC_HELP_STRING([--with-mx=path],
285                       [build mxlnd against path]),
286        [
287                case $with_mx in
288                yes)    ENABLEMX=2
289                        ;;
290                no)     ENABLEMX=0
291                        ;;
292                *)      MXPATH=$with_mx
293                        ENABLEMX=3
294                        ;;
295                esac
296        ],[
297                ENABLEMX=1
298        ])
299 if test $ENABLEMX -eq 0; then
300        AC_MSG_RESULT([disabled])
301 elif test ! \( -f ${MXPATH}/include/myriexpress.h -a \
302               -f ${MXPATH}/include/mx_kernel_api.h -a \
303               -f ${MXPATH}/include/mx_pin.h \); then
304        AC_MSG_RESULT([no])
305        case $ENABLEMX in
306        1) ;;
307        2) AC_MSG_ERROR([Myrinet MX kernel headers not present]);;
308        3) AC_MSG_ERROR([bad --with-mx path]);;
309        *) AC_MSG_ERROR([internal error]);;
310        esac
311 else
312        MXCPPFLAGS="-I$MXPATH/include"
313        EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
314        EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
315        MXLIBS="-L$MXPATH/lib"
316        LB_LINUX_TRY_COMPILE([
317                #define MX_KERNEL 1
318                #include <mx_extensions.h>
319                #include <myriexpress.h>
320        ],[
321                mx_endpoint_t   end;
322                mx_status_t     status;
323                mx_request_t    request;
324                int             result;
325
326                mx_init();
327                mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
328                mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
329                mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
330                mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
331                return 0;
332        ],[
333                AC_MSG_RESULT([yes])
334                MXLND="mxlnd"
335        ],[
336                AC_MSG_RESULT([no])
337                case $ENABLEMX in
338                1) ;;
339                2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]);;
340                3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]);;
341                *) AC_MSG_ERROR([internal error]);;
342                esac
343                MXLND=""
344                MXCPPFLAGS=""
345        ])
346        EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
347 fi
348 AC_SUBST(MXCPPFLAGS)
349 AC_SUBST(MXLIBS)
350 AC_SUBST(MXLND)
351 ])
352
353
354
355 #
356 # LN_CONFIG_O2IB
357 #
358 AC_DEFUN([LN_CONFIG_O2IB],[
359
360 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
361 # set default
362 AC_ARG_WITH([o2ib],
363         AC_HELP_STRING([--with-o2ib=path],
364                        [build o2iblnd against path]),
365         [
366                 case $with_o2ib in
367                 yes)    O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
368                         ENABLEO2IB=2
369                         ;;
370                 no)     ENABLEO2IB=0
371                         ;;
372                 *)      O2IBPATHS=$with_o2ib
373                         ENABLEO2IB=3
374                         ;;
375                 esac
376         ],[
377                 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
378                 ENABLEO2IB=1
379         ])
380 if test $ENABLEO2IB -eq 0; then
381         AC_MSG_RESULT([disabled])
382 else
383         o2ib_found=false
384         for O2IBPATH in $O2IBPATHS; do
385                 if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
386                            -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
387                            -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
388                            -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
389                         if test \( -d ${O2IBPATH}/kernel_patches -a \
390                                    -f ${O2IBPATH}/Makefile \); then
391                                 AC_MSG_RESULT([no])
392                                 AC_MSG_ERROR([you appear to be trying to use the OFED distribution's source directory (${O2IBPATH}) rather than the "development/headers" directory which is likely in ${O2IBPATH%-*}])
393                         fi
394                         o2ib_found=true
395                         break
396                 fi
397         done
398         if ! $o2ib_found; then
399                 AC_MSG_RESULT([no])
400                 case $ENABLEO2IB in
401                         1) ;;
402                         2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]);;
403                         3) AC_MSG_ERROR([bad --with-o2ib path]);;
404                         *) AC_MSG_ERROR([internal error]);;
405                 esac
406         else
407                 O2IBCPPFLAGS="-I$O2IBPATH/include"
408                 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
409                 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $O2IBCPPFLAGS"
410                 EXTRA_LNET_INCLUDE="$EXTRA_LNET_INCLUDE $O2IBCPPFLAGS"
411
412                 LB_LINUX_TRY_COMPILE([
413                         #include <linux/version.h>
414                         #include <linux/pci.h>
415                         #include <linux/gfp.h>
416                         #include <rdma/rdma_cm.h>
417                         #include <rdma/ib_cm.h>
418                         #include <rdma/ib_verbs.h>
419                         #include <rdma/ib_fmr_pool.h>
420                 ],[
421                         struct rdma_cm_id          *cm_id;
422                         struct rdma_conn_param      conn_param;
423                         struct ib_device_attr       device_attr;
424                         struct ib_qp_attr           qp_attr;
425                         struct ib_pool_fmr          pool_fmr;
426                         enum   ib_cm_rej_reason     rej_reason;
427
428                         rdma_destroy_id(NULL);
429                 ],[
430                         AC_MSG_RESULT([yes])
431                         O2IBLND="o2iblnd"
432                 ],[
433                         AC_MSG_RESULT([no])
434                         case $ENABLEO2IB in
435                         1) ;;
436                         2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]);;
437                         3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]);;
438                         *) AC_MSG_ERROR([internal error]);;
439                         esac
440                         O2IBLND=""
441                         O2IBCPPFLAGS=""
442                 ])
443                 # we know at this point that the found OFED source is good
444                 O2IB_SYMVER=""
445                 if test $ENABLEO2IB -eq 3 ; then
446                         # OFED default rpm not handle sles10 Modules.symvers name
447                         for name in Module.symvers Modules.symvers; do
448                                 if test -f $O2IBPATH/$name; then
449                                         O2IB_SYMVER=$name;
450                                         break;
451                                 fi
452                         done
453                         if test -n "$O2IB_SYMVER"; then
454                                 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
455                                 # strip out the existing symbols versions first
456                                 if test -f $PWD/$SYMVERFILE; then
457                                 egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
458                                 else
459                                     touch $PWD/$SYMVERFILE.old
460                                 fi
461                                 cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
462                                 rm $PWD/$SYMVERFILE.old
463                         else
464                                 AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
465                         fi
466                 fi
467
468                 LN_CONFIG_OFED_SPEC
469                 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
470         fi
471 fi
472
473 AC_SUBST(EXTRA_LNET_INCLUDE)
474 AC_SUBST(O2IBCPPFLAGS)
475 AC_SUBST(O2IBLND)
476
477 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
478 if test $ENABLEO2IB -ne 0; then
479         AC_MSG_CHECKING([if rdma_create_id wants four args])
480         LB_LINUX_TRY_COMPILE([
481                 #include <rdma/rdma_cm.h>
482         ],[
483                 rdma_create_id(NULL, NULL, 0, 0);
484         ],[
485                 AC_MSG_RESULT([yes])
486                 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
487                         [rdma_create_id wants 4 args])
488         ],[
489                 AC_MSG_RESULT([no])
490         ])
491 fi
492 ])
493
494 #
495 # LN_CONFIG_RALND
496 #
497 # check whether to use the RapidArray lnd
498 #
499 AC_DEFUN([LN_CONFIG_RALND],
500 [#### Rapid Array
501 AC_MSG_CHECKING([if RapidArray kernel headers are present])
502 # placeholder
503 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
504 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
505 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
506 LB_LINUX_TRY_COMPILE([
507         #include <linux/types.h>
508         #include <rapl.h>
509 ],[
510         RAP_RETURN          rc;
511         RAP_PVOID           dev_handle;
512
513         rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
514
515         return rc == RAP_SUCCESS ? 0 : 1;
516 ],[
517         AC_MSG_RESULT([yes])
518         RALND="ralnd"
519 ],[
520         AC_MSG_RESULT([no])
521         RALND=""
522         RACPPFLAGS=""
523 ])
524 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
525 AC_SUBST(RACPPFLAGS)
526 AC_SUBST(RALND)
527 ])
528
529
530
531 #
532 #
533 # LN_CONFIG_USERSPACE
534 #
535 # This is defined but empty because it is called from 
536 # build/autconf/lustre-build.m4 which is shared by all branches.
537 #
538 AC_DEFUN([LN_CONFIG_USERSPACE],
539 [
540 ])
541
542 # See if sysctl proc_handler wants only 5 arguments (since 2.6.32)
543 AC_DEFUN([LN_5ARGS_SYSCTL_PROC_HANDLER],
544 [AC_MSG_CHECKING([if sysctl proc_handler wants 5 args])
545 LB_LINUX_TRY_COMPILE([
546         #include <linux/sysctl.h>
547 ],[
548         struct ctl_table *table = NULL;
549         int write = 1;
550         void __user *buffer = NULL;
551         size_t *lenp = NULL;
552         loff_t *ppos = NULL;
553
554         proc_handler *proc_handler;
555         proc_handler(table, write, buffer, lenp, ppos);
556
557 ],[
558         AC_MSG_RESULT(yes)
559         AC_DEFINE(HAVE_5ARGS_SYSCTL_PROC_HANDLER, 1,
560                   [sysctl proc_handler wants 5 args])
561 ],[
562         AC_MSG_RESULT(no)
563 ])
564 ])
565
566 #
567 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
568 #
569 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE],
570 [AC_MSG_CHECKING([if tcp_sendpage first parameter is socket])
571 tmp_flags="$EXTRA_KCFLAGS"
572 EXTRA_KCFLAGS="-Werror"
573 LB_LINUX_TRY_COMPILE([
574         #include <linux/net.h>
575         #include <net/tcp.h>
576 ],[
577         tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
578 ],[
579         AC_MSG_RESULT(yes)
580         AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
581                   [tcp_sendpage use socket as first parameter])
582 ],[
583         AC_MSG_RESULT(no)
584 ])
585 EXTRA_KCFLAGS="$tmp_flags"
586 ])
587
588 #
589 # LN_PROG_LINUX
590 #
591 # LNet linux kernel checks
592 #
593 AC_DEFUN([LN_PROG_LINUX],
594 [
595 LN_FUNC_DEV_GET_BY_NAME_2ARG
596 LN_CONFIG_AFFINITY
597 LN_CONFIG_BACKOFF
598 LN_CONFIG_QUADRICS
599 LN_CONFIG_O2IB
600 LN_CONFIG_RALND
601 LN_CONFIG_PTLLND
602 LN_CONFIG_MX
603 # 2.6.32
604 LN_5ARGS_SYSCTL_PROC_HANDLER
605 # 2.6.36
606 LN_CONFIG_TCP_SENDPAGE
607 ])
608
609 #
610 # LN_PROG_DARWIN
611 #
612 # Darwin checks
613 #
614 AC_DEFUN([LN_PROG_DARWIN],
615 [LB_DARWIN_CHECK_FUNCS([get_preemption_level])
616 ])
617
618 #
619 # LN_PATH_DEFAULTS
620 #
621 # default paths for installed files
622 #
623 AC_DEFUN([LN_PATH_DEFAULTS],
624 [
625 ])
626
627 #
628 # LN_CONFIGURE
629 #
630 # other configure checks
631 #
632 AC_DEFUN([LN_CONFIGURE],
633 [# lnet/utils/portals.c
634 AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
635 AC_CHECK_FUNCS([gethostbyname socket connect])
636
637 # lnet/utils/debug.c
638 AC_CHECK_HEADERS([linux/version.h])
639
640 # lnet/utils/wirecheck.c
641 AC_CHECK_FUNCS([strnlen])
642
643 # --------  Check for required packages  --------------
644
645 #
646 # LC_CONFIG_READLINE
647 #
648 # Build with readline
649 #
650 AC_MSG_CHECKING([whether to enable readline support])
651 AC_ARG_ENABLE(readline,
652         AC_HELP_STRING([--disable-readline],
653                         [disable readline support]),
654         [],[enable_readline='yes'])
655 AC_MSG_RESULT([$enable_readline])
656
657 # -------- check for readline if enabled ----
658 if test x$enable_readline = xyes ; then
659         LIBS_save="$LIBS"
660         LIBS="-lncurses $LIBS"
661         AC_CHECK_LIB([readline],[readline],[
662         LIBREADLINE="-lreadline -lncurses"
663         AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
664         ],[
665         LIBREADLINE=""
666         ])
667         LIBS="$LIBS_save"
668 else
669         LIBREADLINE=""
670 fi
671 AC_SUBST(LIBREADLINE)
672
673 # -------- enable acceptor libwrap (TCP wrappers) support? -------
674 AC_MSG_CHECKING([if libwrap support is requested])
675 AC_ARG_ENABLE([libwrap],
676         AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
677         [case "${enableval}" in
678                 yes) enable_libwrap=yes ;;
679                 no) enable_libwrap=no ;;
680                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
681         esac],[enable_libwrap=no])
682 AC_MSG_RESULT([$enable_libwrap])
683 if test x$enable_libwrap = xyes ; then
684         LIBWRAP="-lwrap"
685         AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
686 else
687         LIBWRAP=""
688 fi
689 AC_SUBST(LIBWRAP)
690
691 # ----------------------------------------
692 # some tests for catamount-like systems
693 # ----------------------------------------
694 AC_ARG_ENABLE([sysio_init],
695         AC_HELP_STRING([--disable-sysio-init],
696                 [call sysio init functions when initializing liblustre]),
697         [],[enable_sysio_init=yes])
698 AC_MSG_CHECKING([whether to initialize libsysio])
699 AC_MSG_RESULT([$enable_sysio_init])
700 if test x$enable_sysio_init != xno ; then
701         AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
702 fi
703
704 AC_ARG_ENABLE([urandom],
705         AC_HELP_STRING([--disable-urandom],
706                 [disable use of /dev/urandom for liblustre]),
707         [],[enable_urandom=yes])
708 AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
709 AC_MSG_RESULT([$enable_urandom])
710 if test x$enable_urandom != xno ; then
711         AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
712 fi
713
714 # -------- check for -lcap support ----
715 if test x$enable_liblustre = xyes ; then
716         AC_CHECK_LIB([cap], [cap_get_proc],
717                 [
718                         CAP_LIBS="-lcap"
719                         AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
720                 ],
721                 [
722                         CAP_LIBS=""
723                 ])
724         AC_SUBST(CAP_LIBS)
725
726 fi
727
728 LN_CONFIG_MAX_PAYLOAD
729 LN_CONFIG_UPTLLND
730 LN_CONFIG_USOCKLND
731 ])
732
733 #
734 # LN_CONDITIONALS
735 #
736 # AM_CONDITOINAL defines for lnet
737 #
738 AC_DEFUN([LN_CONDITIONALS],
739 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
740 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
741 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
742 AM_CONDITIONAL(BUILD_RALND, test x$RALND = "xralnd")
743 AM_CONDITIONAL(BUILD_PTLLND, test x$PTLLND = "xptllnd")
744 AM_CONDITIONAL(BUILD_UPTLLND, test x$UPTLLND = "xptllnd")
745 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
746 ])
747
748 #
749 # LN_CONFIG_FILES
750 #
751 # files that should be generated with AC_OUTPUT
752 #
753 AC_DEFUN([LN_CONFIG_FILES],
754 [AC_CONFIG_FILES([
755 lnet/Kernelenv
756 lnet/Makefile
757 lnet/autoMakefile
758 lnet/autoconf/Makefile
759 lnet/doc/Makefile
760 lnet/include/Makefile
761 lnet/include/lnet/Makefile
762 lnet/include/lnet/linux/Makefile
763 lnet/klnds/Makefile
764 lnet/klnds/autoMakefile
765 lnet/klnds/mxlnd/autoMakefile
766 lnet/klnds/mxlnd/Makefile
767 lnet/klnds/o2iblnd/Makefile
768 lnet/klnds/o2iblnd/autoMakefile
769 lnet/klnds/qswlnd/Makefile
770 lnet/klnds/qswlnd/autoMakefile
771 lnet/klnds/ralnd/Makefile
772 lnet/klnds/ralnd/autoMakefile
773 lnet/klnds/socklnd/Makefile
774 lnet/klnds/socklnd/autoMakefile
775 lnet/klnds/ptllnd/Makefile
776 lnet/klnds/ptllnd/autoMakefile
777 lnet/lnet/Makefile
778 lnet/lnet/autoMakefile
779 lnet/selftest/Makefile
780 lnet/selftest/autoMakefile
781 lnet/ulnds/Makefile
782 lnet/ulnds/autoMakefile
783 lnet/ulnds/socklnd/Makefile
784 lnet/ulnds/ptllnd/Makefile
785 lnet/utils/Makefile
786 lnet/include/lnet/darwin/Makefile
787 ])
788 ])