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