Whamcloud - gitweb
LU-1422 lnet: eliminate obsolete Cray SeaStar support
[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                 CONFIG_LNET_MAX_PAYLOAD_MB=$with_max_payload_mb
14                 CONFIG_LNET_MAX_PAYLOAD="(($with_max_payload_mb)<<20)"
15         ], [
16                 AC_MSG_RESULT([no])
17                 CONFIG_LNET_MAX_PAYLOAD="LNET_MTU"
18         ])
19         AC_DEFINE_UNQUOTED(CONFIG_LNET_MAX_PAYLOAD, $CONFIG_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_ptr(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_BACKOFF
97 #
98 # check if tunable tcp backoff is available/wanted
99 #
100 AC_DEFUN([LN_CONFIG_BACKOFF],
101 [AC_MSG_CHECKING([for tunable backoff TCP support])
102 AC_ARG_ENABLE([backoff],
103        AC_HELP_STRING([--disable-backoff],
104                       [disable socknal tunable backoff]),
105        [],[enable_backoff='yes'])
106 if test x$enable_backoff = xno ; then
107        AC_MSG_RESULT([no (by request)])
108 else
109        BOCD="`grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h`"
110        if test "$BOCD" != 0 ; then
111                AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
112                AC_MSG_RESULT(yes)
113                if grep rto_max $LINUX/include/linux/tcp.h|grep -q __u16; then
114                    AC_DEFINE(SOCKNAL_BACKOFF_MS, 1, [tunable backoff TCP in ms])
115                fi
116        else
117                AC_MSG_RESULT([no (no kernel support)])
118        fi
119 fi
120 ])
121
122 #
123 # LN_CONFIG_USOCKLND
124 #
125 # configure support for userspace TCP/IP LND
126 #
127 AC_DEFUN([LN_CONFIG_USOCKLND],
128 [AC_MSG_CHECKING([whether to build usocklnd])
129 AC_ARG_ENABLE([usocklnd],
130         AC_HELP_STRING([--disable-usocklnd],
131                         [disable usocklnd]),
132         [],[enable_usocklnd='yes'])
133
134 if test x$enable_usocklnd = xyes ; then
135         if test "$ENABLE_LIBPTHREAD" = "yes" ; then
136                 AC_MSG_RESULT([yes])
137                 USOCKLND="usocklnd"
138         else
139                 AC_MSG_RESULT([no (libpthread not present or disabled)])
140                 USOCKLND=""
141         fi
142 else
143         AC_MSG_RESULT([no (disabled explicitly)])
144         USOCKLND=""
145 fi
146 AC_SUBST(USOCKLND)
147 ])
148
149 #
150 # LN_CONFIG_QUADRICS
151 #
152 # check if quadrics support is in this kernel
153 #
154 AC_DEFUN([LN_CONFIG_QUADRICS],
155 [AC_MSG_CHECKING([for QsNet sources])
156 AC_ARG_WITH([qsnet],
157         AC_HELP_STRING([--with-qsnet=path],
158                        [set path to qsnet source (default=$LINUX)]),
159         [QSNET=$with_qsnet],
160         [QSNET=$LINUX])
161 AC_MSG_RESULT([$QSNET])
162
163 AC_MSG_CHECKING([if quadrics kernel headers are present])
164 if test -d $QSNET/drivers/net/qsnet ; then
165         AC_MSG_RESULT([yes])
166         QSWLND="qswlnd"
167         AC_MSG_CHECKING([for multirail EKC])
168         if test -f $QSNET/include/elan/epcomms.h; then
169                 QSNET=$(readlink --canonicalize $QSNET)
170                 AC_MSG_RESULT([supported])
171                 QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
172         else
173                 AC_MSG_RESULT([not supported])
174                 AC_MSG_ERROR([Need multirail EKC])
175         fi
176
177         if test x$QSNET = x$LINUX ; then
178                 LB_LINUX_CONFIG([QSNET],[],[
179                         LB_LINUX_CONFIG([QSNET_MODULE],[],[
180                                 AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswlnd.])
181                                 QSWLND=""
182                                 QSWCPPFLAGS=""
183                         ])
184                 ])
185         fi
186 else
187         AC_MSG_RESULT([no])
188         QSWLND=""
189         QSWCPPFLAGS=""
190 fi
191 AC_SUBST(QSWCPPFLAGS)
192 AC_SUBST(QSWLND)
193 ])
194
195
196 #
197 # LN_CONFIG_MX
198 #
199 AC_DEFUN([LN_CONFIG_MX],
200 [AC_MSG_CHECKING([whether to enable Myrinet MX support])
201 # set default
202 MXPATH="/opt/mx"
203 AC_ARG_WITH([mx],
204        AC_HELP_STRING([--with-mx=path],
205                       [build mxlnd against path]),
206        [
207                case $with_mx in
208                yes)    ENABLEMX=2
209                        ;;
210                no)     ENABLEMX=0
211                        ;;
212                *)      MXPATH=$with_mx
213                        ENABLEMX=3
214                        ;;
215                esac
216        ],[
217                ENABLEMX=1
218        ])
219 if test $ENABLEMX -eq 0; then
220        AC_MSG_RESULT([disabled])
221 elif test ! \( -f ${MXPATH}/include/myriexpress.h -a \
222               -f ${MXPATH}/include/mx_kernel_api.h -a \
223               -f ${MXPATH}/include/mx_pin.h \); then
224        AC_MSG_RESULT([no])
225        case $ENABLEMX in
226        1) ;;
227        2) AC_MSG_ERROR([Myrinet MX kernel headers not present]);;
228        3) AC_MSG_ERROR([bad --with-mx path]);;
229        *) AC_MSG_ERROR([internal error]);;
230        esac
231 else
232        MXPATH=$(readlink --canonicalize $MXPATH)
233        MXCPPFLAGS="-I$MXPATH/include"
234        EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
235        EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
236        MXLIBS="-L$MXPATH/lib"
237        LB_LINUX_TRY_COMPILE([
238                #define MX_KERNEL 1
239                #include <mx_extensions.h>
240                #include <myriexpress.h>
241        ],[
242                mx_endpoint_t   end;
243                mx_status_t     status;
244                mx_request_t    request;
245                int             result;
246
247                mx_init();
248                mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
249                mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
250                mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
251                mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
252                return 0;
253        ],[
254                AC_MSG_RESULT([yes])
255                MXLND="mxlnd"
256        ],[
257                AC_MSG_RESULT([no])
258                case $ENABLEMX in
259                1) ;;
260                2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]);;
261                3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]);;
262                *) AC_MSG_ERROR([internal error]);;
263                esac
264                MXLND=""
265                MXCPPFLAGS=""
266        ])
267        EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
268 fi
269 AC_SUBST(MXCPPFLAGS)
270 AC_SUBST(MXLIBS)
271 AC_SUBST(MXLND)
272 ])
273
274
275
276 #
277 # LN_CONFIG_O2IB
278 #
279 AC_DEFUN([LN_CONFIG_O2IB],
280 [AC_MSG_CHECKING([whether to use Compat RDMA])
281 # set default
282 AC_ARG_WITH([o2ib],
283         AC_HELP_STRING([--with-o2ib=path],
284                        [build o2iblnd against path]),
285         [
286                 case $with_o2ib in
287                 yes)    O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
288                         ENABLEO2IB=2
289                         ;;
290                 no)     ENABLEO2IB=0
291                         ;;
292                 *)      O2IBPATHS=$with_o2ib
293                         ENABLEO2IB=3
294                         ;;
295                 esac
296         ],[
297                 O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
298                 ENABLEO2IB=1
299         ])
300 if test $ENABLEO2IB -eq 0; then
301         AC_MSG_RESULT([no])
302 else
303         o2ib_found=false
304         for O2IBPATH in $O2IBPATHS; do
305                 if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
306                            -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
307                            -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
308                            -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
309                         if test \( -d ${O2IBPATH}/kernel_patches -a \
310                                    -f ${O2IBPATH}/Makefile \); then
311                                 AC_MSG_RESULT([no])
312                                 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%-*}])
313                         fi
314                         o2ib_found=true
315                         break
316                 fi
317         done
318         if ! $o2ib_found; then
319                 AC_MSG_RESULT([no])
320                 case $ENABLEO2IB in
321                         1) ;;
322                         2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]);;
323                         3) AC_MSG_ERROR([bad --with-o2ib path]);;
324                         *) AC_MSG_ERROR([internal error]);;
325                 esac
326         else
327                 compatrdma_found=false
328                 if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
329                         compatrdma_found=true
330                         AC_MSG_RESULT([yes])
331                         AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
332                 else
333                         AC_MSG_RESULT([no])
334                 fi
335                 if ! $compatrdma_found; then
336                         if test -f $O2IBPATH/config.mk; then
337                                 . $O2IBPATH/config.mk
338                         elif test -f $O2IBPATH/ofed_patch.mk; then
339                                 . $O2IBPATH/ofed_patch.mk
340                         fi
341                 else
342                         case $RHEL_KERNEL_VERSION in
343                                 2.6.32-358*)
344                                         EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4";;
345                         esac
346                 fi
347                 AC_MSG_CHECKING([whether to use any OFED backport headers])
348                 if test -n "$BACKPORT_INCLUDES"; then
349                         OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
350                         EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
351                         AC_MSG_RESULT([yes])
352                 else
353                         AC_MSG_RESULT([no])
354                 fi
355
356                 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
357                 O2IBPATH=$(readlink --canonicalize $O2IBPATH)
358                 EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include"
359
360                 LB_LINUX_TRY_COMPILE([
361                         #include <linux/version.h>
362                         #include <linux/pci.h>
363                         #include <linux/gfp.h>
364                         #ifdef HAVE_COMPAT_RDMA
365                         #include <linux/compat-2.6.h>
366                         #endif
367                         #include <rdma/rdma_cm.h>
368                         #include <rdma/ib_cm.h>
369                         #include <rdma/ib_verbs.h>
370                         #include <rdma/ib_fmr_pool.h>
371                 ],[
372                         struct rdma_cm_id      *cm_idi __attribute__ ((unused));
373                         struct rdma_conn_param  conn_param __attribute__ ((unused));
374                         struct ib_device_attr   device_attr __attribute__ ((unused));
375                         struct ib_qp_attr       qp_attr __attribute__ ((unused));
376                         struct ib_pool_fmr      pool_fmr __attribute__ ((unused));
377                         enum   ib_cm_rej_reason rej_reason __attribute__ ((unused));
378
379                         rdma_destroy_id(NULL);
380                 ],[
381                         AC_MSG_RESULT([yes])
382                         O2IBLND="o2iblnd"
383                 ],[
384                         AC_MSG_RESULT([no])
385                         case $ENABLEO2IB in
386                         1) ;;
387                         2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]);;
388                         3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]);;
389                         *) AC_MSG_ERROR([internal error]);;
390                         esac
391                         O2IBLND=""
392                 ])
393                 # we know at this point that the found OFED source is good
394                 O2IB_SYMVER=""
395                 if test $ENABLEO2IB -eq 3 ; then
396                         # OFED default rpm not handle sles10 Modules.symvers name
397                         for name in Module.symvers Modules.symvers; do
398                                 if test -f $O2IBPATH/$name; then
399                                         O2IB_SYMVER=$name;
400                                         break;
401                                 fi
402                         done
403                         if test -n "$O2IB_SYMVER"; then
404                                 AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
405                                 # strip out the existing symbols versions first
406                                 if test -f $PWD/$SYMVERFILE; then
407                                 egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
408                                 else
409                                     touch $PWD/$SYMVERFILE.old
410                                 fi
411                                 cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
412                                 rm $PWD/$SYMVERFILE.old
413                         else
414                                 AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
415                         fi
416                 fi
417
418                 LN_CONFIG_OFED_SPEC
419         fi
420 fi
421
422 AC_SUBST(EXTRA_OFED_INCLUDE)
423 AC_SUBST(O2IBLND)
424
425 # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
426 if test $ENABLEO2IB -ne 0; then
427         AC_MSG_CHECKING([if rdma_create_id wants four args])
428         LB_LINUX_TRY_COMPILE([
429                 #ifdef HAVE_COMPAT_RDMA
430                 #include <linux/compat-2.6.h>
431                 #endif
432                 #include <rdma/rdma_cm.h>
433         ],[
434                 rdma_create_id(NULL, NULL, 0, 0);
435         ],[
436                 AC_MSG_RESULT([yes])
437                 AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
438                         [rdma_create_id wants 4 args])
439         ],[
440                 AC_MSG_RESULT([no])
441         ])
442 fi
443 ])
444
445 #
446 # LN_CONFIG_RALND
447 #
448 # check whether to use the RapidArray lnd
449 #
450 AC_DEFUN([LN_CONFIG_RALND],
451 [#### Rapid Array
452 AC_MSG_CHECKING([if RapidArray kernel headers are present])
453 # placeholder
454 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
455 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
456 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
457 LB_LINUX_TRY_COMPILE([
458         #include <linux/types.h>
459         #include <rapl.h>
460 ],[
461         RAP_RETURN          rc;
462         RAP_PVOID           dev_handle;
463
464         rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
465
466         return rc == RAP_SUCCESS ? 0 : 1;
467 ],[
468         AC_MSG_RESULT([yes])
469         RALND="ralnd"
470 ],[
471         AC_MSG_RESULT([no])
472         RALND=""
473         RACPPFLAGS=""
474 ])
475 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
476 AC_SUBST(RACPPFLAGS)
477 AC_SUBST(RALND)
478 ])
479
480 #
481 # LN_CONFIG_GNILND
482 #
483 # check whether to use the Gemini Network Interface lnd
484 #
485 AC_DEFUN([LN_CONFIG_GNILND],
486 [#### Gemini Network Interface
487 AC_MSG_CHECKING([whether to enable GNI lnd])
488 AC_ARG_ENABLE([gni],
489         AC_HELP_STRING([--enable-gni],
490                         [enable GNI lnd]),
491         [],[enable_gni='no'])
492 AC_MSG_RESULT([$enable_gni])
493
494 if test x$enable_gni = xyes ; then
495         AC_MSG_CHECKING([if GNI kernel headers are present])
496         # placeholder
497         # GNICPPFLAGS was set in spec file
498         EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
499         EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
500         LB_LINUX_TRY_COMPILE([
501                 #include <linux/types.h>
502                 #include <gni_pub.h>
503         ],[
504                 gni_cdm_handle_t        kgni_domain;
505                 gni_return_t            rc;
506                 int                     rrc;
507
508                 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
509
510                 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
511
512                 return rrc;
513         ],[
514                 AC_MSG_RESULT([yes])
515                 GNILND="gnilnd"
516         ],[
517                 AC_MSG_RESULT([no])
518                 AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
519         ])
520         # at this point, we have gnilnd basic support, now check for extra features
521         AC_MSG_CHECKING([to use RCA in gnilnd])
522         LB_LINUX_TRY_COMPILE([
523                 #include <linux/types.h>
524                 #include <gni_pub.h>
525                 #include <krca_lib.h>
526         ],[
527                 gni_cdm_handle_t        kgni_domain;
528                 gni_return_t            rc;
529                 krca_ticket_t           ticket = KRCA_NULL_TICKET;
530                 int                     rrc;
531                 __u32                   nid = 0, nic_addr;
532
533                 rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
534
535                 rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
536
537                 rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
538
539                 rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
540
541                 return rrc;
542         ],[
543                 AC_MSG_RESULT([yes])
544                 GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
545                 GNILNDRCA="gnilndrca"
546         ],[
547                 AC_MSG_RESULT([no])
548         ])
549         EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
550 fi
551 AC_SUBST(GNICPPFLAGS)
552 AC_SUBST(GNILNDRCA)
553 AC_SUBST(GNILND)
554 ])
555
556
557 #
558 #
559 # LN_CONFIG_USERSPACE
560 #
561 # This is defined but empty because it is called from
562 # build/autconf/lustre-build.m4 which is shared by all branches.
563 #
564 AC_DEFUN([LN_CONFIG_USERSPACE],
565 [
566 ])
567
568 #
569 # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
570 #
571 AC_DEFUN([LN_CONFIG_TCP_SENDPAGE],
572 [AC_MSG_CHECKING([if tcp_sendpage first parameter is socket])
573 tmp_flags="$EXTRA_KCFLAGS"
574 EXTRA_KCFLAGS="-Werror"
575 LB_LINUX_TRY_COMPILE([
576         #include <linux/net.h>
577         #include <net/tcp.h>
578 ],[
579         tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
580 ],[
581         AC_MSG_RESULT(yes)
582         AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
583                   [tcp_sendpage use socket as first parameter])
584 ],[
585         AC_MSG_RESULT(no)
586 ])
587 EXTRA_KCFLAGS="$tmp_flags"
588 ])
589
590 #
591 # LN_PROG_LINUX
592 #
593 # LNet linux kernel checks
594 #
595 AC_DEFUN([LN_PROG_LINUX],
596 [
597 LN_FUNC_DEV_GET_BY_NAME_2ARG
598 LN_CONFIG_AFFINITY
599 LN_CONFIG_BACKOFF
600 LN_CONFIG_QUADRICS
601 LN_CONFIG_O2IB
602 LN_CONFIG_RALND
603 LN_CONFIG_GNILND
604 LN_CONFIG_MX
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_USOCKLND
730 ])
731
732 #
733 # LN_CONDITIONALS
734 #
735 # AM_CONDITOINAL defines for lnet
736 #
737 AC_DEFUN([LN_CONDITIONALS],
738 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
739 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
740 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
741 AM_CONDITIONAL(BUILD_RALND, test x$RALND = "xralnd")
742 AM_CONDITIONAL(BUILD_GNILND, test x$GNILND = "xgnilnd")
743 AM_CONDITIONAL(BUILD_GNILND_RCA, test x$GNILNDRCA = "xgnilndrca")
744 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
745 ])
746
747 #
748 # LN_CONFIG_FILES
749 #
750 # files that should be generated with AC_OUTPUT
751 #
752 AC_DEFUN([LN_CONFIG_FILES],
753 [AC_CONFIG_FILES([
754 lnet/Kernelenv
755 lnet/Makefile
756 lnet/autoMakefile
757 lnet/autoconf/Makefile
758 lnet/doc/Makefile
759 lnet/include/Makefile
760 lnet/include/lnet/Makefile
761 lnet/include/lnet/linux/Makefile
762 lnet/klnds/Makefile
763 lnet/klnds/autoMakefile
764 lnet/klnds/mxlnd/autoMakefile
765 lnet/klnds/mxlnd/Makefile
766 lnet/klnds/o2iblnd/Makefile
767 lnet/klnds/o2iblnd/autoMakefile
768 lnet/klnds/qswlnd/Makefile
769 lnet/klnds/qswlnd/autoMakefile
770 lnet/klnds/ralnd/Makefile
771 lnet/klnds/ralnd/autoMakefile
772 lnet/klnds/gnilnd/Makefile
773 lnet/klnds/gnilnd/autoMakefile
774 lnet/klnds/socklnd/Makefile
775 lnet/klnds/socklnd/autoMakefile
776 lnet/lnet/Makefile
777 lnet/lnet/autoMakefile
778 lnet/selftest/Makefile
779 lnet/selftest/autoMakefile
780 lnet/ulnds/Makefile
781 lnet/ulnds/autoMakefile
782 lnet/ulnds/socklnd/Makefile
783 lnet/utils/Makefile
784 lnet/include/lnet/darwin/Makefile
785 ])
786 ])